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