bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / filter / ww8 / ww8par.hxx
blob4dd903e150875026c234da0717b1913aaa1c6521
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _WW8PAR_HXX
21 #define _WW8PAR_HXX
23 #include <tools/string.hxx>
24 #include <filter/msfilter/msdffimp.hxx>
25 #include <editeng/frmdir.hxx>
26 #include <fltshell.hxx> // fuer den Attribut Stack
28 #include <vector>
29 #include <stack>
30 #include <deque>
31 #include <map>
32 #include <utility>
34 #include "ww8struc.hxx" // WW8_BRC
35 #include "ww8scan.hxx" // WW8Fib
36 #include "ww8glsy.hxx"
37 #include "wrtww8.hxx"
38 #include "../inc/msfilter.hxx"
39 #include <xmloff/odffields.hxx>
40 #include <IMark.hxx>
42 #include <swtypes.hxx> // enum RndStdIds
43 #include <fmtfsize.hxx>
44 #include <fmtornt.hxx>
45 #include <fmtsrnd.hxx>
46 #include <editeng/lrspitem.hxx>
47 #include <oox/ole/olehelper.hxx>
49 #include <boost/noncopyable.hpp>
51 class SwDoc;
52 class SwPaM;
53 class SfxPoolItem;
54 class SwTxtFmtColl;
55 class SwPageDesc;
56 class SvxBoxItem;
57 class SwFmt;
58 class SwNodeIndex;
59 class SwFlyFrmFmt;
60 class SwAttrSet;
61 class SwNumRule;
62 class SwFrmFmt;
63 class Writer;
64 class SwFmtFld;
65 class WW8Fib;
66 class WW8PLCFMan;
67 struct WW8PLCFManResult;
68 class WW8RStyle;
69 class WW8PLCF_HdFt;
70 class WW8Dop;
71 class WW8ScannerBase;
72 struct WW8FieldDesc;
73 struct WW8FlyPara;
74 struct WW8SwFlyPara;
75 struct WW8_PIC;
76 class WW8TabDesc;
77 struct WW8_SHD;
78 struct WW8_OLST;
79 class SwNumFmt;
80 struct WW8_ANLD;
81 struct WW8_ANLV;
82 struct WW8_DO;
83 struct WW8_DPHEAD;
84 struct WW8_FSPA;
85 class SdrModel;
86 class SdrPage;
87 class SdrObject;
88 class SdrTextObj;
89 class Size;
90 class EditEngine;
91 struct SwPosition;
92 class WW8ReaderSave;
93 struct WW8PicDesc;
94 class Graphic;
95 class SwFieldType;
96 class SvStorage;
97 // alt: class SvStorageRef;
98 class SwAttrSet;
99 class GDIMetaFile;
100 struct ESelection;
101 class SfxItemSet;
102 class WW8ReadFieldParams;
103 class wwZOrderer;
104 class OutlinerParaObject;
106 namespace com{namespace sun {namespace star{
107 namespace beans{ class XPropertySet;}
108 namespace form { class XFormComponent;}
109 namespace drawing{class XShape;}
110 namespace lang{class XMultiServiceFactory;}
113 // defines nur fuer die WW8-variable der INI-Datei
114 #define WW8FL_NO_TEXT 1
115 #define WW8FL_NO_STYLES 2
116 #define WW8FL_NO_ZSTYLES 4 // keine Zeichenstyles importieren
117 #define WW8FL_NO_GRAF 0x80
119 // falls gestetzt, werden fuer Writer-Def-Styles neue Styles mit den
120 // WW8-Def-Style-Eigenschaften erzeugt, statt die Writer-Standards zu
121 // ueberschreiben
122 #define WW8FL_NO_DEFSTYLES 0x400
124 #define WW8FL_NO_OUTLINE 0x1000
125 #define WW8FL_NO_IMPLPASP 0x4000 // no implicit para space
126 #define WW8FL_NO_GRAFLAYER 0x8000
128 // Zusatz-Filter-Flags, gueltig ab Winword 8
129 #define WW8FL_NO_FLY_FOR_TXBX 1
131 //-----------------------------------------
132 // Listen-Manager (ab Ver8)
133 //-----------------------------------------
135 struct WW8LFOInfo;
137 class WW8Reader : public StgReader
139 virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &);
140 sal_uLong OpenMainStream( SvStorageStreamRef& rRef, sal_uInt16& rBuffSize );
141 public:
142 virtual int GetReaderType();
144 virtual sal_Bool HasGlossaries() const;
145 virtual sal_Bool ReadGlossaries( SwTextBlocks&, sal_Bool bSaveRelFiles ) const;
148 class SwWW8ImplReader;
149 struct WW8LSTInfo;
150 class WW8ListManager
152 public:
153 WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_);
154 //Min and Max possible List Levels in Word
155 enum ListLevel {nMinLevel=1, nMaxLevel=9};
156 //the rParaSprms returns back the original word paragraph indent
157 //sprms which were attached to the original numbering format
158 SwNumRule* GetNumRuleForActivation(sal_uInt16 nLFOPosition, const sal_uInt8 nLevel,
159 std::vector<sal_uInt8> &rParaSprms, SwTxtNode *pNode=0);
160 SwNumRule* CreateNextRule(bool bSimple);
161 ~WW8ListManager();
162 SwNumRule* GetNumRule(size_t i);
163 size_t GetWW8LSTInfoNum() const{return maLSTInfos.size();}
164 private:
165 wwSprmParser maSprmParser;
166 SwWW8ImplReader& rReader;
167 SwDoc& rDoc;
168 const WW8Fib& rFib;
169 SvStream& rSt;
170 std::vector<WW8LSTInfo* > maLSTInfos;
171 boost::ptr_vector<WW8LFOInfo > pLFOInfos;// D. aus PLF LFO, sortiert genau wie im WW8 Stream
172 sal_uInt16 nUniqueList; // current number for creating unique list names
173 sal_uInt8* GrpprlHasSprm(sal_uInt16 nId, sal_uInt8& rSprms, sal_uInt8 nLen);
174 WW8LSTInfo* GetLSTByListId( sal_uInt32 nIdLst ) const;
175 //the rParaSprms returns back the original word paragraph indent
176 //sprms which are attached to this numbering level
177 bool ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, sal_uInt16 nLevelStyle,
178 bool bSetStartNo, std::deque<bool> &rNotReallyThere, sal_uInt16 nLevel,
179 ww::bytes &rParaSprms);
181 // Zeichenattribute aus GrpprlChpx
182 typedef SfxItemSet* WW8aISet[nMaxLevel];
183 // Zeichen Style Pointer
184 typedef SwCharFmt* WW8aCFmt[nMaxLevel];
186 void AdjustLVL(sal_uInt8 nLevel, SwNumRule& rNumRule, WW8aISet& rListItemSet,
187 WW8aCFmt& aCharFmt, bool& bNewCharFmtCreated,
188 String aPrefix = aEmptyStr);
190 //No copying
191 WW8ListManager(const WW8ListManager&);
192 WW8ListManager& operator=(const WW8ListManager&);
193 sal_uInt16 nLastLFOPosition;
196 struct WW8FlyPara
197 { // WinWord-Attribute
198 // Achtung: *Nicht* umsortieren, da Teile mit
199 // memcmp verglichen werden
200 bool bVer67;
201 sal_Int16 nSp26, nSp27; // rohe Position
202 sal_Int16 nSp45, nSp28; // Breite / Hoehe
203 sal_Int16 nLeMgn, nRiMgn, nUpMgn, nLoMgn; // Raender
204 sal_uInt8 nSp29; // rohe Bindung + Alignment
205 sal_uInt8 nSp37; // Wrap-Mode ( 1 / 2; 0 = no Apo ? )
206 WW8_BRC5 brc; // Umrandung Top, Left, Bottom, Right, Between
207 bool bBorderLines; // Umrandungslinien
208 bool bGrafApo; // true: Dieser Rahmen dient allein dazu, die
209 // enthaltene Grafik anders als zeichengebunden
210 // zu positionieren
211 bool mbVertSet; // true if vertical positioning has been set
213 WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc = 0);
214 bool operator==(const WW8FlyPara& rSrc) const;
215 void Read(sal_uInt8 nSprm29, WW8PLCFx_Cp_FKP* pPap);
216 void ReadFull(sal_uInt8 nSprm29, SwWW8ImplReader* pIo);
217 void Read(sal_uInt8 nSprm29, WW8RStyle* pStyle);
218 void ApplyTabPos(const WW8_TablePos *pTabPos);
219 bool IsEmpty() const;
222 class SwWW8StyInf
224 String sWWStyleName;
225 sal_uInt16 nWWStyleId;
226 public:
227 rtl_TextEncoding eLTRFontSrcCharSet; // rtl_TextEncoding fuer den Font
228 rtl_TextEncoding eRTLFontSrcCharSet; // rtl_TextEncoding fuer den Font
229 rtl_TextEncoding eCJKFontSrcCharSet; // rtl_TextEncoding fuer den Font
230 SwFmt* pFmt;
231 WW8FlyPara* pWWFly;
232 SwNumRule* pOutlineNumrule;
233 long nFilePos;
234 sal_uInt16 nBase;
235 sal_uInt16 nFollow;
236 sal_uInt16 nLFOIndex;
237 sal_uInt8 nListLevel;
238 sal_uInt8 nOutlineLevel; // falls Gliederungs-Style
239 sal_uInt16 n81Flags; // Fuer Bold, Italic, ...
240 sal_uInt16 n81BiDiFlags; // Fuer Bold, Italic, ...
241 SvxLRSpaceItem maWordLR;
242 bool bValid; // leer oder Valid
243 bool bImported; // fuers rekursive Importieren
244 bool bColl; // true-> pFmt ist SwTxtFmtColl
245 bool bImportSkipped; // nur true bei !bNewDoc && vorh. Style
246 bool bHasStyNumRule; // true-> Benannter NumRule in Style
247 bool bHasBrokenWW6List; // true-> WW8+ style has a WW7- list
248 bool bListReleventIndentSet; //true if this style's indent has
249 //been explicitly set, it's set to the value
250 //of pFmt->GetItemState(RES_LR_SPACE, false)
251 //if it was possible to get the ItemState
252 //for L of the LR space independantly
253 bool bParaAutoBefore; // For Auto spacing before a paragraph
254 bool bParaAutoAfter; // For Auto Spacing after a paragraph
256 SwWW8StyInf() :
257 sWWStyleName( aEmptyStr ),
258 nWWStyleId( 0 ),
259 eLTRFontSrcCharSet(0),
260 eRTLFontSrcCharSet(0),
261 eCJKFontSrcCharSet(0),
262 pFmt( 0 ),
263 pWWFly( 0 ),
264 pOutlineNumrule( 0 ),
265 nFilePos( 0 ),
266 nBase( 0 ),
267 nFollow( 0 ),
268 nLFOIndex( USHRT_MAX ),
269 nListLevel(WW8ListManager::nMaxLevel),
270 nOutlineLevel( MAXLEVEL ),
271 n81Flags( 0 ),
272 n81BiDiFlags(0),
273 maWordLR( RES_LR_SPACE ),
274 bValid(false),
275 bImported(false),
276 bColl(false),
277 bImportSkipped(false),
278 bHasStyNumRule(false),
279 bHasBrokenWW6List(false),
280 bListReleventIndentSet(false),
281 bParaAutoBefore(false),
282 bParaAutoAfter(false)
286 ~SwWW8StyInf()
288 delete pWWFly;
291 void SetOrgWWIdent( const String& rName, const sal_uInt16 nId )
293 sWWStyleName = rName;
294 nWWStyleId = nId;
296 sal_uInt16 GetWWStyleId() const { return nWWStyleId; }
297 const String& GetOrgWWName() const
299 return sWWStyleName;
301 bool IsOutline() const
303 return (pFmt && (MAXLEVEL > nOutlineLevel));
305 bool IsOutlineNumbered() const
307 return pOutlineNumrule && IsOutline();
309 const SwNumRule* GetOutlineNumrule() const
311 return pOutlineNumrule;
313 CharSet GetCharSet() const;
314 CharSet GetCJKCharSet() const;
317 //-----------------------------------------
318 // Stack
319 //-----------------------------------------
320 class SwWW8FltControlStack : public SwFltControlStack
322 private:
323 SwWW8ImplReader& rReader;
324 sal_uInt16 nToggleAttrFlags;
325 sal_uInt16 nToggleBiDiAttrFlags;
326 //No copying
327 SwWW8FltControlStack(const SwWW8FltControlStack&);
328 SwWW8FltControlStack& operator=(const SwWW8FltControlStack&);
329 const SwNumFmt* GetNumFmtFromStack(const SwPosition &rPos,
330 const SwTxtNode &rTxtNode);
331 protected:
332 virtual void SetAttrInDoc(const SwPosition& rTmpPos,
333 SwFltStackEntry& rEntry);
335 virtual sal_Int32 GetCurrAttrCP() const;
336 virtual bool IsParaEndInCPs(sal_Int32 nStart,sal_Int32 nEnd,bool bSdOD=true) const;
337 //Clear the para end position recorded in reader intermittently for the least impact on loading performance
338 virtual void ClearParaEndPosition();
339 virtual bool CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd);
341 public:
342 SwWW8FltControlStack(SwDoc* pDo, sal_uLong nFieldFl, SwWW8ImplReader& rReader_ )
343 : SwFltControlStack( pDo, nFieldFl ), rReader( rReader_ ),
344 nToggleAttrFlags(0), nToggleBiDiAttrFlags(0)
347 void NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr);
349 virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand=LONG_MAX, sal_Bool consumedByField=sal_False);
351 void SetToggleAttr(sal_uInt8 nId, bool bOn)
353 if( bOn )
354 nToggleAttrFlags |= (1 << nId);
355 else
356 nToggleAttrFlags &= ~(1 << nId);
359 sal_uInt16 GetToggleAttrFlags() const { return nToggleAttrFlags; }
361 void SetToggleBiDiAttr(sal_uInt8 nId, bool bOn)
363 if( bOn )
364 nToggleBiDiAttrFlags |= (1 << nId);
365 else
366 nToggleBiDiAttrFlags &= ~(1 << nId);
369 sal_uInt16 GetToggleBiDiAttrFlags() const { return nToggleBiDiAttrFlags; }
370 void SetToggleAttrFlags(sal_uInt16 nFlags) { nToggleAttrFlags = nFlags; }
371 void SetToggleBiDiAttrFlags(sal_uInt16 nFlags) {nToggleBiDiAttrFlags = nFlags;}
373 const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich);
374 const SfxPoolItem* GetStackAttr(const SwPosition& rPos, sal_uInt16 nWhich);
377 //The only thing this is for is RES_FLTR_ANCHOR, anything else is an error.
378 //For graphics whose anchoring position would otherwise be automatically moved
379 //along by the insertion of text.
380 class SwWW8FltAnchorStack : public SwFltControlStack
382 public:
383 SwWW8FltAnchorStack(SwDoc* pDo, sal_uLong nFieldFl)
384 : SwFltControlStack( pDo, nFieldFl ) {}
385 void AddAnchor(const SwPosition& rPos,SwFrmFmt *pFmt);
386 void Flush();
387 private:
388 //No copying
389 SwWW8FltAnchorStack(const SwWW8FltAnchorStack&);
390 SwWW8FltAnchorStack& operator=(const SwWW8FltAnchorStack&);
393 //For fields whose handling cannot be fully resolved until we hit the end of
394 //the document.
395 class Position
397 public:
398 SwNodeIndex maMkNode;
399 SwNodeIndex maPtNode;
400 xub_StrLen mnMkCntnt;
401 xub_StrLen mnPtCntnt;
402 Position(const SwPaM &rPaM);
403 Position(const Position &rEntry);
404 private:
405 //No assignment
406 Position& operator=(const Position&);
409 class SwWW8FltRefStack : public SwFltEndStack
411 public:
412 SwWW8FltRefStack(SwDoc* pDo, sal_uLong nFieldFl)
413 : SwFltEndStack( pDo, nFieldFl )
415 bool IsFtnEdnBkmField(const SwFmtFld& rFmtFld, sal_uInt16& rBkmNo);
417 struct ltstr
419 bool operator()(const String &r1, const String &r2) const
421 return r1.CompareIgnoreCaseToAscii(r2) == COMPARE_LESS;
424 //Keep track of variable names created with fields, and the bookmark
425 //mapped to their position, hopefully the same, but very possibly
426 //an additional pseudo bookmark
427 std::map<String, String, ltstr> aFieldVarNames;
428 protected:
429 SwFltStackEntry *RefToVar(const SwField* pFld,SwFltStackEntry& rEntry);
430 virtual void SetAttrInDoc(const SwPosition& rTmpPos,
431 SwFltStackEntry& rEntry);
432 private:
433 //No copying
434 SwWW8FltRefStack(const SwWW8FltRefStack&);
435 SwWW8FltRefStack& operator=(const SwWW8FltRefStack&);
439 namespace sw
441 namespace hack
443 class Position
445 private:
446 SwNodeIndex maPtNode;
447 xub_StrLen mnPtCntnt;
448 public:
449 Position(const SwPosition &rPos);
450 Position(const Position &rPos);
451 operator SwPosition() const;
452 SwNodeIndex GetPtNode() { return maPtNode; };
453 xub_StrLen GetPtCntnt() { return mnPtCntnt; };
458 class WW8FieldEntry
460 private:
461 OUString msBookmarkName;
462 OUString msMarkType;
463 OUString msMarkCode;
464 ::sw::mark::IFieldmark::parameter_map_t maParams;
466 public:
467 sw::hack::Position maStartPos;
468 sal_uInt16 mnFieldId;
469 sal_uLong mnObjLocFc;
470 WW8FieldEntry(SwPosition &rPos, sal_uInt16 nFieldId) throw();
471 WW8FieldEntry(const WW8FieldEntry &rOther) throw();
472 WW8FieldEntry &operator=(const WW8FieldEntry &rOther) throw();
473 void Swap(WW8FieldEntry &rOther) throw();
475 SwNodeIndex GetPtNode() { return maStartPos.GetPtNode(); };
476 xub_StrLen GetPtCntnt() { return maStartPos.GetPtCntnt(); };
478 OUString GetBookmarkName();
479 OUString GetBookmarkCode();
480 void SetBookmarkName(OUString bookmarkName);
481 void SetBookmarkType(OUString bookmarkType);
482 void SetBookmarkCode(OUString bookmarkCode);
483 ::sw::mark::IFieldmark::parameter_map_t& getParameters();
487 //-----------------------------------------
488 // Mini-Merker fuer einige Flags
489 //-----------------------------------------
490 class WW8ReaderSave
492 private:
493 WW8PLCFxSaveAll maPLCFxSave;
494 SwPosition maTmpPos;
495 std::deque<bool> maOldApos;
496 std::deque<WW8FieldEntry> maOldFieldStack;
497 SwWW8FltControlStack* mpOldStck;
498 SwWW8FltAnchorStack* mpOldAnchorStck;
499 sw::util::RedlineStack *mpOldRedlines;
500 WW8PLCFMan* mpOldPlcxMan;
501 WW8FlyPara* mpWFlyPara;
502 WW8SwFlyPara* mpSFlyPara;
503 SwPaM* mpPreviousNumPaM;
504 const SwNumRule* mpPrevNumRule;
505 WW8TabDesc* mpTableDesc;
506 int mnInTable;
507 sal_uInt16 mnAktColl;
508 sal_Unicode mcSymbol;
509 bool mbIgnoreText;
510 bool mbSymbol;
511 bool mbHdFtFtnEdn;
512 bool mbTxbxFlySection;
513 bool mbAnl;
514 bool mbInHyperlink;
515 bool mbPgSecBreak;
516 bool mbWasParaEnd;
517 bool mbHasBorder;
518 bool mbFirstPara;
519 public:
520 WW8ReaderSave(SwWW8ImplReader* pRdr, WW8_CP nStart=-1);
521 void Restore(SwWW8ImplReader* pRdr);
522 const SwPosition &GetStartPos() const { return maTmpPos; }
525 enum eF_ResT{ FLD_OK, FLD_TEXT, FLD_TAGIGN, FLD_TAGTXT, FLD_READ_FSPA };
527 class SwWW8Shade
529 public:
530 Color aColor;
531 SwWW8Shade(bool bVer67, const WW8_SHD& rSHD);
532 SwWW8Shade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex)
534 SetShade(nFore, nBack, nIndex);
536 private:
537 void SetShade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex);
541 //-----------------------------------------
542 // Formulas
543 //-----------------------------------------
544 enum SwWw8ControlType
546 WW8_CT_EDIT,
547 WW8_CT_CHECKBOX,
548 WW8_CT_DROPDOWN
551 class WW8FormulaControl : private ::boost::noncopyable
553 protected:
554 SwWW8ImplReader &rRdr;
555 public:
556 WW8FormulaControl(const OUString& rN, SwWW8ImplReader &rR)
557 : rRdr(rR), fUnknown(0), fDropdownIndex(0),
558 fToolTip(0), fNoMark(0), fUseSize(0), fNumbersOnly(0), fDateOnly(0),
559 fUnused(0), nSize(0), hpsCheckBox(20), nChecked(0), sName( rN )
562 sal_uInt8 fUnknown:2;
563 sal_uInt8 fDropdownIndex:6;
564 sal_uInt8 fToolTip:1;
565 sal_uInt8 fNoMark:1;
566 sal_uInt8 fUseSize:1;
567 sal_uInt8 fNumbersOnly:1;
568 sal_uInt8 fDateOnly:1;
569 sal_uInt8 fUnused:3;
570 sal_uInt16 nSize;
572 sal_uInt16 hpsCheckBox;
573 sal_uInt16 nChecked;
574 sal_uInt16 nDefaultChecked;
576 OUString sTitle;
577 OUString sDefault;
578 OUString sFormatting;
579 OUString sHelp;
580 OUString sToolTip;
581 std::vector<OUString> maListEntries;
582 virtual ~WW8FormulaControl() {}
583 void FormulaRead(SwWw8ControlType nWhich,SvStream *pD);
584 virtual sal_Bool Import(const com::sun::star::uno::Reference <
585 com::sun::star::lang::XMultiServiceFactory> &rServiceFactory,
586 com::sun::star::uno::Reference <
587 com::sun::star::form::XFormComponent> &rFComp,
588 com::sun::star::awt::Size &rSz) = 0;
589 OUString sName;
592 class WW8FormulaCheckBox : public WW8FormulaControl
594 private:
595 //No copying
596 WW8FormulaCheckBox(const WW8FormulaCheckBox&);
597 WW8FormulaCheckBox& operator=(const WW8FormulaCheckBox&);
599 public:
600 WW8FormulaCheckBox(SwWW8ImplReader &rR);
602 virtual sal_Bool Import(const com::sun::star::uno::Reference <
603 com::sun::star::lang::XMultiServiceFactory> &rServiceFactory,
604 com::sun::star::uno::Reference <
605 com::sun::star::form::XFormComponent> &rFComp,
606 com::sun::star::awt::Size &rSz);
609 class WW8FormulaListBox : public WW8FormulaControl
611 private:
612 //No copying
613 WW8FormulaListBox(const WW8FormulaListBox&);
614 WW8FormulaListBox& operator=(const WW8FormulaListBox&);
616 public:
617 WW8FormulaListBox(SwWW8ImplReader &rR);
619 virtual sal_Bool Import(const com::sun::star::uno::Reference <
620 com::sun::star::lang::XMultiServiceFactory> &rServiceFactory,
621 com::sun::star::uno::Reference <
622 com::sun::star::form::XFormComponent> &rFComp,
623 com::sun::star::awt::Size &rSz);
626 class WW8FormulaEditBox : public WW8FormulaControl
628 private:
629 //No copying
630 WW8FormulaEditBox(const WW8FormulaEditBox&);
631 WW8FormulaEditBox& operator=(const WW8FormulaEditBox&);
632 public:
633 WW8FormulaEditBox(SwWW8ImplReader &rR);
634 //no real implementation, return false
635 virtual sal_Bool Import(const com::sun::star::uno::Reference <
636 com::sun::star::lang::XMultiServiceFactory> & /* rServiceFactory */,
637 com::sun::star::uno::Reference <
638 com::sun::star::form::XFormComponent> & /* rFComp */,
639 com::sun::star::awt::Size & /* rSz */) { return sal_False; }
642 class SwMSConvertControls: public oox::ole::MSConvertOCXControls
644 public:
645 SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP );
646 virtual sal_Bool InsertFormula( WW8FormulaControl &rFormula);
647 virtual sal_Bool InsertControl(const com::sun::star::uno::Reference<
648 com::sun::star::form::XFormComponent >& rFComp,
649 const ::com::sun::star::awt::Size& rSize,
650 com::sun::star::uno::Reference <
651 com::sun::star::drawing::XShape > *pShape,sal_Bool bFloatingCtrl);
652 bool ExportControl(WW8Export &rWrt, const SdrObject *pObj);
653 virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1,
654 com::sun::star::uno::Reference<
655 com::sun::star::drawing::XShape > *pShapeRef=0,
656 sal_Bool bFloatingCtrl=false );
657 private:
658 sal_uInt32 GenerateObjectID();
659 SwPaM *pPaM;
660 sal_uInt32 mnObjectId;
663 class SwMSDffManager : public SvxMSDffManager
665 private:
666 SwWW8ImplReader& rReader;
667 SvStream *pFallbackStream;
668 std::map<sal_uInt32,OString> aOldEscherBlipCache;
670 virtual sal_Bool GetOLEStorageName( long nOLEId, OUString& rStorageName,
671 SvStorageRef& rSrcStorage, com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rDestStorage ) const;
672 virtual sal_Bool ShapeHasText( sal_uLong nShapeId, sal_uLong nFilePos ) const;
673 // #i32596# - new parameter <_nCalledByGroup>, which
674 // indicates, if the OLE object is imported inside a group object
675 virtual SdrObject* ImportOLE( long nOLEId,
676 const Graphic& rGrf,
677 const Rectangle& rBoundRect,
678 const Rectangle& rVisArea,
679 const int _nCalledByGroup,
680 sal_Int64 nAspect ) const;
682 //No copying
683 SwMSDffManager(const SwMSDffManager&);
684 SwMSDffManager& operator=(const SwMSDffManager&);
685 public:
686 static sal_uInt32 GetFilterFlags();
687 static sal_Int32 GetEscherLineMatch(MSO_LineStyle eStyle, MSO_SPT eShapeType,
688 sal_Int32 &rThick);
689 SwMSDffManager( SwWW8ImplReader& rRdr );
690 void DisableFallbackStream();
691 void EnableFallbackStream();
692 protected:
693 virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, Rectangle& rTextRect, SdrObject* pObj );
697 class wwSection
699 public:
700 wwSection(const SwPosition &rPos);
701 SEPr maSep;
702 WW8_BRC brc[4];
703 SwNodeIndex maStart;
704 SwSection *mpSection;
705 SwPageDesc *mpPage;
706 SvxFrameDirection meDir;
707 short mLinkId;
709 sal_uInt32 nPgWidth;
710 sal_uInt32 nPgLeft;
711 sal_uInt32 nPgRight;
713 sal_uInt8 mnBorders;
714 bool mbHasFootnote;
715 void SetDirection();
716 void SetLinkId(short sLinkId) { mLinkId = sLinkId; }
717 bool DoesContainFootnote() const { return mbHasFootnote; }
718 bool IsContinous() const { return maSep.bkc == 0; }
719 bool IsLinked() const { return mLinkId != 0; }
720 bool IsNotProtected() const { return maSep.fUnlocked != 0; }
721 bool IsVertical() const;
722 sal_Int16 NoCols() const { return maSep.ccolM1 + 1; }
723 sal_Int32 StandardColSeparation() const { return maSep.dxaColumns; }
724 bool HasTitlePage() const { return maSep.fTitlePage ? true : false; }
725 sal_uInt16 PageStartAt() const { return maSep.pgnStart; }
726 bool PageRestartNo() const { return maSep.fPgnRestart ? true : false; }
727 bool IsBiDi() const { return maSep.fBiDi ? true : false; }
728 sal_uInt32 GetPageWidth() const { return nPgWidth; }
729 sal_uInt32 GetTextAreaWidth() const
730 { return GetPageWidth() - GetPageLeft() - GetPageRight(); }
731 sal_uInt32 GetPageHeight() const { return maSep.yaPage; }
732 sal_uInt32 GetPageLeft() const { return nPgLeft; }
733 sal_uInt32 GetPageRight() const { return nPgRight; }
734 bool IsLandScape() const { return maSep.dmOrientPage ? true : false; }
735 bool IsFixedHeightHeader() const { return maSep.dyaTop < 0; }
736 bool IsFixedHeightFooter() const { return maSep.dyaBottom < 0; }
739 class wwSectionManager
741 private:
743 A queue of the ms sections in the document
745 SwWW8ImplReader& mrReader;
746 std::deque<wwSection> maSegments;
747 typedef ::std::deque<wwSection>::iterator mySegIter;
748 typedef ::std::deque<wwSection>::reverse_iterator mySegrIter;
750 //Num of page desc's entered into the document
751 sal_uInt16 mnDesc;
753 struct wwULSpaceData
755 bool bHasHeader, bHasFooter;
756 sal_uInt32 nSwHLo, nSwFUp, nSwUp, nSwLo;
757 wwULSpaceData() : bHasHeader(false), bHasFooter(false) {}
760 void SetSegmentToPageDesc(const wwSection &rSection, bool bIgnoreCols);
762 void GetPageULData(const wwSection &rNewSection,
763 wwULSpaceData& rData) const;
764 void SetPageULSpaceItems(SwFrmFmt &rFmt, wwULSpaceData& rData,
765 const wwSection &rSection) const;
767 void SetPage(SwPageDesc &rPageDesc, SwFrmFmt &rFmt,
768 const wwSection &rSection, bool bIgnoreCols) const;
770 void SetNumberingType(const wwSection &rNewSection, SwPageDesc &rPageDesc)
771 const;
773 void SetUseOn(wwSection &rSection);
774 void SetHdFt(wwSection &rSection, int nSect, const wwSection *pPrevious);
776 SwSectionFmt *InsertSection(SwPaM& rMyPaM, wwSection &rSection);
777 bool SetCols(SwFrmFmt &rFmt, const wwSection &rSection,
778 sal_uInt32 nNettoWidth) const;
779 bool SectionIsProtected(const wwSection &rSection) const;
780 void SetLeftRight(wwSection &rSection);
781 bool IsNewDoc() const;
783 The segment we're inserting, the start of the segments container, and the
784 nodeindex of where we want the page break to (normally the segments start
785 position
787 SwFmtPageDesc SetSwFmtPageDesc(mySegIter &rIter, mySegIter &rStart,
788 bool bIgnoreCols);
790 //No copying
791 wwSectionManager(const wwSectionManager&);
792 wwSectionManager& operator=(const wwSectionManager&);
793 public:
794 wwSectionManager(SwWW8ImplReader &rReader) : mrReader(rReader), mnDesc(0)
796 void SetCurrentSectionHasFootnote();
797 bool CurrentSectionIsVertical() const;
798 bool CurrentSectionIsProtected() const;
799 void PrependedInlineNode(const SwPosition &rPos, const SwNode &rNode);
800 sal_uInt16 CurrentSectionColCount() const;
801 bool WillHavePageDescHere(SwNodeIndex aIdx) const;
802 void CreateSep(const long nTxtPos, bool bMustHaveBreak);
803 void InsertSegments();
804 void JoinNode(const SwPosition &rPos, const SwNode &rNode);
805 sal_uInt32 GetPageLeft() const;
806 sal_uInt32 GetPageRight() const;
807 sal_uInt32 GetPageWidth() const;
808 sal_uInt32 GetWWPageTopMargin() const;
809 bool empty() const { return maSegments.empty(); }
810 sal_uInt32 GetTextAreaWidth() const;
813 //Various writer elements like frames start off containing a blank paragraph,
814 //sometimes this paragraph turns out to be extraneous, e.g. the frame should
815 //only contain a table with no trailing paragraph.
817 //We want to remove these extra paragraphs, but removing them during the parse
818 //is problematic, because we don't want to remove any paragraphs that are still
819 //addressed by property entries in a SwFltControlStack which have not yet been
820 //committed to the document.
822 //Safest thing is to not delete SwTxtNodes from a document during import, and
823 //remove these extraneous paragraphs at the end after all SwFltControlStack are
824 //destroyed.
825 class wwExtraneousParas : private ::boost::noncopyable
827 private:
829 A vector of SwTxtNodes to erase from a document after import is complete
831 std::vector<SwTxtNode*> m_aTxtNodes;
832 SwDoc& m_rDoc;
833 public:
834 wwExtraneousParas(SwDoc &rDoc) : m_rDoc(rDoc) {}
835 ~wwExtraneousParas() { delete_all_from_doc(); }
836 void push_back(SwTxtNode *pTxtNode) { m_aTxtNodes.push_back(pTxtNode); }
837 void delete_all_from_doc();
840 class wwFrameNamer : private ::boost::noncopyable
842 private:
843 OUString msSeed;
844 sal_Int32 mnImportedGraphicsCount;
845 bool mbIsDisabled;
846 public:
847 void SetUniqueGraphName(SwFrmFmt *pFrmFmt, const OUString &rFixedPart);
848 wwFrameNamer(bool bIsDisabled, const OUString &rSeed)
849 : msSeed(rSeed), mnImportedGraphicsCount(0), mbIsDisabled(bIsDisabled)
854 class wwSectionNamer
856 private:
857 const SwDoc &mrDoc;
858 String msFileLinkSeed;
859 int mnFileSectionNo;
860 //No copying
861 wwSectionNamer(const wwSectionNamer&);
862 wwSectionNamer& operator=(const wwSectionNamer&);
863 public:
864 String UniqueName();
865 wwSectionNamer(const SwDoc &rDoc, const String &rSeed)
866 : mrDoc(rDoc), msFileLinkSeed(rSeed), mnFileSectionNo(0)
870 class FtnDescriptor
872 public:
873 ManTypes meType;
874 bool mbAutoNum;
875 WW8_CP mnStartCp;
876 WW8_CP mnLen;
879 struct ApoTestResults
881 bool mbStartApo;
882 bool mbStopApo;
883 bool m_bHasSprm37;
884 bool m_bHasSprm29;
885 sal_uInt8 m_nSprm29;
886 WW8FlyPara* mpStyleApo;
887 ApoTestResults()
888 : mbStartApo(false), mbStopApo(false), m_bHasSprm37(false)
889 , m_bHasSprm29(false), m_nSprm29(0), mpStyleApo(0) {}
890 bool HasStartStop() const { return (mbStartApo || mbStopApo); }
891 bool HasFrame() const { return (m_bHasSprm29 || m_bHasSprm37 || mpStyleApo); }
894 struct ANLDRuleMap
896 SwNumRule* mpOutlineNumRule; // WinWord 6 numbering, varient 1
897 SwNumRule* mpNumberingNumRule; // WinWord 6 numbering, varient 2
898 SwNumRule* GetNumRule(sal_uInt8 nNumType);
899 void SetNumRule(SwNumRule*, sal_uInt8 nNumType);
900 ANLDRuleMap() : mpOutlineNumRule(0), mpNumberingNumRule(0) {}
903 struct SprmReadInfo;
904 class SwDocShell;
905 struct WW8PostProcessAttrsInfo
907 bool mbCopy;
908 WW8_CP mnCpStart;
909 WW8_CP mnCpEnd;
910 SwPaM mPaM;
911 SfxItemSet mItemSet;
913 WW8PostProcessAttrsInfo(WW8_CP nCpStart, WW8_CP nCpEnd, SwPaM & rPaM);
916 #define MAX_COL 64 // WW6-description: 32, WW6-UI: 31 & WW8-UI: 63!
918 struct WW8TabBandDesc
920 WW8TabBandDesc* pNextBand;
921 short nGapHalf;
922 short mnDefaultLeft;
923 short mnDefaultTop;
924 short mnDefaultRight;
925 short mnDefaultBottom;
926 bool mbHasSpacing;
927 short nLineHeight;
928 short nRows;
929 sal_uInt16 maDirections[MAX_COL + 1];
930 short nCenter[MAX_COL + 1]; // X-edge of all cells of this band
931 short nWidth[MAX_COL + 1]; // length of all cells of this band
932 short nWwCols; // sal_uInt8 would be sufficient, alignment -> short
933 short nSwCols; // SW: number of columns for the writer
934 bool bLEmptyCol; // SW: an additional empty column at the left
935 bool bREmptyCol; // SW: same at the right
936 bool bCantSplit;
937 bool bCantSplit90;
938 WW8_TCell* pTCs;
939 sal_uInt8 nOverrideSpacing[MAX_COL + 1];
940 short nOverrideValues[MAX_COL + 1][4];
941 WW8_SHD* pSHDs;
942 sal_uInt32* pNewSHDs;
943 WW8_BRC aDefBrcs[6];
945 bool bExist[MAX_COL]; // does this cell exist ?
946 sal_uInt8 nTransCell[MAX_COL + 2]; // translation WW-Index -> SW-Index
948 sal_uInt8 transCell(sal_uInt8 nWwCol) const
950 return nWwCol < SAL_N_ELEMENTS(nTransCell) ? nTransCell[nWwCol] : 0xFF;
953 WW8TabBandDesc();
954 WW8TabBandDesc(WW8TabBandDesc& rBand); // deep copy
955 ~WW8TabBandDesc();
956 static void setcelldefaults(WW8_TCell *pCells, short nCells);
957 void ReadDef(bool bVer67, const sal_uInt8* pS);
958 void ProcessDirection(const sal_uInt8* pParams);
959 void ProcessSprmTSetBRC(bool bVer67, const sal_uInt8* pParamsTSetBRC);
960 void ProcessSprmTTableBorders(bool bVer67, const sal_uInt8* pParams);
961 void ProcessSprmTDxaCol(const sal_uInt8* pParamsTDxaCol);
962 void ProcessSprmTDelete(const sal_uInt8* pParamsTDelete);
963 void ProcessSprmTInsert(const sal_uInt8* pParamsTInsert);
964 void ProcessSpacing(const sal_uInt8* pParamsTInsert);
965 void ProcessSpecificSpacing(const sal_uInt8* pParamsTInsert);
966 void ReadShd(const sal_uInt8* pS );
967 void ReadNewShd(const sal_uInt8* pS, bool bVer67);
969 enum wwDIR {wwTOP = 0, wwLEFT = 1, wwBOTTOM = 2, wwRIGHT = 3};
972 //-----------------------------------------
973 // Storage-Reader
974 //-----------------------------------------
975 typedef std::vector<WW8_CP> cp_vector;
977 class SwWW8ImplReader
979 private:
980 SwDocShell *mpDocShell; // The Real DocShell
982 friend class WW8RStyle;
983 friend class WW8TabDesc;
984 friend class WW8ReaderSave;
985 friend struct WW8FlyPara;
986 friend struct WW8SwFlyPara;
987 friend class WW8FlySet;
988 friend class SwMSDffManager;
989 friend class SwWW8FltControlStack;
990 friend class WW8FormulaControl;
991 friend class wwSectionManager;
993 private:
995 SvStorage* pStg; // Input-Storage
996 SvStream* pStrm; // Input-(Storage)Stream
997 SvStream* pTableStream; // Input-(Storage)Stream
998 SvStream* pDataStream; // Input-(Storage)Stream
1000 // allgemeines
1001 SwDoc& rDoc;
1002 SwPaM* pPaM;
1004 SwWW8FltControlStack* pCtrlStck; // Stack fuer die Attribute
1007 This stack is for redlines, because their sequence of discovery can
1008 be out of order of their order of insertion into the document.
1010 sw::util::RedlineStack *mpRedlineStack;
1013 This stack is for fields that get referneced later, e.g. BookMarks and TOX.
1014 They get inserted at the end of the document, it is the same stack for
1015 headers/footers/main text/textboxes/tables etc...
1017 SwFltEndStack *pReffedStck;
1020 This stack is for fields whose true conversion cannot be determined until
1021 the end of the document, it is the same stack for headers/footers/main
1022 text/textboxes/tables etc... They are things that reference other things
1023 e.g. NoteRef and Ref, they are processed after pReffedStck
1025 SwWW8FltRefStack *pReffingStck;
1028 For graphics anchors. Determines the graphics whose anchors are in the
1029 current paragraph, and works around the difficulty in inserting a graphic
1030 anchored to character before a character to be anchored to has been
1031 inserted. Is emptied at the end of each paragraph.
1033 SwWW8FltAnchorStack* pAnchorStck;
1036 A stack of fields identifiers to keep track of any open fields that need
1037 to be closed. Generally word fields are inserted as writer fields as soon
1038 as they are encountered, and so their end point is normally unimportant.
1039 But hyperlink fields need to be applied as attributes to text and it is
1040 far easier and safer to set the end point of an attribute when we
1041 encounter the end marker of the field instead of caculating in advance
1042 where the end point will fall, to do so fully correctly duplicates the
1043 main logic of the filter itself.
1045 std::deque<WW8FieldEntry> maFieldStack;
1046 typedef std::deque<WW8FieldEntry>::const_iterator mycFieldIter;
1049 A stack of open footnotes. Should only be one in it at any time.
1051 std::deque<FtnDescriptor> maFtnStack;
1054 A queue of the ms sections in the document
1056 wwSectionManager maSectionManager;
1059 A vector of surplus-to-requirements paragraph in the final document,
1060 that exist because of quirks of the SwDoc document model and/or API,
1061 which need to be removed.
1063 wwExtraneousParas m_aExtraneousParas;
1066 A map of of tables to their follow nodes for use in inserting tables into
1067 already existing document, i.e. insert file
1069 sw::util::InsertedTablesManager maInsertedTables;
1072 Creates unique names to give to (file link) sections (WW1/WW2/...)
1074 wwSectionNamer maSectionNameGenerator;
1077 Knows how to split a series of bytes into sprms and their arguments
1079 wwSprmParser *mpSprmParser;
1082 Creates unique names to give to graphics
1084 wwFrameNamer maGrfNameGenerator;
1087 Knows which writer style a given word style should be imported as.
1089 sw::util::ParaStyleMapper maParaStyleMapper;
1090 sw::util::CharStyleMapper maCharStyleMapper;
1093 Stack of textencoding being used as we progress through the document text
1095 std::stack<rtl_TextEncoding> maFontSrcCharSets;
1096 std::stack<rtl_TextEncoding> maFontSrcCJKCharSets;
1099 Winword numbering gets imported as SwNumRules, there is a problem that
1100 winword can have multiple outline numberings, only one gets chosen as
1101 the writer outline numbering rule. The one that gets chosen is set here
1102 as mpChosenOutlineNumRule
1104 SwNumRule *mpChosenOutlineNumRule;
1106 SwMSConvertControls *pFormImpl; // Control-Implementierung
1108 SwFlyFrmFmt* pFlyFmtOfJustInsertedGraphic;
1109 SwFrmFmt* pFmtOfJustInsertedApo;
1110 SwPaM* pPreviousNumPaM;
1111 const SwNumRule* pPrevNumRule;
1113 //Keep track of APO environments
1114 std::deque<bool> maApos;
1115 typedef std::deque<bool>::const_iterator mycApoIter;
1117 Keep track of generated Ruby character formats we we can minimize the
1118 number of character formats created
1120 std::vector<const SwCharFmt*> aRubyCharFmts;
1122 WW8PostProcessAttrsInfo * mpPostProcessAttrsInfo;
1124 WW8Fib* pWwFib;
1125 WW8Fonts* pFonts;
1126 WW8Dop* pWDop;
1127 WW8ListManager* pLstManager;
1128 WW8ScannerBase* pSBase;
1129 WW8PLCFMan* pPlcxMan;
1130 std::map<short, String> aLinkStringMap;
1132 std::set<const SwNode*> maTxtNodesHavingFirstLineOfstSet; // #i103711#
1133 std::set<const SwNode*> maTxtNodesHavingLeftIndentSet; // #i105414#
1135 WW8RStyle* pStyles; // Pointer auf die Style-Einleseklasse
1136 SwFmt* pAktColl; // gerade zu erzeugende Collection
1137 // ( ist ausserhalb einer Style-Def immer 0 )
1138 SfxItemSet* pAktItemSet;// gerade einzulesende Zeichenattribute
1139 // (ausserhalb des WW8ListManager Ctor's immer 0)
1140 std::vector<SwWW8StyInf> vColl;
1141 const SwTxtFmtColl* pDfltTxtFmtColl; // Default
1142 SwFmt* pStandardFmtColl;// "Standard"
1144 WW8PLCF_HdFt* pHdFt; // Pointer auf Header / Footer - Scannerklasse
1146 WW8FlyPara* pWFlyPara; // WW-Parameter
1147 WW8SwFlyPara* pSFlyPara; // daraus erzeugte Sw-Parameter
1149 WW8TabDesc* pTableDesc; // Beschreibung der Tabelleneigenschaften
1150 //Keep track of tables within tables
1151 std::stack<WW8TabDesc*> maTableStack;
1153 ANLDRuleMap maANLDRules;
1154 WW8_OLST* pNumOlst; // Gliederung im Text
1156 SwNode* pNode_FLY_AT_PARA; // set: WW8SwFlyPara() read: CreateSwTable()
1158 SdrModel* pDrawModel;
1159 SdrPage* pDrawPg;
1160 EditEngine* mpDrawEditEngine;
1161 wwZOrderer *pWWZOrder;
1163 SwFieldType* pNumFldType; // fuer Nummernkreis
1165 SwMSDffManager* pMSDffManager;
1167 std::vector<String>* mpAtnNames;
1168 boost::shared_ptr< std::map<sal_uInt32, int> > mpAtnIndexes;
1169 boost::shared_ptr<WW8PLCFspecial> mpAtnStarts;
1170 boost::shared_ptr<WW8PLCFspecial> mpAtnEnds;
1172 sw::util::AuthorInfos m_aAuthorInfos;
1173 String sBaseURL;
1175 // Ini-Flags:
1176 sal_uLong nIniFlags; // Flags aus der writer.ini
1177 sal_uLong nIniFlags1; // dito ( zusaetzliche Flags )
1178 sal_uLong nFieldFlags; // dito fuer Feldern
1179 sal_uLong nFieldTagAlways[3]; // dito fuers Taggen von Feldern
1180 sal_uLong nFieldTagBad[3]; // dito fuers Taggen von nicht importierbaren F.
1181 bool m_bRegardHindiDigits; // import digits in CTL scripts as Hindi numbers
1183 WW8_CP nDrawCpO; // Anfang der Txbx-SubDocs
1185 sal_uLong nPicLocFc; // Picture Location in File (FC)
1186 sal_uLong nObjLocFc; // Object Location in File (FC)
1188 sal_Int32 nIniFlyDx; // X-Verschiebung von Flys
1189 sal_Int32 nIniFlyDy; // Y-Verschiebung von Flys
1191 rtl_TextEncoding eTextCharSet; // Default charset for Text
1192 rtl_TextEncoding eStructCharSet; // rtl_TextEncoding for structures
1193 rtl_TextEncoding eHardCharSet; // Hard rtl_TextEncoding-Attribute
1194 sal_uInt16 nProgress; // %-Angabe fuer Progressbar
1195 sal_uInt16 nAktColl; // gemaess WW-Zaehlung
1196 sal_uInt16 nFldNum; // laufende Nummer dafuer
1197 sal_uInt16 nLFOPosition;
1199 short nCharFmt; // gemaess WW-Zaehlung, <0 fuer keine
1201 short nDrawXOfs, nDrawYOfs;
1202 short nDrawXOfs2, nDrawYOfs2;
1204 sal_Unicode cSymbol; // aktuell einzulesendes Symbolzeichen
1207 sal_uInt8 nWantedVersion; // urspruenglich vom Writer
1208 // angeforderte WW-Doc-Version
1211 sal_uInt8 nSwNumLevel; // LevelNummer fuer Outline / Nummerierung
1212 sal_uInt8 nWwNumType; // Gliederung / Nummerg / Aufzaehlg
1213 sal_uInt8 nListLevel;
1215 sal_uInt8 nPgChpDelim; // ChapterDelim from PageNum
1216 sal_uInt8 nPgChpLevel; // ChapterLevel of Heading from PageNum
1218 bool mbNewDoc; // Neues Dokument ?
1219 bool bReadNoTbl; // Keine Tabellen
1220 bool bPgSecBreak; // Page- oder Sectionbreak ist noch einzufuegen
1221 bool bSpec; // Special-Char im Text folgt
1222 bool bObj; // Obj im Text
1223 bool bTxbxFlySection; // FlyFrame, der als Ersatz fuer Winword Textbox eingefuegt wurde
1224 bool bHasBorder; // fuer Buendelung der Border
1225 bool bSymbol; // z.B. Symbol statt Times
1226 bool bIgnoreText; // z.B. fuer FieldVanish
1227 int nInTable; // wird gerade eine Tabelle eingelesen
1228 bool bWasTabRowEnd; // Tabelle : Row End Mark
1229 bool bWasTabCellEnd; // table: Cell End Mark
1231 bool bShdTxtCol; // Textfarbe indirekt gesetzt ( Hintergrund sw )
1232 bool bCharShdTxtCol; // Textfarbe indirekt gesetzt ( Zeichenhintergrund sw )
1233 bool bAnl; // Nummerierung in Bearbeitung
1234 // Anl heisst Autonumber level
1236 bool bHdFtFtnEdn; // Spezialtext: Kopf- Fuss- usw.
1237 bool bFtnEdn; // Fussnote oder Endnote
1238 bool bIsHeader; // Text aus Header wird gelesen ( Zeilenhoehe )
1239 bool bIsFooter; // Text aus Footer wird gelesen ( Zeilenhoehe )
1241 bool bIsUnicode; // aktuelles Text-Stueck ist als 2-Bytiger-Unicode kodiert
1242 // bitte NICHT als Bitfeld kodieren!
1244 bool bCpxStyle; // Style im Complex Part
1245 bool bStyNormal; // Style mit Id 0 wird gelesen
1246 bool bWWBugNormal; // WW-Version nit Bug Dya in Style Normal
1247 bool bNoAttrImport; // Attribute ignorieren zum Ignorieren v. Styles
1248 bool bInHyperlink; // Sonderfall zum einlesen eines 0x01
1249 // siehe: SwWW8ImplReader::Read_F_Hyperlink()
1250 bool bWasParaEnd;
1252 // praktische Hilfsvariablen:
1253 bool bVer67; // ( (6 == nVersion) || (7 == nVersion) );
1254 bool bVer6; // (6 == nVersion);
1255 bool bVer7; // (7 == nVersion);
1256 bool bVer8; // (8 == nVersion);
1258 bool bEmbeddObj; // EmbeddField gelesen
1260 bool bAktAND_fNumberAcross; // current active Annotated List Deskriptor - ROW flag
1262 bool bNoLnNumYet; // no Line Numbering has been activated yet (we import
1263 // the very 1st Line Numbering and ignore the rest)
1265 bool bFirstPara; // first paragraph?
1266 bool bFirstParaOfPage;//cs2c--xushanchuan add for bug11210
1267 bool bParaAutoBefore;
1268 bool bParaAutoAfter;
1270 bool bDropCap;
1271 sal_Int32 nDropCap;
1273 int nIdctHint;
1274 bool bBidi;
1275 bool bReadTable;
1276 boost::shared_ptr<SwPaM> mpTableEndPaM;
1278 cp_vector maEndParaPos;
1279 WW8_CP maCurrAttrCP;
1280 bool mbOnLoadingMain:1;
1281 //---------------------------------------------
1283 const SprmReadInfo& GetSprmReadInfo(sal_uInt16 nId) const;
1285 bool StyleExists(unsigned int nColl) const { return (nColl < vColl.size()); }
1286 SwWW8StyInf *GetStyle(sal_uInt16 nColl) const;
1287 void AppendTxtNode(SwPosition& rPos);
1289 void Read_HdFt(int nSect, const SwPageDesc *pPrev,
1290 const wwSection &rSection);
1291 void Read_HdFtText(long nStartCp, long nLen, SwFrmFmt* pHdFtFmt);
1292 void Read_HdFtTextAsHackedFrame(long nStart, long nLen,
1293 SwFrmFmt &rHdFtFmt, sal_uInt16 nPageWidth);
1295 bool isValid_HdFt_CP(WW8_CP nHeaderCP) const;
1297 bool HasOwnHeaderFooter(sal_uInt8 nWhichItems, sal_uInt8 grpfIhdt, int nSect);
1299 void HandleLineNumbering(const wwSection &rSection);
1301 void CopyPageDescHdFt( const SwPageDesc* pOrgPageDesc,
1302 SwPageDesc* pNewPageDesc, sal_uInt8 nCode );
1304 void DeleteStk(SwFltControlStack* prStck);
1305 void DeleteCtrlStk() { DeleteStk( pCtrlStck ); pCtrlStck = 0; }
1306 void DeleteRefStks()
1308 DeleteStk( pReffedStck );
1309 pReffedStck = 0;
1310 DeleteStk( pReffingStck );
1311 pReffingStck = 0;
1313 void DeleteAnchorStk() { DeleteStk( pAnchorStck ); pAnchorStck = 0; }
1314 void emulateMSWordAddTextToParagraph(const OUString& rAddString);
1315 void simpleAddTextToParagraph(const String& rAddString);
1316 bool HandlePageBreakChar();
1317 bool ReadChar(long nPosCp, long nCpOfs);
1318 bool ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs);
1319 bool ReadChars(WW8_CP& rPos, WW8_CP nNextAttr, long nTextEnd, long nCpOfs);
1320 bool LangUsesHindiNumbers(sal_uInt16 nLang);
1321 sal_Unicode TranslateToHindiNumbers(sal_Unicode);
1323 void SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection);
1325 void ProcessAktCollChange(WW8PLCFManResult& rRes, bool* pStartAttr,
1326 bool bCallProcessSpecial);
1327 long ReadTextAttr(WW8_CP& rTxtPos, bool& rbStartLine);
1328 void ReadAttrs(WW8_CP& rNext, WW8_CP& rTxtPos, bool& rbStartLine);
1329 void CloseAttrEnds();
1330 bool ReadText(long nStartCp, long nTextLen, ManTypes nType);
1332 void ReadRevMarkAuthorStrTabl( SvStream& rStrm, sal_Int32 nTblPos,
1333 sal_Int32 nTblSiz, SwDoc& rDoc );
1335 void Read_HdFtFtnText( const SwNodeIndex* pSttIdx, long nStartCp,
1336 long nLen, ManTypes nType );
1338 void ImportTox( int nFldId, String aStr );
1340 void EndSprm( sal_uInt16 nId );
1341 // #i103711#
1342 // #i105414#
1343 void NewAttr( const SfxPoolItem& rAttr,
1344 const bool bFirstLineOfStSet = false,
1345 const bool bLeftIndentSet = false );
1347 bool GetFontParams(sal_uInt16, FontFamily&, String&, FontPitch&,
1348 rtl_TextEncoding&);
1349 bool SetNewFontAttr(sal_uInt16 nFCode, bool bSetEnums, sal_uInt16 nWhich);
1350 void ResetCharSetVars();
1351 void ResetCJKCharSetVars();
1353 const SfxPoolItem* GetFmtAttr( sal_uInt16 nWhich );
1354 bool JoinNode(SwPaM &rPam, bool bStealAttr = false);
1356 bool IsBorder(const WW8_BRC* pbrc, bool bChkBtwn = false) const;
1358 //Set closest writer border equivalent into rBox from pbrc, optionally
1359 //recording true winword dimensions in pSizeArray. nSetBorders to mark a
1360 //border which has been previously set to a value and for which becoming
1361 //empty is valid. Set bCheBtwn to work with paragraphs that have a special
1362 //between paragraphs border
1364 // Note #i20672# we can't properly support between lines so best to ignore
1365 // them for now
1366 bool SetBorder(SvxBoxItem& rBox, const WW8_BRC* pbrc, short *pSizeArray=0,
1367 sal_uInt8 nSetBorders=0xFF) const;
1368 void GetBorderDistance(const WW8_BRC* pbrc, Rectangle& rInnerDist) const;
1369 sal_uInt16 GetParagraphAutoSpace(bool fDontUseHTMLAutoSpacing);
1370 bool SetShadow(SvxShadowItem& rShadow, const short *pSizeArray,
1371 const WW8_BRC *pbrc) const;
1372 //returns true is a shadow was set
1373 bool SetFlyBordersShadow(SfxItemSet& rFlySet, const WW8_BRC *pbrc,
1374 short *SizeArray=0) const;
1375 void SetPageBorder(SwFrmFmt &rFmt, const wwSection &rSection) const;
1377 sal_Int32 MatchSdrBoxIntoFlyBoxItem( const Color& rLineColor,
1378 MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType, sal_Int32 &rLineWidth,
1379 SvxBoxItem& rBox );
1380 void MatchSdrItemsIntoFlySet( SdrObject* pSdrObj, SfxItemSet &aFlySet,
1381 MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType, Rectangle &rInnerDist );
1382 void AdjustLRWrapForWordMargins(const SvxMSDffImportRec &rRecord,
1383 SvxLRSpaceItem &rLR);
1384 void AdjustULWrapForWordMargins(const SvxMSDffImportRec &rRecord,
1385 SvxULSpaceItem &rUL);
1386 void MapWrapIntoFlyFmt(SvxMSDffImportRec* pRecord, SwFrmFmt* pFlyFmt);
1388 void SetAttributesAtGrfNode(SvxMSDffImportRec const* pRecord,
1389 SwFrmFmt *pFlyFmt, WW8_FSPA *pF);
1391 bool IsDropCap();
1392 bool IsListOrDropcap() { return (!pAktItemSet || bDropCap); };
1394 WW8FlyPara *ConstructApo(const ApoTestResults &rApo,
1395 const WW8_TablePos *pTabPos);
1396 bool StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
1397 void StopApo();
1398 bool TestSameApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
1399 ApoTestResults TestApo(int nCellLevel, bool bTableRowEnd,
1400 const WW8_TablePos *pTabPos);
1402 void EndSpecial();
1403 bool ProcessSpecial(bool &rbReSync, WW8_CP nStartCp);
1404 sal_uInt16 TabRowSprm(int nLevel) const;
1406 bool ReadGrafFile(String& rFileName, Graphic*& rpGraphic,
1407 const WW8_PIC& rPic, SvStream* pSt, sal_uLong nFilePos, bool* pDelIt);
1409 void ReplaceObj(const SdrObject &rReplaceTextObj,
1410 SdrObject &rSubObj);
1412 SwFlyFrmFmt* MakeGrafNotInCntnt(const WW8PicDesc& rPD,
1413 const Graphic* pGraph, const String& rFileName,
1414 const SfxItemSet& rGrfSet);
1416 SwFrmFmt* MakeGrafInCntnt(const WW8_PIC& rPic, const WW8PicDesc& rPD,
1417 const Graphic* pGraph, const String& rFileName,
1418 const SfxItemSet& rGrfSet);
1420 SwFrmFmt *AddAutoAnchor(SwFrmFmt *pFmt);
1421 SwFrmFmt* ImportGraf1(WW8_PIC& rPic, SvStream* pSt, sal_uLong nFilePos);
1422 SwFrmFmt* ImportGraf(SdrTextObj* pTextObj = 0, SwFrmFmt* pFlyFmt = 0);
1424 SdrObject* ImportOleBase( Graphic& rGraph, const Graphic* pGrf=0,
1425 const SfxItemSet* pFlySet=0, const Rectangle& aVisArea = Rectangle() );
1427 SwFrmFmt* ImportOle( const Graphic* = 0, const SfxItemSet* pFlySet = 0,
1428 const SfxItemSet* pGrfSet = 0, const Rectangle& aVisArea = Rectangle() );
1429 SwFlyFrmFmt* InsertOle(SdrOle2Obj &rObject, const SfxItemSet &rFlySet,
1430 const SfxItemSet &rGrfSet);
1432 bool ImportFormulaControl(WW8FormulaControl &rBox,WW8_CP nStart,
1433 SwWw8ControlType nWhich);
1435 void ImportDop();
1437 //This converts MS Asian Typography information into OOo's
1438 void ImportDopTypography(const WW8DopTypography &rTypo);
1440 sal_uLong LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss);
1441 sal_uLong SetSubStreams(SvStorageStreamRef &rTableStream, SvStorageStreamRef &rDataStream);
1442 sal_uLong CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos);
1444 void ReadDocVars();
1446 bool StartTable(WW8_CP nStartCp);
1447 bool InEqualApo(int nLvl) const;
1448 bool InLocalApo() const { return InEqualApo(nInTable); }
1449 bool InEqualOrHigherApo(int nLvl) const;
1450 bool InAnyApo() const { return InEqualOrHigherApo(1); }
1451 void TabCellEnd();
1452 void StopTable();
1453 short GetTableLeft();
1454 bool IsInvalidOrToBeMergedTabCell() const;
1456 // Nummerierungen / Aufzaehlungen ( Autonumbered List Data Descriptor )
1457 // Liste: ANLD ( Autonumbered List Data Descriptor )
1458 // eine Ebene: ANLV ( Autonumber Level Descriptor )
1460 // Chg7-8:
1461 // Listen sind in WW8 eigene Strukturen, die ueber folgende drei Tabellen
1462 // verwaltet werden: rglst, hpllfo und hsttbListNames
1463 // die Strukturen hierfuer sind: LSTF, LVLF, LFO LFOLVL
1465 void SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, const sal_uInt8* pTxt,
1466 bool bOutline);
1467 void SetAnld(SwNumRule* pNumR, WW8_ANLD* pAD, sal_uInt8 nSwLevel, bool bOutLine);
1468 void SetNumOlst( SwNumRule* pNumR, WW8_OLST* pO, sal_uInt8 nSwLevel );
1469 SwNumRule* GetStyRule();
1471 void StartAnl(const sal_uInt8* pSprm13);
1472 void NextAnlLine(const sal_uInt8* pSprm13);
1473 void StopAllAnl(bool bGoBack = true);
1474 void StopAnlToRestart(sal_uInt8 nType, bool bGoBack = true);
1476 // GrafikLayer
1478 bool ReadGrafStart(void* pData, short nDataSiz, WW8_DPHEAD* pHd,
1479 const WW8_DO* pDo, SfxAllItemSet &rSet);
1480 SdrObject *ReadLine(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1481 SfxAllItemSet &rSet);
1482 SdrObject *ReadRect(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1483 SfxAllItemSet &rSet);
1484 SdrObject *ReadElipse(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1485 SfxAllItemSet &rSet);
1486 SdrObject *ReadArc(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1487 SfxAllItemSet &rSet);
1488 SdrObject *ReadPolyLine(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1489 SfxAllItemSet &rSet);
1490 ESelection GetESelection( long nCpStart, long nCpEnd );
1491 void InsertTxbxStyAttrs( SfxItemSet& rS, sal_uInt16 nColl );
1492 void InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp, ManTypes eType, bool bONLYnPicLocFc=false);
1494 bool GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, sal_uInt16 nTxBxS,
1495 sal_uInt16 nSequence);
1496 bool GetRangeAsDrawingString(String& rString, long StartCp, long nEndCp, ManTypes eType);
1497 OutlinerParaObject* ImportAsOutliner(String &rString, WW8_CP nStartCp, WW8_CP nEndCp, ManTypes eType);
1498 SwFrmFmt* InsertTxbxText(SdrTextObj* pTextObj, Size* pObjSiz,
1499 sal_uInt16 nTxBxS, sal_uInt16 nSequence, long nPosCp, SwFrmFmt* pFlyFmt,
1500 bool bMakeSdrGrafObj, bool& rbEraseTextObj,
1501 bool* pbTestTxbxContainsText = 0, long* pnStartCp = 0,
1502 long* pnEndCp = 0, bool* pbContainsGraphics = 0,
1503 SvxMSDffImportRec* pRecord = 0);
1504 bool TxbxChainContainsRealText( sal_uInt16 nTxBxS,
1505 long& rStartCp,
1506 long& rEndCp );
1507 SdrObject *ReadTxtBox(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1508 SfxAllItemSet &rSet);
1509 SdrObject *ReadCaptionBox(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1510 SfxAllItemSet &rSet);
1511 SdrObject *ReadGroup(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1512 SfxAllItemSet &rSet);
1513 SdrObject *ReadGrafPrimitive(short& rLeft, const WW8_DO* pDo,
1514 SfxAllItemSet &rSet);
1515 void ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp );
1516 SdrObject* CreateContactObject(SwFrmFmt* pFlyFmt);
1517 RndStdIds ProcessEscherAlign(SvxMSDffImportRec* pRecord, WW8_FSPA *pFSPA,
1518 SfxItemSet &rFlySet, bool bOrgObjectWasReplace);
1519 bool MiserableRTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth,
1520 sal_Int16 eHoriOri, sal_Int16 eHoriRel);
1521 SwFrmFmt* Read_GrafLayer( long nGrafAnchorCp );
1522 SwFlyFrmFmt* ImportReplaceableDrawables( SdrObject* &rpObject,
1523 SdrObject* &rpOurNewObject, SvxMSDffImportRec* pRecord, WW8_FSPA *pF,
1524 SfxItemSet &rFlySet );
1525 SwFlyFrmFmt *ConvertDrawTextToFly( SdrObject* &rpObject,
1526 SdrObject* &rpOurNewObject, SvxMSDffImportRec* pRecord,
1527 RndStdIds eAnchor, WW8_FSPA *pF, SfxItemSet &rFlySet );
1528 SwFrmFmt* MungeTextIntoDrawBox(SdrObject* pTrueObject,
1529 SvxMSDffImportRec *pRecord, long nGrafAnchorCp, SwFrmFmt *pRetFrmFmt);
1531 void GrafikCtor();
1532 void GrafikDtor();
1534 // anderes
1535 String GetFieldResult( WW8FieldDesc* pF );
1536 void MakeTagString( String& rStr, const String& rOrg );
1537 void UpdateFields();
1538 void ConvertFFileName( String& rName, const String& rRaw );
1539 long Read_F_Tag( WW8FieldDesc* pF );
1540 void InsertTagField( const sal_uInt16 nId, const String& rTagText );
1541 long ImportExtSprm(WW8PLCFManResult* pRes);
1542 void EndExtSprm(sal_uInt16 nSprmId);
1543 void ReadDocInfo();
1545 // Ver8-Listen
1547 void RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO, sal_uInt8 nActLevel,
1548 bool bSetAttr = true);
1549 void RegisterNumFmtOnStyle(sal_uInt16 nStyle);
1550 void SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO,
1551 sal_uInt8 nActLevel);
1552 void RegisterNumFmt(sal_uInt16 nActLFO, sal_uInt8 nActLevel);
1554 // spaeter zu ersetzen durch Aufruf in entsprechend erweiterten SvxMSDffManager
1556 const String* GetAnnotationAuthor(sal_uInt16 nIdx);
1557 int GetAnnotationIndex(sal_uInt32 nTag);
1558 WW8_CP GetAnnotationStart(int nIndex);
1559 WW8_CP GetAnnotationEnd(int nIndex);
1561 // Schnittstellen fuer die Toggle-Attribute
1562 void SetToggleAttr(sal_uInt8 nAttrId, bool bOn);
1563 void SetToggleBiDiAttr(sal_uInt8 nAttrId, bool bOn);
1564 void _ChkToggleAttr( sal_uInt16 nOldStyle81Mask, sal_uInt16 nNewStyle81Mask );
1566 void ChkToggleAttr( sal_uInt16 nOldStyle81Mask, sal_uInt16 nNewStyle81Mask )
1568 if( nOldStyle81Mask != nNewStyle81Mask &&
1569 pCtrlStck->GetToggleAttrFlags() )
1570 _ChkToggleAttr( nOldStyle81Mask, nNewStyle81Mask );
1573 void _ChkToggleBiDiAttr( sal_uInt16 nOldStyle81Mask, sal_uInt16 nNewStyle81Mask );
1575 void ChkToggleBiDiAttr( sal_uInt16 nOldStyle81Mask, sal_uInt16 nNewStyle81Mask )
1577 if( nOldStyle81Mask != nNewStyle81Mask &&
1578 pCtrlStck->GetToggleBiDiAttrFlags() )
1579 _ChkToggleBiDiAttr( nOldStyle81Mask, nNewStyle81Mask );
1582 void PopTableDesc();
1583 void MoveInsideFly(const SwFrmFmt *pFlyFmt);
1584 SwTwips MoveOutsideFly(SwFrmFmt *pFlyFmt, const SwPosition &rPos,
1585 bool bTableJoin = true);
1587 void SetOutLineStyles();
1589 bool SetSpacing(SwPaM &rMyPam, int nSpace, bool bIsUpper);
1590 bool SetUpperSpacing(SwPaM &pMyPam, int nSpace);
1591 bool SetLowerSpacing(SwPaM &rMyPam, int nSpace);
1593 bool IsInlineEscherHack() const
1594 {return !maFieldStack.empty() ? maFieldStack.back().mnFieldId == 95 : false; };
1596 void StoreMacroCmds();
1598 // #i84783#
1599 // determine object attribute "Layout in Table Cell"
1600 bool IsObjectLayoutInTableCell( const sal_uInt32 nLayoutInTableCell ) const;
1601 bool ReadGlobalTemplateSettings( const OUString& sCreatedFrom, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xPrjNameMap );
1602 //No copying
1603 SwWW8ImplReader(const SwWW8ImplReader &);
1604 SwWW8ImplReader& operator=(const SwWW8ImplReader&);
1605 public: // eigentlich private, geht aber leider nur public
1606 sal_uInt16 GetToggleAttrFlags() const;
1607 sal_uInt16 GetToggleBiDiAttrFlags() const;
1608 void SetToggleAttrFlags(sal_uInt16 nFlags);
1609 void SetToggleBiDiAttrFlags(sal_uInt16 nFlags);
1610 WW8_CP GetCurrAttrCP() const {return maCurrAttrCP;}
1611 bool IsParaEndInCPs(sal_Int32 , sal_Int32,bool bSdOD=true) const;
1612 //Clear the para end position recorded in reader intermittently for the least impact on loading performance
1613 void ClearParaEndPosition();
1615 long Read_Ftn(WW8PLCFManResult* pRes);
1616 sal_uInt16 End_Ftn();
1617 long Read_Field(WW8PLCFManResult* pRes);
1618 sal_uInt16 End_Field();
1619 long Read_Book(WW8PLCFManResult*);
1620 long Read_And(WW8PLCFManResult* pRes);
1622 // Attribute
1624 void Read_Special(sal_uInt16, const sal_uInt8*, short nLen);
1625 void Read_Obj(sal_uInt16, const sal_uInt8*, short nLen);
1626 void Read_PicLoc(sal_uInt16, const sal_uInt8* pData, short nLen );
1627 void Read_BoldUsw(sal_uInt16 nId, const sal_uInt8*, short nLen);
1628 void Read_Bidi(sal_uInt16 nId, const sal_uInt8*, short nLen);
1629 void Read_BoldBiDiUsw(sal_uInt16 nId, const sal_uInt8*, short nLen);
1630 void Read_SubSuper( sal_uInt16, const sal_uInt8*, short nLen );
1631 bool ConvertSubToGraphicPlacement();
1632 SwFrmFmt *ContainsSingleInlineGraphic(const SwPaM &rRegion);
1633 void Read_SubSuperProp( sal_uInt16, const sal_uInt8*, short nLen );
1634 void Read_Underline( sal_uInt16, const sal_uInt8*, short nLen );
1635 void Read_TxtColor( sal_uInt16, const sal_uInt8*, short nLen );
1636 void openFont(sal_uInt16 nFCode, sal_uInt16 nId);
1637 void closeFont(sal_uInt16 nId);
1638 void Read_FontCode( sal_uInt16, const sal_uInt8*, short nLen );
1639 void Read_FontSize( sal_uInt16, const sal_uInt8*, short nLen );
1640 void Read_CharSet(sal_uInt16 , const sal_uInt8* pData, short nLen);
1641 void Read_Language( sal_uInt16, const sal_uInt8*, short nLen );
1642 void Read_CColl( sal_uInt16, const sal_uInt8*, short nLen );
1643 void Read_Kern( sal_uInt16, const sal_uInt8* pData, short nLen );
1644 void Read_FontKern( sal_uInt16, const sal_uInt8* pData, short nLen );
1645 void Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short nLen );
1646 void Read_ScaleWidth( sal_uInt16, const sal_uInt8* pData, short nLen );
1647 void Read_Relief( sal_uInt16, const sal_uInt8* pData, short nLen);
1648 void Read_TxtAnim( sal_uInt16, const sal_uInt8* pData, short nLen);
1650 void Read_NoLineNumb( sal_uInt16 nId, const sal_uInt8* pData, short nLen );
1652 void Read_LR( sal_uInt16 nId, const sal_uInt8*, short nLen );
1653 void Read_UL( sal_uInt16 nId, const sal_uInt8*, short nLen );
1654 void Read_ParaAutoBefore(sal_uInt16 , const sal_uInt8 *pData, short nLen);
1655 void Read_ParaAutoAfter(sal_uInt16 , const sal_uInt8 *pData, short nLen);
1656 void Read_ParaContextualSpacing( sal_uInt16 nId, const sal_uInt8* pData, short nLen );
1657 void Read_LineSpace( sal_uInt16, const sal_uInt8*, short nLen );
1658 void Read_Justify(sal_uInt16, const sal_uInt8*, short nLen);
1659 void Read_IdctHint(sal_uInt16, const sal_uInt8*, short nLen);
1660 bool IsRightToLeft();
1661 void Read_RTLJustify(sal_uInt16, const sal_uInt8*, short nLen);
1662 void Read_Hyphenation( sal_uInt16, const sal_uInt8* pData, short nLen );
1663 void Read_WidowControl( sal_uInt16, const sal_uInt8* pData, short nLen );
1664 void Read_AlignFont( sal_uInt16, const sal_uInt8* pData, short nLen );
1665 void Read_UsePgsuSettings( sal_uInt16, const sal_uInt8* pData, short nLen );
1666 void Read_KeepLines( sal_uInt16, const sal_uInt8* pData, short nLen );
1667 void Read_KeepParas( sal_uInt16, const sal_uInt8* pData, short nLen );
1668 void Read_BreakBefore( sal_uInt16, const sal_uInt8* pData, short nLen );
1669 void Read_Apo(sal_uInt16 nId, const sal_uInt8* pData, short nLen);
1670 void Read_ApoPPC(sal_uInt16, const sal_uInt8* pData, short);
1672 void Read_BoolItem( sal_uInt16 nId, const sal_uInt8*, short nLen );
1674 void Read_Border( sal_uInt16 nId, const sal_uInt8* pData, short nLen );
1675 void Read_Tab( sal_uInt16 nId, const sal_uInt8* pData, short nLen );
1676 void Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen);
1677 void Read_FldVanish( sal_uInt16 nId, const sal_uInt8* pData, short nLen );
1679 // Revision Marks ( == Redlining )
1681 // insert or delete content (change char attributes resp.)
1682 void Read_CRevisionMark(RedlineType_t eType, const sal_uInt8* pData, short nLen);
1683 // insert new content
1684 void Read_CFRMark(sal_uInt16 , const sal_uInt8* pData, short nLen);
1685 // delete old content
1686 void Read_CFRMarkDel(sal_uInt16 , const sal_uInt8* pData, short nLen);
1687 // change properties of content (e.g. char formating)
1688 void Read_CPropRMark(sal_uInt16 , const sal_uInt8* pData, short nLen); // complex!
1691 void Read_TabRowEnd( sal_uInt16, const sal_uInt8* pData, short nLen );
1692 void Read_TabCellEnd( sal_uInt16, const sal_uInt8* pData, short nLen );
1693 bool ParseTabPos(WW8_TablePos *aTabPos, WW8PLCFx_Cp_FKP* pPap);
1694 void Read_Shade( sal_uInt16, const sal_uInt8* pData, short nLen );
1695 void Read_ANLevelNo( sal_uInt16, const sal_uInt8* pData, short nLen );
1696 void Read_ANLevelDesc( sal_uInt16, const sal_uInt8* pData, short nLen );
1698 // Gliederungsebene Ver8
1699 void Read_POutLvl(sal_uInt16, const sal_uInt8* pData, short nLen);
1701 void Read_OLST( sal_uInt16, const sal_uInt8* pData, short nLen );
1703 void Read_CharShadow( sal_uInt16, const sal_uInt8* pData, short nLen );
1704 void Read_CharHighlight( sal_uInt16, const sal_uInt8* pData, short nLen );
1705 // Ver8-Listen
1707 void Read_ListLevel( sal_uInt16 nId, const sal_uInt8* pData, short nLen);
1710 * read and interpret the sprmPIlfo used to determine which list
1711 * contains the paragraph.
1712 * @param nId unused (sprm value, 0x460b for sprmPIlfo).
1713 * @param[in] pData operand.
1714 * @param[in] nLen size of the operand (pData) in byte, should be 2.
1715 * -1 to indicate the actual level is finished.
1717 void Read_LFOPosition( sal_uInt16 nId, const sal_uInt8* pData, short nLen);
1718 bool SetTxtFmtCollAndListLevel(const SwPaM& rRg, SwWW8StyInf& rStyleInfo);
1720 void Read_StyleCode(sal_uInt16, const sal_uInt8* pData, short nLen);
1721 void Read_Majority(sal_uInt16, const sal_uInt8* , short );
1722 void Read_DoubleLine_Rotate( sal_uInt16, const sal_uInt8* pDATA, short nLen);
1724 void Read_TxtForeColor(sal_uInt16, const sal_uInt8* pData, short nLen);
1725 void Read_TxtBackColor(sal_uInt16, const sal_uInt8* pData, short nLen);
1726 void Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, short nLen);
1727 void Read_ParaBiDi(sal_uInt16, const sal_uInt8* pData, short nLen);
1728 static sal_uInt32 ExtractColour(const sal_uInt8* &rpData, bool bVer67);
1730 long MapBookmarkVariables(const WW8FieldDesc* pF,String &rOrigName,
1731 const String &rData);
1732 String GetMappedBookmark(const String &rOrigName);
1734 // Felder
1735 eF_ResT Read_F_Input(WW8FieldDesc*, String& rStr);
1736 eF_ResT Read_F_InputVar(WW8FieldDesc*, String& rStr);
1737 eF_ResT Read_F_ANumber( WW8FieldDesc*, String& );
1738 eF_ResT Read_F_DocInfo( WW8FieldDesc* pF, String& rStr );
1739 eF_ResT Read_F_Author( WW8FieldDesc*, String& );
1740 eF_ResT Read_F_TemplName( WW8FieldDesc*, String& );
1741 short GetTimeDatePara(String& rStr, sal_uInt32& rFormat, sal_uInt16 &rLang,
1742 int nWhichDefault, bool bHijri = false);
1743 bool ForceFieldLanguage(SwField &rFld, sal_uInt16 nLang);
1744 eF_ResT Read_F_DateTime( WW8FieldDesc*, String& rStr );
1745 eF_ResT Read_F_FileName( WW8FieldDesc*, String& rStr);
1746 eF_ResT Read_F_Anz( WW8FieldDesc* pF, String& );
1747 eF_ResT Read_F_CurPage( WW8FieldDesc*, String& );
1748 eF_ResT Read_F_Ref( WW8FieldDesc* pF, String& );
1750 eF_ResT Read_F_Set( WW8FieldDesc*, String& rStr );
1751 eF_ResT Read_F_PgRef( WW8FieldDesc*, String& rStr );
1752 eF_ResT Read_F_NoteReference( WW8FieldDesc* pF, String& rStr );
1754 eF_ResT Read_F_Tox( WW8FieldDesc* pF, String& rStr );
1755 bool AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase);
1756 eF_ResT Read_F_Symbol( WW8FieldDesc*, String& rStr );
1757 eF_ResT Read_F_Embedd( WW8FieldDesc*, String& rStr );
1758 eF_ResT Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr);
1759 eF_ResT Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr );
1760 eF_ResT Read_F_FormListBox( WW8FieldDesc* pF, String& rStr);
1761 com::sun::star::awt::Size MiserableDropDownFormHack(const String &rString,
1762 com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>&
1763 rPropSet);
1765 eF_ResT Read_F_Macro( WW8FieldDesc*, String& rStr);
1766 eF_ResT Read_F_DBField( WW8FieldDesc*, String& rStr );
1767 eF_ResT Read_F_DBNext( WW8FieldDesc*, String& );
1768 eF_ResT Read_F_DBNum( WW8FieldDesc*, String& );
1769 eF_ResT Read_F_Equation( WW8FieldDesc*, String& );
1770 void Read_SubF_Ruby( WW8ReadFieldParams& rReadParam);
1771 void Read_SubF_Combined( WW8ReadFieldParams& rReadParam);
1772 eF_ResT Read_F_IncludePicture( WW8FieldDesc*, String& rStr );
1773 eF_ResT Read_F_IncludeText( WW8FieldDesc*, String& rStr );
1774 eF_ResT Read_F_Seq( WW8FieldDesc*, String& rStr );
1776 eF_ResT Read_F_OCX(WW8FieldDesc*, String&);
1777 eF_ResT Read_F_Hyperlink(WW8FieldDesc*, String& rStr);
1778 eF_ResT Read_F_Shape(WW8FieldDesc* pF, String& rStr);
1779 eF_ResT Read_F_HTMLControl( WW8FieldDesc* pF, String& rStr);
1782 void DeleteFormImpl();
1784 short ImportSprm( const sal_uInt8* pPos, sal_uInt16 nId = 0 );
1786 bool SearchRowEnd(WW8PLCFx_Cp_FKP* pPap,WW8_CP &rStartCp, int nLevel) const;
1788 const WW8Fib& GetFib() const { return *pWwFib; }
1789 SwDoc& GetDoc() const { return rDoc; }
1790 sal_uInt16 GetNAktColl() const { return nAktColl; }
1791 void SetNAktColl( sal_uInt16 nColl ) { nAktColl = nColl; }
1792 void SetAktItemSet( SfxItemSet* pItemSet ) { pAktItemSet = pItemSet; }
1793 sal_uInt16 StyleUsingLFO( sal_uInt16 nLFOIndex ) const ;
1794 const SwFmt* GetStyleWithOrgWWName( String& rName ) const ;
1796 static bool GetPictGrafFromStream(Graphic& rGraphic, SvStream& rSrc);
1797 static void PicRead( SvStream *pDataStream, WW8_PIC *pPic, bool bVer67);
1798 static bool ImportOleWMF( SvStorageRef xSrc1, GDIMetaFile &rWMF,
1799 long &rX, long &rY);
1800 static ColorData GetCol(sal_uInt8 nIco);
1802 SwWW8ImplReader( sal_uInt8 nVersionPara, SvStorage* pStorage, SvStream* pSt,
1803 SwDoc& rD, const String& rBaseURL, bool bNewDoc );
1805 const String& GetBaseURL() const { return sBaseURL; }
1806 // Laden eines kompletten DocFiles
1807 sal_uLong LoadDoc( SwPaM&,WW8Glossary *pGloss=0);
1808 CharSet GetCurrentCharSet();
1809 CharSet GetCurrentCJKCharSet();
1811 void PostProcessAttrs();
1814 bool CanUseRemoteLink(const String &rGrfName);
1815 void UseListIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt);
1816 void SetStyleIndent(SwWW8StyInf &rStyleInfo, const SwNumFmt &rFmt);
1817 // #i103711#
1818 // #i105414#
1819 void SyncIndentWithList( SvxLRSpaceItem &rLR,
1820 const SwNumFmt &rFmt,
1821 const bool bFirstLineOfStSet,
1822 const bool bLeftIndentSet );
1823 long GetListFirstLineIndent(const SwNumFmt &rFmt);
1824 String BookmarkToWriter(const String &rBookmark);
1825 bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth,
1826 sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft,
1827 SwTwips nPageRight, SwTwips nPageSize);
1828 void MatchEscherMirrorIntoFlySet(const SvxMSDffImportRec &rRecord,
1829 SfxItemSet &rFlySet);
1830 bool RTLDrawingsHack(long &rLeft, long nWidth,
1831 sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft,
1832 SwTwips nPageRight, SwTwips nPageSize);
1833 #endif
1835 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */