1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_SW_SOURCE_FILTER_WW8_WW8PAR_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_WW8_WW8PAR_HXX
23 #include <rtl/ustring.hxx>
24 #include <filter/msfilter/msdffimp.hxx>
25 #include <filter/msfilter/util.hxx>
26 #include <editeng/frmdir.hxx>
27 #include <fltshell.hxx>
29 #include <svx/svdobj.hxx>
38 #include "ww8struc.hxx"
39 #include "ww8scan.hxx"
40 #include "ww8glsy.hxx"
42 #include <msfilter.hxx>
43 #include <xmloff/odffields.hxx>
46 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
47 #include <swtypes.hxx>
48 #include <fmtfsize.hxx>
49 #include <fmtornt.hxx>
50 #include <fmtsrnd.hxx>
52 #include <editeng/lrspitem.hxx>
53 #include <oox/ole/olehelper.hxx>
55 #define SW_UD_IMAPDATA 2
60 class SwTextFormatColl
;
65 class SwFlyFrameFormat
;
73 struct WW8PLCFManResult
;
107 class OutlinerParaObject
;
109 namespace com
{namespace sun
{namespace star
{
110 namespace beans
{ class XPropertySet
;}
111 namespace form
{ class XFormComponent
;}
112 namespace drawing
{class XShape
;}
113 namespace lang
{class XMultiServiceFactory
;}
116 // defines only for the WW8-variable of the INI file
117 #define WW8FL_NO_STYLES 2
118 #define WW8FL_NO_GRAF 0x80
120 #define WW8FL_NO_OUTLINE 0x1000
121 #define WW8FL_NO_IMPLPASP 0x4000 // no implicit para space
122 #define WW8FL_NO_GRAFLAYER 0x8000
124 // Add-on-filter-flags, valid from Winword 8 on
125 #define WW8FL_NO_FLY_FOR_TXBX 1
127 // List-Manager (from Ver8 on)
131 class WW8Reader
: public StgReader
133 virtual sal_uLong
Read(SwDoc
&, const OUString
& rBaseURL
, SwPaM
&, const OUString
&) override
;
134 sal_uLong
OpenMainStream( tools::SvRef
<SotStorageStream
>& rRef
, sal_uInt16
& rBuffSize
);
136 virtual int GetReaderType() override
;
138 virtual bool HasGlossaries() const override
;
139 virtual bool ReadGlossaries( SwTextBlocks
&, bool bSaveRelFiles
) const override
;
142 class SwWW8ImplReader
;
147 WW8ListManager(SvStream
& rSt_
, SwWW8ImplReader
& rReader_
);
148 //Min and Max possible List Levels in Word
149 enum ListLevel
{nMinLevel
=1, nMaxLevel
=9};
150 //the rParaSprms returns back the original word paragraph indent
151 //sprms which were attached to the original numbering format
152 SwNumRule
* GetNumRuleForActivation(sal_uInt16 nLFOPosition
, const sal_uInt8 nLevel
,
153 std::vector
<sal_uInt8
> &rParaSprms
, SwTextNode
*pNode
=nullptr);
154 SwNumRule
* CreateNextRule(bool bSimple
);
156 SwNumRule
* GetNumRule(size_t i
);
157 size_t GetWW8LSTInfoNum() const{return maLSTInfos
.size();}
159 wwSprmParser maSprmParser
;
160 SwWW8ImplReader
& rReader
;
164 std::vector
<WW8LSTInfo
* > maLSTInfos
;
165 std::vector
<std::unique_ptr
<WW8LFOInfo
>> m_LFOInfos
;// D. from PLF LFO, sorted exactly like in the WW8 Stream
166 sal_uInt16 nUniqueList
; // current number for creating unique list names
167 sal_uInt8
* GrpprlHasSprm(sal_uInt16 nId
, sal_uInt8
& rSprms
, sal_uInt8 nLen
);
168 WW8LSTInfo
* GetLSTByListId( sal_uInt32 nIdLst
) const;
169 //the rParaSprms returns back the original word paragraph indent
170 //sprms which are attached to this numbering level
171 bool ReadLVL(SwNumFormat
& rNumFormat
, SfxItemSet
*& rpItemSet
, sal_uInt16 nLevelStyle
,
172 bool bSetStartNo
, std::deque
<bool> &rNotReallyThere
, sal_uInt16 nLevel
,
173 ww::bytes
&rParaSprms
);
175 // character attributes from GrpprlChpx
176 typedef SfxItemSet
* WW8aISet
[nMaxLevel
];
177 // character style pointer
178 typedef SwCharFormat
* WW8aCFormat
[nMaxLevel
];
180 void AdjustLVL(sal_uInt8 nLevel
, SwNumRule
& rNumRule
, WW8aISet
& rListItemSet
,
181 WW8aCFormat
& aCharFormat
, bool& bNewCharFormatCreated
,
182 const OUString
& aPrefix
= OUString());
184 WW8ListManager(const WW8ListManager
&) = delete;
185 WW8ListManager
& operator=(const WW8ListManager
&) = delete;
186 sal_uInt16 nLastLFOPosition
;
190 { // WinWord-attributes
191 // Attention: *DO NOT* reorder, since parts will be
192 // compared using memcmp
194 sal_Int16 nSp26
, nSp27
; // raw position
195 sal_Int16 nSp45
, nSp28
; // width / height
196 sal_Int16 nLeMgn
, nRiMgn
, nUpMgn
, nLoMgn
; // borders
197 sal_uInt8 nSp29
; // raw binding + alignment
198 sal_uInt8 nSp37
; // Wrap-Mode ( 1 / 2; 0 = no Apo ? )
199 WW8_BRCVer9_5 brc
; // borders Top, Left, Bottom, Right, Between
200 bool bBorderLines
; // border lines
201 bool bGrafApo
; // true: this frame is only used to position
202 // the contained graphics *not* as a character
203 bool mbVertSet
; // true if vertical positioning has been set
205 WW8FlyPara(bool bIsVer67
, const WW8FlyPara
* pSrc
= nullptr);
206 bool operator==(const WW8FlyPara
& rSrc
) const;
207 void Read(sal_uInt8 nSprm29
, WW8PLCFx_Cp_FKP
* pPap
);
208 void ReadFull(sal_uInt8 nSprm29
, SwWW8ImplReader
* pIo
);
209 void Read(sal_uInt8 nSprm29
, WW8RStyle
* pStyle
);
210 void ApplyTabPos(const WW8_TablePos
*pTabPos
);
211 bool IsEmpty() const;
216 OUString m_sWWStyleName
;
217 sal_uInt16 m_nWWStyleId
;
219 rtl_TextEncoding m_eLTRFontSrcCharSet
; // rtl_TextEncoding for the font
220 rtl_TextEncoding m_eRTLFontSrcCharSet
; // rtl_TextEncoding for the font
221 rtl_TextEncoding m_eCJKFontSrcCharSet
; // rtl_TextEncoding for the font
223 std::shared_ptr
<WW8FlyPara
> m_xWWFly
;
224 SwNumRule
* m_pOutlineNumrule
;
227 sal_uInt16 m_nFollow
;
228 sal_uInt16 m_nLFOIndex
;
229 sal_uInt8 m_nListLevel
;
231 // WW8 outline level is zero-based:
232 // 0: outline level 1
233 // 1: outline level 2
235 // 8: outline level 9
237 sal_uInt8 mnWW8OutlineLevel
;
239 sal_uInt16 m_n81Flags
; // for bold, italic, ...
240 sal_uInt16 m_n81BiDiFlags
; // for bold, italic, ...
241 SvxLRSpaceItem maWordLR
;
242 bool m_bValid
; // empty of valid
243 bool m_bImported
; // for recursive imports
244 bool m_bColl
; // true-> pFormat is SwTextFormatColl
245 bool m_bImportSkipped
; // only true if !bNewDoc && existing style
246 bool m_bHasStyNumRule
; // true-> named NumRule in style
247 bool m_bHasBrokenWW6List
; // true-> WW8+ style has a WW7- list
248 bool m_bListReleventIndentSet
; //true if this style's indent has
249 //been explicitly set, it's set to the value
250 //of pFormat->GetItemState(RES_LR_SPACE, false)
251 //if it was possible to get the ItemState
252 //for L of the LR space independently
253 bool m_bParaAutoBefore
; // For Auto spacing before a paragraph
254 bool m_bParaAutoAfter
; // For Auto Spacing after a paragraph
257 m_sWWStyleName( OUString() ),
259 m_eLTRFontSrcCharSet(0),
260 m_eRTLFontSrcCharSet(0),
261 m_eCJKFontSrcCharSet(0),
262 m_pFormat( nullptr ),
264 m_pOutlineNumrule( nullptr ),
268 m_nLFOIndex( USHRT_MAX
),
269 m_nListLevel(WW8ListManager::nMaxLevel
),
270 mnWW8OutlineLevel( MAXLEVEL
),
273 maWordLR( RES_LR_SPACE
),
277 m_bImportSkipped(false),
278 m_bHasStyNumRule(false),
279 m_bHasBrokenWW6List(false),
280 m_bListReleventIndentSet(false),
281 m_bParaAutoBefore(false),
282 m_bParaAutoAfter(false)
286 void SetOrgWWIdent( const OUString
& rName
, const sal_uInt16 nId
)
288 m_sWWStyleName
= rName
;
291 // apply default WW8 outline level to WW8 Built-in Heading styles
292 if (IsWW8BuiltInHeadingStyle())
294 mnWW8OutlineLevel
= m_nWWStyleId
- 1;
298 const OUString
& GetOrgWWName() const
300 return m_sWWStyleName
;
303 bool HasWW8OutlineLevel() const
305 return (m_pFormat
!= nullptr && (MAXLEVEL
> mnWW8OutlineLevel
));
308 bool IsOutlineNumbered() const
310 return m_pOutlineNumrule
&& HasWW8OutlineLevel();
313 const SwNumRule
* GetOutlineNumrule() const
315 return m_pOutlineNumrule
;
317 rtl_TextEncoding
GetCharSet() const;
318 rtl_TextEncoding
GetCJKCharSet() const;
320 sal_uInt16
GetWWStyleId() const
325 bool IsWW8BuiltInHeadingStyle() const
327 return GetWWStyleId() >= 1 && GetWWStyleId() <= 9;
330 bool IsWW8BuiltInDefaultStyle() const
332 return GetWWStyleId() == 0;
336 WW8OutlineLevelToOutlinelevel(const sal_uInt8 nWW8OutlineLevel
)
338 if (nWW8OutlineLevel
< MAXLEVEL
)
340 if (nWW8OutlineLevel
== 9)
342 return 0; // no outline level --> body text
346 return nWW8OutlineLevel
+ 1; // outline level 1..9
356 class SwWW8FltControlStack
: public SwFltControlStack
359 SwWW8ImplReader
& rReader
;
360 std::unique_ptr
<SfxItemSet
> m_xScratchSet
;
361 sal_uInt16 nToggleAttrFlags
;
362 sal_uInt16 nToggleBiDiAttrFlags
;
363 SwWW8FltControlStack(const SwWW8FltControlStack
&) = delete;
364 SwWW8FltControlStack
& operator=(const SwWW8FltControlStack
&) = delete;
365 const SwNumFormat
* GetNumFormatFromStack(const SwPosition
&rPos
,
366 const SwTextNode
&rTextNode
);
368 virtual void SetAttrInDoc(const SwPosition
& rTmpPos
,
369 SwFltStackEntry
& rEntry
) override
;
371 virtual sal_Int32
GetCurrAttrCP() const override
;
372 virtual bool IsParaEndInCPs(sal_Int32 nStart
, sal_Int32 nEnd
, bool bSdOD
) const override
;
373 //Clear the para end position recorded in reader intermittently for the least impact on loading performance
374 virtual void ClearParaEndPosition() override
;
375 virtual bool CheckSdOD(sal_Int32 nStart
,sal_Int32 nEnd
) override
;
378 SwWW8FltControlStack(SwDoc
* pDo
, sal_uLong nFieldFl
, SwWW8ImplReader
& rReader_
)
379 : SwFltControlStack( pDo
, nFieldFl
), rReader( rReader_
),
380 nToggleAttrFlags(0), nToggleBiDiAttrFlags(0)
383 void NewAttr(const SwPosition
& rPos
, const SfxPoolItem
& rAttr
);
385 virtual SwFltStackEntry
* SetAttr(const SwPosition
& rPos
, sal_uInt16 nAttrId
, bool bTstEnde
=true, long nHand
=LONG_MAX
, bool consumedByField
=false) override
;
387 void SetToggleAttr(sal_uInt8 nId
, bool bOn
)
390 nToggleAttrFlags
|= (1 << nId
);
392 nToggleAttrFlags
&= ~(1 << nId
);
395 sal_uInt16
GetToggleAttrFlags() const { return nToggleAttrFlags
; }
397 void SetToggleBiDiAttr(sal_uInt8 nId
, bool bOn
)
400 nToggleBiDiAttrFlags
|= (1 << nId
);
402 nToggleBiDiAttrFlags
&= ~(1 << nId
);
405 sal_uInt16
GetToggleBiDiAttrFlags() const { return nToggleBiDiAttrFlags
; }
406 void SetToggleAttrFlags(sal_uInt16 nFlags
) { nToggleAttrFlags
= nFlags
; }
407 void SetToggleBiDiAttrFlags(sal_uInt16 nFlags
) {nToggleBiDiAttrFlags
= nFlags
;}
409 const SfxPoolItem
* GetFormatAttr(const SwPosition
& rPos
, sal_uInt16 nWhich
);
410 const SfxPoolItem
* GetStackAttr(const SwPosition
& rPos
, sal_uInt16 nWhich
);
413 //The only thing this is for is RES_FLTR_ANCHOR, anything else is an error.
414 //For graphics whose anchoring position would otherwise be automatically moved
415 //along by the insertion of text.
416 class SwWW8FltAnchorStack
: public SwFltControlStack
419 SwWW8FltAnchorStack(SwDoc
* pDo
, sal_uLong nFieldFl
)
420 : SwFltControlStack( pDo
, nFieldFl
) {}
421 void AddAnchor(const SwPosition
& rPos
,SwFrameFormat
*pFormat
);
424 SwWW8FltAnchorStack(const SwWW8FltAnchorStack
&) = delete;
425 SwWW8FltAnchorStack
& operator=(const SwWW8FltAnchorStack
&) = delete;
433 bool operator()(const OUString
&r1
, const OUString
&r2
) const
435 return r1
.compareToIgnoreAsciiCase(r2
)<0;
441 bool operator()(const SwTextNode
*r1
, const SwTextNode
*r2
) const
443 return r1
->GetIndex() < r2
->GetIndex();
448 class SwWW8ReferencedFltEndStack
: public SwFltEndStack
451 SwWW8ReferencedFltEndStack( SwDoc
* pDo
, sal_uLong nFieldFl
)
452 : SwFltEndStack( pDo
, nFieldFl
)
453 , aReferencedTOCBookmarks()
456 // Keep track of referenced TOC bookmarks in order to suppress the import
457 // of unreferenced ones.
458 std::set
<OUString
, SwWW8::ltstr
> aReferencedTOCBookmarks
;
460 virtual void SetAttrInDoc( const SwPosition
& rTmpPos
,
461 SwFltStackEntry
& rEntry
) override
;
464 class SwWW8FltRefStack
: public SwFltEndStack
467 SwWW8FltRefStack(SwDoc
* pDo
, sal_uLong nFieldFl
)
468 : SwFltEndStack( pDo
, nFieldFl
)
471 bool IsFootnoteEdnBkmField(const SwFormatField
& rFormatField
, sal_uInt16
& rBkmNo
);
473 //Keep track of variable names created with fields, and the bookmark
474 //mapped to their position, hopefully the same, but very possibly
475 //an additional pseudo bookmark
476 std::map
<OUString
, OUString
, SwWW8::ltstr
> aFieldVarNames
;
478 SwFltStackEntry
*RefToVar(const SwField
* pField
,SwFltStackEntry
& rEntry
);
479 virtual void SetAttrInDoc(const SwPosition
& rTmpPos
,
480 SwFltStackEntry
& rEntry
) override
;
482 SwWW8FltRefStack(const SwWW8FltRefStack
&) = delete;
483 SwWW8FltRefStack
& operator=(const SwWW8FltRefStack
&) = delete;
486 template< typename Type
>
487 inline bool get_flag( Type nBitField
, Type nMask
)
488 { return (nBitField
& nMask
) != 0; }
490 template< typename ReturnType
, typename Type
>
491 inline ReturnType
ulimit_cast( Type nValue
, ReturnType nMax
)
492 { return static_cast< ReturnType
>( std::min
< Type
>( nValue
, nMax
) ); }
494 template< typename ReturnType
, typename Type
>
495 inline ReturnType
ulimit_cast( Type nValue
)
496 { return ulimit_cast( nValue
, std::numeric_limits
< ReturnType
>::max() ); }
498 class SwMacroInfo
: public SdrObjUserData
502 virtual ~SwMacroInfo() override
;
504 virtual SdrObjUserData
* Clone( SdrObject
* pObj
) const override
;
506 void SetHlink( const OUString
& rHlink
) { maHlink
= rHlink
; }
507 const OUString
& GetHlink() const { return maHlink
; }
508 void SetTarFrame( const OUString
& rTarFrame
) { maTarFrame
= rTarFrame
; }
509 const OUString
& GetTarFrame() const { return maTarFrame
; }
510 void SetShapeId( sal_Int32 rShapeId
) { mnShapeId
= rShapeId
; }
511 const sal_Int32
& GetShapeId() const { return mnShapeId
; }
512 void SetName( const OUString
& rName
) { maNameStr
= rName
; }
513 const OUString
& GetName() const { return maNameStr
; }
522 struct HyperLinksTable
535 SwNodeIndex maPtNode
;
536 sal_Int32 mnPtContent
;
538 explicit Position(const SwPosition
&rPos
);
539 Position(const Position
&rPos
);
540 operator SwPosition() const;
541 const SwNodeIndex
& GetPtNode() { return maPtNode
; };
542 sal_Int32
GetPtContent() { return mnPtContent
; };
550 OUString msBookmarkName
;
553 ::sw::mark::IFieldmark::parameter_map_t maParams
;
556 sw::hack::Position maStartPos
;
557 sal_uInt16 mnFieldId
;
558 sal_uLong mnObjLocFc
;
559 WW8FieldEntry(SwPosition
&rPos
, sal_uInt16 nFieldId
) throw();
560 WW8FieldEntry(const WW8FieldEntry
&rOther
) throw();
561 WW8FieldEntry
&operator=(const WW8FieldEntry
&rOther
) throw();
562 void Swap(WW8FieldEntry
&rOther
) throw();
564 SwNodeIndex
GetPtNode() { return maStartPos
.GetPtNode(); };
565 sal_Int32
GetPtContent() { return maStartPos
.GetPtContent(); };
567 const OUString
& GetBookmarkName() { return msBookmarkName
;}
568 const OUString
& GetBookmarkCode() { return msMarkCode
;}
569 void SetBookmarkName(const OUString
& bookmarkName
);
570 void SetBookmarkType(const OUString
& bookmarkType
);
571 void SetBookmarkCode(const OUString
& bookmarkCode
);
572 ::sw::mark::IFieldmark::parameter_map_t
& getParameters() { return maParams
;}
575 // mini marker for some flags
580 WW8PLCFxSaveAll maPLCFxSave
;
582 std::deque
<bool> maOldApos
;
583 std::deque
<WW8FieldEntry
> maOldFieldStack
;
584 SwWW8FltControlStack
* mpOldStck
;
585 SwWW8FltAnchorStack
* mpOldAnchorStck
;
586 sw::util::RedlineStack
*mpOldRedlines
;
587 WW8PLCFMan
* mpOldPlcxMan
;
588 WW8FlyPara
* mpWFlyPara
;
589 WW8SwFlyPara
* mpSFlyPara
;
590 SwPaM
* mpPreviousNumPaM
;
591 const SwNumRule
* mpPrevNumRule
;
592 WW8TabDesc
* mpTableDesc
;
594 sal_uInt16 mnAktColl
;
595 sal_Unicode mcSymbol
;
598 bool mbHdFtFootnoteEdn
;
599 bool mbTxbxFlySection
;
607 WW8ReaderSave(SwWW8ImplReader
* pRdr
, WW8_CP nStart
=-1);
608 void Restore(SwWW8ImplReader
* pRdr
);
609 const SwPosition
&GetStartPos() const { return maTmpPos
; }
612 enum eF_ResT
{ FLD_OK
, FLD_TEXT
, FLD_TAGIGN
, FLD_TAGTXT
, FLD_READ_FSPA
};
618 SwWW8Shade(bool bVer67
, const WW8_SHD
& rSHD
);
619 SwWW8Shade(ColorData nFore
, ColorData nBack
, sal_uInt16 nIndex
)
621 SetShade(nFore
, nBack
, nIndex
);
624 void SetShade(ColorData nFore
, ColorData nBack
, sal_uInt16 nIndex
);
629 enum SwWw8ControlType
636 class WW8FormulaControl
639 SwWW8ImplReader
&mrRdr
;
641 WW8FormulaControl(WW8FormulaControl
const&) = delete;
642 WW8FormulaControl
& operator=(WW8FormulaControl
const&) = delete;
645 WW8FormulaControl(const OUString
& rN
, SwWW8ImplReader
&rRdr
)
646 : mrRdr(rRdr
), mfUnknown(0), mfDropdownIndex(0),
647 mfToolTip(0), mfNoMark(0), mfUseSize(0), mfNumbersOnly(0), mfDateOnly(0),
648 mfUnused(0), mhpsCheckBox(20), mnChecked(0), mnMaxLen(0), msName( rN
)
651 sal_uInt8 mfUnknown
:2;
652 sal_uInt8 mfDropdownIndex
:6;
653 sal_uInt8 mfToolTip
:1;
654 sal_uInt8 mfNoMark
:1;
655 sal_uInt8 mfUseSize
:1;
656 sal_uInt8 mfNumbersOnly
:1;
657 sal_uInt8 mfDateOnly
:1;
658 sal_uInt8 mfUnused
:3;
660 sal_uInt16 mhpsCheckBox
;
661 sal_uInt16 mnChecked
;
663 /// FFData.cch in the spec: maximum length, in characters, of the value of the textbox.
667 OUString msFormatting
;
670 std::vector
<OUString
> maListEntries
;
671 virtual ~WW8FormulaControl() {}
672 void FormulaRead(SwWw8ControlType nWhich
,SvStream
*pD
);
673 virtual bool Import(const css::uno::Reference
< css::lang::XMultiServiceFactory
> &rServiceFactory
,
674 css::uno::Reference
< css::form::XFormComponent
> &rFComp
,
675 css::awt::Size
&rSz
) = 0;
679 class WW8FormulaCheckBox
: public WW8FormulaControl
682 WW8FormulaCheckBox(const WW8FormulaCheckBox
&) = delete;
683 WW8FormulaCheckBox
& operator=(const WW8FormulaCheckBox
&) = delete;
686 explicit WW8FormulaCheckBox(SwWW8ImplReader
&rR
);
688 virtual bool Import(const css::uno::Reference
< css::lang::XMultiServiceFactory
> &rServiceFactory
,
689 css::uno::Reference
< css::form::XFormComponent
> &rFComp
,
690 css::awt::Size
&rSz
) override
;
693 class WW8FormulaListBox
: public WW8FormulaControl
696 WW8FormulaListBox(const WW8FormulaListBox
&) = delete;
697 WW8FormulaListBox
& operator=(const WW8FormulaListBox
&) = delete;
700 explicit WW8FormulaListBox(SwWW8ImplReader
&rR
);
702 virtual bool Import(const css::uno::Reference
< css::lang::XMultiServiceFactory
> &rServiceFactory
,
703 css::uno::Reference
< css::form::XFormComponent
> &rFComp
,
704 css::awt::Size
&rSz
) override
;
707 class WW8FormulaEditBox
: public WW8FormulaControl
710 WW8FormulaEditBox(const WW8FormulaEditBox
&) = delete;
711 WW8FormulaEditBox
& operator=(const WW8FormulaEditBox
&) = delete;
713 explicit WW8FormulaEditBox(SwWW8ImplReader
&rR
);
714 //no real implementation, return false
715 virtual bool Import(const css::uno::Reference
< css::lang::XMultiServiceFactory
> & /* rServiceFactory */,
716 css::uno::Reference
< css::form::XFormComponent
> & /* rFComp */,
717 css::awt::Size
& /* rSz */) override
{ return false; }
720 class SwMSConvertControls
: public oox::ole::MSConvertOCXControls
723 SwMSConvertControls( SfxObjectShell
*pDSh
,SwPaM
*pP
);
724 void InsertFormula( WW8FormulaControl
&rFormula
);
725 virtual bool InsertControl(const css::uno::Reference
< css::form::XFormComponent
>& rFComp
,
726 const css::awt::Size
& rSize
,
727 css::uno::Reference
< css::drawing::XShape
> *pShape
, bool bFloatingCtrl
) override
;
728 void ExportControl(WW8Export
&rWrt
, const SdrUnoObj
& rFormObj
);
729 bool ReadOCXStream( tools::SvRef
<SotStorage
>& rSrc1
,
730 css::uno::Reference
< css::drawing::XShape
> *pShapeRef
,
731 bool bFloatingCtrl
=false );
734 sal_uInt32 mnObjectId
;
737 class SwMSDffManager
: public SvxMSDffManager
740 SwWW8ImplReader
& rReader
;
741 SvStream
*pFallbackStream
;
742 std::map
<sal_uInt32
,OString
> aOldEscherBlipCache
;
744 virtual bool GetOLEStorageName( long nOLEId
, OUString
& rStorageName
,
745 tools::SvRef
<SotStorage
>& rSrcStorage
, css::uno::Reference
< css::embed::XStorage
>& rDestStorage
) const override
;
746 virtual bool ShapeHasText( sal_uLong nShapeId
, sal_uLong nFilePos
) const override
;
747 // #i32596# - new parameter <_nCalledByGroup>, which
748 // indicates, if the OLE object is imported inside a group object
749 virtual SdrObject
* ImportOLE( long nOLEId
,
751 const Rectangle
& rBoundRect
,
752 const Rectangle
& rVisArea
,
753 const int _nCalledByGroup
,
754 sal_Int64 nAspect
) const override
;
756 SwMSDffManager(const SwMSDffManager
&) = delete;
757 SwMSDffManager
& operator=(const SwMSDffManager
&) = delete;
759 static sal_uInt32
GetFilterFlags();
760 static sal_Int32
GetEscherLineMatch(MSO_LineStyle eStyle
, MSO_SPT eShapeType
,
762 SwMSDffManager( SwWW8ImplReader
& rRdr
, bool bSkipImages
);
763 void DisableFallbackStream();
764 void EnableFallbackStream();
766 virtual SdrObject
* ProcessObj( SvStream
& rSt
, DffObjData
& rObjData
, void* pData
, Rectangle
& rTextRect
, SdrObject
* pObj
) override
;
772 explicit wwSection(const SwPosition
&rPos
);
776 SwSection
*mpSection
;
778 SvxFrameDirection meDir
;
784 css::drawing::TextVerticalAdjust mnVerticalAdjustment
;
788 bool IsContinuous() const { return maSep
.bkc
== 0; }
789 bool IsNotProtected() const { return maSep
.fUnlocked
!= 0; }
790 bool IsVertical() const;
791 sal_Int16
NoCols() const { return maSep
.ccolM1
+ 1; }
792 sal_Int32
StandardColSeparation() const { return maSep
.dxaColumns
; }
793 bool HasTitlePage() const { return maSep
.fTitlePage
!= 0; }
794 sal_uInt16
PageStartAt() const { return maSep
.pgnStart
; }
795 bool PageRestartNo() const { return maSep
.fPgnRestart
!= 0; }
796 bool IsBiDi() const { return maSep
.fBiDi
!= 0; }
797 sal_uInt32
GetPageWidth() const { return nPgWidth
; }
798 sal_uInt32
GetTextAreaWidth() const
799 { return GetPageWidth() - GetPageLeft() - GetPageRight(); }
800 sal_uInt32
GetPageHeight() const { return maSep
.yaPage
; }
801 sal_uInt32
GetPageLeft() const { return nPgLeft
; }
802 sal_uInt32
GetPageRight() const { return nPgRight
; }
803 bool IsLandScape() const { return maSep
.dmOrientPage
!= 0; }
804 bool IsFixedHeightHeader() const { return maSep
.dyaTop
< 0; }
805 bool IsFixedHeightFooter() const { return maSep
.dyaBottom
< 0; }
808 class wwSectionManager
812 A queue of the ms sections in the document
814 SwWW8ImplReader
& mrReader
;
815 std::deque
<wwSection
> maSegments
;
816 typedef std::deque
<wwSection
>::iterator mySegIter
;
817 typedef std::deque
<wwSection
>::reverse_iterator mySegrIter
;
819 //Num of page desc's entered into the document
824 bool bHasHeader
, bHasFooter
;
825 sal_uInt32 nSwHLo
, nSwFUp
, nSwUp
, nSwLo
;
836 void SetSegmentToPageDesc(const wwSection
&rSection
, bool bIgnoreCols
);
838 void GetPageULData(const wwSection
&rNewSection
,
839 wwULSpaceData
& rData
) const;
840 static void SetPageULSpaceItems(SwFrameFormat
&rFormat
, wwULSpaceData
& rData
,
841 const wwSection
&rSection
);
843 static void SetPage(SwPageDesc
&rPageDesc
, SwFrameFormat
&rFormat
,
844 const wwSection
&rSection
, bool bIgnoreCols
);
846 static void SetNumberingType(const wwSection
&rNewSection
, SwPageDesc
&rPageDesc
);
848 void SetUseOn(wwSection
&rSection
);
849 void SetHdFt(wwSection
&rSection
, int nSect
, const wwSection
*pPrevious
);
851 SwSectionFormat
*InsertSection(SwPaM
& rMyPaM
, wwSection
&rSection
);
852 static bool SetCols(SwFrameFormat
&rFormat
, const wwSection
&rSection
,
853 sal_uInt32 nNetWidth
);
854 bool SectionIsProtected(const wwSection
&rSection
) const;
855 void SetLeftRight(wwSection
&rSection
);
857 The segment we're inserting, the start of the segments container, and the
858 nodeindex of where we want the page break to (normally the segments start
861 SwFormatPageDesc
SetSwFormatPageDesc(mySegIter
&rIter
, mySegIter
&rStart
,
864 wwSectionManager(const wwSectionManager
&) = delete;
865 wwSectionManager
& operator=(const wwSectionManager
&) = delete;
867 explicit wwSectionManager(SwWW8ImplReader
&rReader
) : mrReader(rReader
), mnDesc(0)
869 void SetCurrentSectionHasFootnote();
870 void SetCurrentSectionVerticalAdjustment(const css::drawing::TextVerticalAdjust nVA
);
871 bool CurrentSectionIsVertical() const;
872 bool CurrentSectionIsProtected() const;
873 void PrependedInlineNode(const SwPosition
&rPos
, const SwNode
&rNode
);
874 sal_uInt16
CurrentSectionColCount() const;
875 bool WillHavePageDescHere(const SwNodeIndex
& rIdx
) const;
876 void CreateSep(const long nTextPos
, bool bMustHaveBreak
);
877 void InsertSegments();
878 void JoinNode(const SwPosition
&rPos
, const SwNode
&rNode
);
879 sal_uInt32
GetPageLeft() const;
880 sal_uInt32
GetPageRight() const;
881 sal_uInt32
GetPageWidth() const;
882 sal_uInt32
GetWWPageTopMargin() const;
883 sal_uInt32
GetTextAreaWidth() const;
886 //Various writer elements like frames start off containing a blank paragraph,
887 //sometimes this paragraph turns out to be extraneous, e.g. the frame should
888 //only contain a table with no trailing paragraph.
890 //We want to remove these extra paragraphs, but removing them during the parse
891 //is problematic, because we don't want to remove any paragraphs that are still
892 //addressed by property entries in a SwFltControlStack which have not yet been
893 //committed to the document.
895 //Safest thing is to not delete SwTextNodes from a document during import, and
896 //remove these extraneous paragraphs at the end after all SwFltControlStack are
898 class wwExtraneousParas
902 A vector of SwTextNodes to erase from a document after import is complete
904 std::set
<SwTextNode
*, SwWW8::ltnode
> m_aTextNodes
;
907 wwExtraneousParas(wwExtraneousParas
const&) = delete;
908 wwExtraneousParas
& operator=(wwExtraneousParas
const&) = delete;
911 explicit wwExtraneousParas(SwDoc
&rDoc
) : m_rDoc(rDoc
) {}
912 ~wwExtraneousParas() { delete_all_from_doc(); }
913 void insert(SwTextNode
*pTextNode
) { m_aTextNodes
.insert(pTextNode
); }
914 void delete_all_from_doc();
921 sal_Int32 mnImportedGraphicsCount
;
924 wwFrameNamer(wwFrameNamer
const&) = delete;
925 wwFrameNamer
& operator=(wwFrameNamer
const&) = delete;
928 void SetUniqueGraphName(SwFrameFormat
*pFrameFormat
, const OUString
&rFixedPart
);
929 wwFrameNamer(bool bIsDisabled
, const OUString
&rSeed
)
930 : msSeed(rSeed
), mnImportedGraphicsCount(0), mbIsDisabled(bIsDisabled
)
939 OUString msFileLinkSeed
;
941 wwSectionNamer(const wwSectionNamer
&) = delete;
942 wwSectionNamer
& operator=(const wwSectionNamer
&) = delete;
944 OUString
UniqueName();
945 wwSectionNamer(const SwDoc
&rDoc
, const OUString
&rSeed
)
946 : mrDoc(rDoc
), msFileLinkSeed(rSeed
), mnFileSectionNo(0)
950 class FootnoteDescriptor
959 struct ApoTestResults
966 WW8FlyPara
* mpStyleApo
;
968 : mbStartApo(false), mbStopApo(false), m_bHasSprm37(false)
969 , m_bHasSprm29(false), m_nSprm29(0), mpStyleApo(nullptr) {}
970 bool HasStartStop() const { return (mbStartApo
|| mbStopApo
); }
971 bool HasFrame() const { return (m_bHasSprm29
|| m_bHasSprm37
|| mpStyleApo
); }
976 OUString msOutlineNumRule
; // WinWord 6 numbering, variant 1
977 OUString msNumberingNumRule
; // WinWord 6 numbering, variant 2
978 SwNumRule
* GetNumRule(SwDoc
& rDoc
, sal_uInt8 nNumType
);
979 void SetNumRule(const OUString
& rNumRule
, sal_uInt8 nNumType
);
984 struct WW8PostProcessAttrsInfo
992 WW8PostProcessAttrsInfo(WW8_CP nCpStart
, WW8_CP nCpEnd
, SwPaM
& rPaM
);
995 #define MAX_COL 64 // WW6-description: 32, WW6-UI: 31 & WW8-UI: 63!
997 struct WW8TabBandDesc
999 WW8TabBandDesc
* pNextBand
;
1001 short mnDefaultLeft
;
1003 short mnDefaultRight
;
1004 short mnDefaultBottom
;
1008 sal_uInt16 maDirections
[MAX_COL
+ 1];
1009 short nCenter
[MAX_COL
+ 1]; // X-edge of all cells of this band
1010 short nWidth
[MAX_COL
+ 1]; // length of all cells of this band
1011 short nWwCols
; // sal_uInt8 would be sufficient, alignment -> short
1012 short nSwCols
; // SW: number of columns for the writer
1013 bool bLEmptyCol
; // SW: an additional empty column at the left
1014 bool bREmptyCol
; // SW: same at the right
1018 sal_uInt8 nOverrideSpacing
[MAX_COL
+ 1];
1019 short nOverrideValues
[MAX_COL
+ 1][4];
1021 sal_uInt32
* pNewSHDs
;
1022 WW8_BRCVer9 aDefBrcs
[6];
1024 bool bExist
[MAX_COL
]; // does this cell exist ?
1025 sal_uInt8 nTransCell
[MAX_COL
+ 2]; // translation WW-Index -> SW-Index
1027 sal_uInt8
transCell(sal_uInt8 nWwCol
) const
1029 return nWwCol
< SAL_N_ELEMENTS(nTransCell
) ? nTransCell
[nWwCol
] : 0xFF;
1033 WW8TabBandDesc(WW8TabBandDesc
& rBand
); // deep copy
1035 static void setcelldefaults(WW8_TCell
*pCells
, short nCells
);
1036 void ReadDef(bool bVer67
, const sal_uInt8
* pS
);
1037 void ProcessDirection(const sal_uInt8
* pParams
);
1038 void ProcessSprmTSetBRC(int nBrcVer
, const sal_uInt8
* pParamsTSetBRC
);
1039 void ProcessSprmTTableBorders(int nBrcVer
, const sal_uInt8
* pParams
);
1040 void ProcessSprmTDxaCol(const sal_uInt8
* pParamsTDxaCol
);
1041 void ProcessSprmTDelete(const sal_uInt8
* pParamsTDelete
);
1042 void ProcessSprmTInsert(const sal_uInt8
* pParamsTInsert
);
1043 void ProcessSpacing(const sal_uInt8
* pParamsTInsert
);
1044 void ProcessSpecificSpacing(const sal_uInt8
* pParamsTInsert
);
1045 void ReadShd(const sal_uInt8
* pS
);
1046 void ReadNewShd(const sal_uInt8
* pS
, bool bVer67
);
1048 enum wwDIR
{wwTOP
= 0, wwLEFT
= 1, wwBOTTOM
= 2, wwRIGHT
= 3};
1053 typedef std::set
<WW8_CP
> cp_set
;
1054 typedef std::vector
<WW8_CP
> cp_vector
;
1056 class SwWW8ImplReader
1059 SwDocShell
*m_pDocShell
; // The Real DocShell
1061 friend class WW8RStyle
;
1062 friend class WW8TabDesc
;
1063 friend class WW8ReaderSave
;
1064 friend struct WW8FlyPara
;
1065 friend struct WW8SwFlyPara
;
1066 friend class WW8FlySet
;
1067 friend class SwMSDffManager
;
1068 friend class SwWW8FltControlStack
;
1069 friend class WW8FormulaControl
;
1070 friend class wwSectionManager
;
1074 SotStorage
* m_pStg
; // Input-Storage
1075 SvStream
* m_pStrm
; // Input-(Storage)Stream
1076 SvStream
* m_pTableStream
; // Input-(Storage)Stream
1077 SvStream
* m_pDataStream
; // Input-(Storage)Stream
1081 std::shared_ptr
<SwUnoCursor
> mpCursor
;
1084 SwWW8FltControlStack
* m_pCtrlStck
; // stack for the attributes
1087 This stack is for redlines, because their sequence of discovery can
1088 be out of order of their order of insertion into the document.
1090 sw::util::RedlineStack
*m_pRedlineStack
;
1093 This stack is for fields that get referenced later, e.g. BookMarks and TOX.
1094 They get inserted at the end of the document, it is the same stack for
1095 headers/footers/main text/textboxes/tables etc...
1097 SwWW8ReferencedFltEndStack
*m_pReffedStck
;
1100 This stack is for fields whose true conversion cannot be determined until
1101 the end of the document, it is the same stack for headers/footers/main
1102 text/textboxes/tables etc... They are things that reference other things
1103 e.g. NoteRef and Ref, they are processed after pReffedStck
1105 SwWW8FltRefStack
*m_pReffingStck
;
1108 For graphics anchors. Determines the graphics whose anchors are in the
1109 current paragraph, and works around the difficulty in inserting a graphic
1110 anchored to character before a character to be anchored to has been
1111 inserted. Is emptied at the end of each paragraph.
1113 SwWW8FltAnchorStack
* m_pAnchorStck
;
1116 A stack of fields identifiers to keep track of any open fields that need
1117 to be closed. Generally word fields are inserted as writer fields as soon
1118 as they are encountered, and so their end point is normally unimportant.
1119 But hyperlink fields need to be applied as attributes to text and it is
1120 far easier and safer to set the end point of an attribute when we
1121 encounter the end marker of the field instead of calculating in advance
1122 where the end point will fall, to do so fully correctly duplicates the
1123 main logic of the filter itself.
1125 std::deque
<WW8FieldEntry
> m_aFieldStack
;
1126 typedef std::deque
<WW8FieldEntry
>::const_iterator mycFieldIter
;
1129 A stack of open footnotes. Should only be one in it at any time.
1131 std::deque
<FootnoteDescriptor
> m_aFootnoteStack
;
1134 A queue of the ms sections in the document
1136 wwSectionManager m_aSectionManager
;
1139 A vector of surplus-to-requirements paragraph in the final document,
1140 that exist because of quirks of the SwDoc document model and/or API,
1141 which need to be removed.
1143 wwExtraneousParas m_aExtraneousParas
;
1146 A map of tables to their follow nodes for use in inserting tables into
1147 already existing document, i.e. insert file
1149 sw::util::InsertedTablesManager m_aInsertedTables
;
1152 Creates unique names to give to (file link) sections (WW1/WW2/...)
1154 wwSectionNamer m_aSectionNameGenerator
;
1157 Knows how to split a series of bytes into sprms and their arguments
1159 wwSprmParser
*m_pSprmParser
;
1162 Creates unique names to give to graphics
1164 wwFrameNamer m_aGrfNameGenerator
;
1167 Knows which writer style a given word style should be imported as.
1169 sw::util::ParaStyleMapper m_aParaStyleMapper
;
1170 sw::util::CharStyleMapper m_aCharStyleMapper
;
1173 Stack of textencoding being used as we progress through the document text
1175 std::stack
<rtl_TextEncoding
> m_aFontSrcCharSets
;
1176 std::stack
<rtl_TextEncoding
> m_aFontSrcCJKCharSets
;
1178 SwMSConvertControls
*m_pFormImpl
; // Control-Implementierung
1180 SwFlyFrameFormat
* m_pFlyFormatOfJustInsertedGraphic
;
1181 SwFrameFormat
* m_pFormatOfJustInsertedApo
;
1182 SwPaM
* m_pPreviousNumPaM
;
1183 const SwNumRule
* m_pPrevNumRule
;
1185 //Keep track of APO environments
1186 std::deque
<bool> m_aApos
;
1187 typedef std::deque
<bool>::const_iterator mycApoIter
;
1189 Keep track of generated Ruby character formats we can minimize the
1190 number of character formats created
1192 std::vector
<const SwCharFormat
*> m_aRubyCharFormats
;
1194 WW8PostProcessAttrsInfo
* m_pPostProcessAttrsInfo
;
1199 WW8ListManager
* m_pLstManager
;
1200 WW8ScannerBase
* m_pSBase
;
1201 WW8PLCFMan
* m_pPlcxMan
;
1202 std::map
<short, OUString
> m_aLinkStringMap
;
1204 std::set
<const SwNode
*> m_aTextNodesHavingFirstLineOfstSet
; // #i103711#
1205 std::set
<const SwNode
*> m_aTextNodesHavingLeftIndentSet
; // #i105414#
1207 WW8RStyle
* m_pStyles
; // pointer to the style reading class
1208 SwFormat
* m_pAktColl
; // collection to be created now
1209 // ( always 0 outside of a Style-Def )
1210 SfxItemSet
* m_pAktItemSet
;// character attributes to be read in now
1211 // (always 0 outside of the WW8ListManager Ctor)
1212 std::vector
<SwWW8StyInf
> m_vColl
;
1213 const SwTextFormatColl
* m_pDfltTextFormatColl
; // Default
1214 SwFormat
* m_pStandardFormatColl
;// "Standard"
1216 WW8PLCF_HdFt
* m_pHdFt
; // pointer to Header / Footer - scanner class
1218 WW8FlyPara
* m_pWFlyPara
; // WW-parameter
1219 WW8SwFlyPara
* m_pSFlyPara
; // Sw parameters created from previous
1221 WW8TabDesc
* m_pTableDesc
; // description of table properties
1222 //Keep track of tables within tables
1223 std::stack
<WW8TabDesc
*> m_aTableStack
;
1225 ANLDRuleMap m_aANLDRules
;
1226 WW8_OLST
* m_pNumOlst
; // position in text
1228 SdrModel
* m_pDrawModel
;
1230 EditEngine
* m_pDrawEditEngine
;
1231 wwZOrderer
*m_pWWZOrder
;
1233 SwFieldType
* m_pNumFieldType
; // for number circle
1235 SwMSDffManager
* m_pMSDffManager
;
1237 std::vector
<OUString
>* m_pAtnNames
;
1239 std::unique_ptr
<WW8SmartTagData
> m_pSmartTagData
;
1241 sw::util::AuthorInfos m_aAuthorInfos
;
1242 OUString m_sBaseURL
;
1245 sal_uInt32 m_nIniFlags
; // flags from writer.ini
1246 sal_uInt32 m_nIniFlags1
; // dito ( additional flags )
1247 sal_uInt32 m_nFieldFlags
; // dito for fields
1248 sal_uInt32 m_nFieldTagAlways
[3]; // dito for tagging of fields
1249 sal_uInt32 m_nFieldTagBad
[3]; // dito for tagging of fields that can't be imported
1250 bool m_bRegardHindiDigits
; // import digits in CTL scripts as Hindi numbers
1252 bool m_bDrawCpOValid
;
1253 WW8_CP m_nDrawCpO
; // start of Txbx-SubDocs
1255 sal_uLong m_nPicLocFc
; // Picture Location in File (FC)
1256 sal_uLong m_nObjLocFc
; // Object Location in File (FC)
1258 sal_Int32 m_nIniFlyDx
; // X-offset of Flys
1259 sal_Int32 m_nIniFlyDy
; // Y-offset of Flys
1261 rtl_TextEncoding m_eTextCharSet
; // Default charset for Text
1262 rtl_TextEncoding m_eStructCharSet
; // rtl_TextEncoding for structures
1263 rtl_TextEncoding m_eHardCharSet
; // Hard rtl_TextEncoding-Attribute
1264 sal_uInt16 m_nProgress
; // percentage for Progressbar
1265 sal_uInt16 m_nAktColl
; // per WW-count
1266 sal_uInt16 m_nFieldNum
; // serial nummer for that
1267 sal_uInt16 m_nLFOPosition
;
1269 short m_nCharFormat
; // per WW-count, <0 for none
1271 short m_nDrawXOfs
, m_nDrawYOfs
;
1272 short m_nDrawXOfs2
, m_nDrawYOfs2
;
1274 sal_Unicode m_cSymbol
; // symbol to be read now
1276 sal_uInt8 m_nWantedVersion
; // originally requested WW-Doc version by Writer
1278 sal_uInt8 m_nSwNumLevel
; // level number for outline / enumeration
1279 sal_uInt8 m_nWwNumType
; // outline / number / enumeration
1280 sal_uInt8 m_nListLevel
;
1282 bool m_bNewDoc
; // new document?
1283 bool m_bSkipImages
; // skip images for text extraction/indexing
1284 bool m_bReadNoTable
; // no tables
1285 bool m_bPgSecBreak
; // Page- or Sectionbreak is still to be added
1286 bool m_bSpec
; // special char follows in text
1287 bool m_bObj
; // Obj in Text
1288 bool m_bTxbxFlySection
; // FlyFrame that was inserted as replacement for Winword Textbox
1289 bool m_bHasBorder
; // for bundling of the borders
1290 bool m_bSymbol
; // e.g. Symbol instead of Times
1291 bool m_bIgnoreText
; // e.g. for FieldVanish
1292 int m_nInTable
; // are we currently reading a table?
1293 bool m_bWasTabRowEnd
; // table : Row End Mark
1294 bool m_bWasTabCellEnd
; // table: Cell End Mark
1296 bool m_bAnl
; // enumeration in work
1297 // Anl stands for "Autonumber level"
1299 bool m_bHdFtFootnoteEdn
; // special text: header/footer/and so on
1300 bool m_bFootnoteEdn
; // footnote or endnote
1301 bool m_bIsHeader
; // text is read from header ( line height )
1302 bool m_bIsFooter
; // text is read from footer ( line height )
1304 bool m_bIsUnicode
; // current piece of text is encoded as 2-byte Unicode
1305 // please do NOT handle this as bit field!
1307 bool m_bCpxStyle
; // style in the complex part
1308 bool m_bStyNormal
; // style with Id 0 is currently read
1309 bool m_bWWBugNormal
; // WW-Version with Bug Dya in Style Normal
1310 bool m_bNoAttrImport
; // ignore attributes for ignoring styles
1311 bool m_bInHyperlink
; // special case for reading 0x01
1312 // see also: SwWW8ImplReader::Read_F_Hyperlink()
1315 // useful helper variables
1316 bool m_bVer67
; // ( (6 == nVersion) || (7 == nVersion) );
1317 bool m_bVer6
; // (6 == nVersion);
1318 bool m_bVer7
; // (7 == nVersion);
1319 bool m_bVer8
; // (8 == nVersion);
1321 bool m_bEmbeddObj
; // EmbeddField is being read
1323 bool m_bAktAND_fNumberAcross
; // current active Annotated List Deskriptor - ROW flag
1325 bool m_bNoLnNumYet
; // no Line Numbering has been activated yet (we import
1326 // the very 1st Line Numbering and ignore the rest)
1328 bool m_bFirstPara
; // first paragraph?
1329 bool m_bFirstParaOfPage
;
1330 bool m_bParaAutoBefore
;
1331 bool m_bParaAutoAfter
;
1334 sal_Int32 m_nDropCap
;
1338 std::shared_ptr
<SwPaM
> m_pTableEndPaM
;
1339 // Indicate that currently on loading a TOC, managed by Read_F_TOX() and End_Field()
1340 bool m_bLoadingTOXCache
;
1341 int m_nEmbeddedTOXLevel
;
1342 // Indicate that current on loading a hyperlink, which is inside a TOC; Managed by Read_F_Hyperlink() and End_Field()
1343 bool m_bLoadingTOXHyperlink
;
1344 // a document position recorded the after-position of TOC section, managed by Read_F_TOX() and End_Field()
1345 std::unique_ptr
<SwPaM
> m_pPosAfterTOC
;
1346 // used for some dropcap tweaking
1347 SwTextNode
* m_pPreviousNode
;
1349 std::unique_ptr
< SwPosition
> m_pLastAnchorPos
;
1351 bool m_bCareFirstParaEndInToc
;
1352 bool m_bCareLastParaEndInToc
;
1353 cp_set m_aTOXEndCps
;
1355 cp_vector m_aEndParaPos
;
1356 WW8_CP m_aCurrAttrCP
;
1357 bool m_bOnLoadingMain
:1;
1359 const SprmReadInfo
& GetSprmReadInfo(sal_uInt16 nId
) const;
1361 bool StyleExists(unsigned int nColl
) const { return (nColl
< m_vColl
.size()); }
1362 SwWW8StyInf
*GetStyle(sal_uInt16 nColl
) const;
1363 void AppendTextNode(SwPosition
& rPos
);
1365 void Read_HdFt(int nSect
, const SwPageDesc
*pPrev
,
1366 const wwSection
&rSection
);
1367 void Read_HdFtText(WW8_CP nStartCp
, WW8_CP nLen
, SwFrameFormat
* pHdFtFormat
);
1368 void Read_HdFtTextAsHackedFrame(WW8_CP nStart
, WW8_CP nLen
,
1369 SwFrameFormat
&rHdFtFormat
, sal_uInt16 nPageWidth
);
1371 bool isValid_HdFt_CP(WW8_CP nHeaderCP
) const;
1373 bool HasOwnHeaderFooter(sal_uInt8 nWhichItems
, sal_uInt8 grpfIhdt
, int nSect
);
1375 void HandleLineNumbering(const wwSection
&rSection
);
1377 void CopyPageDescHdFt( const SwPageDesc
* pOrgPageDesc
,
1378 SwPageDesc
* pNewPageDesc
, sal_uInt8 nCode
);
1380 void DeleteStack(SwFltControlStack
* prStck
);
1381 void DeleteCtrlStack() { DeleteStack( m_pCtrlStck
); m_pCtrlStck
= nullptr; }
1382 void DeleteRefStacks()
1384 DeleteStack( m_pReffedStck
);
1385 m_pReffedStck
= nullptr;
1386 DeleteStack( m_pReffingStck
);
1387 m_pReffingStck
= nullptr;
1389 void DeleteAnchorStack() { DeleteStack( m_pAnchorStck
); m_pAnchorStck
= nullptr; }
1390 void emulateMSWordAddTextToParagraph(const OUString
& rAddString
);
1391 void simpleAddTextToParagraph(const OUString
& rAddString
);
1392 bool HandlePageBreakChar();
1393 bool ReadChar(long nPosCp
, long nCpOfs
);
1394 bool ReadPlainChars(WW8_CP
& rPos
, sal_Int32 nEnd
, sal_Int32 nCpOfs
);
1395 bool ReadChars(WW8_CP
& rPos
, WW8_CP nNextAttr
, long nTextEnd
, long nCpOfs
);
1396 static bool LangUsesHindiNumbers(sal_uInt16 nLang
);
1397 static sal_Unicode
TranslateToHindiNumbers(sal_Unicode
);
1399 void SetDocumentGrid(SwFrameFormat
&rFormat
, const wwSection
&rSection
);
1401 void ProcessAktCollChange(WW8PLCFManResult
& rRes
, bool* pStartAttr
,
1402 bool bCallProcessSpecial
);
1403 long ReadTextAttr(WW8_CP
& rTextPos
, long nTextEnd
, bool& rbStartLine
);
1404 void ReadAttrs(WW8_CP
& rTextPos
, WW8_CP
& rNext
, long nTextEnd
, bool& rbStartLine
);
1405 void CloseAttrEnds();
1406 bool ReadText(WW8_CP nStartCp
, WW8_CP nTextLen
, ManTypes nType
);
1408 void ReadRevMarkAuthorStrTabl( SvStream
& rStrm
, sal_Int32 nTablePos
,
1409 sal_Int32 nTableSiz
, SwDoc
& rDoc
);
1411 void Read_HdFtFootnoteText(const SwNodeIndex
* pSttIdx
, WW8_CP nStartCp
,
1412 WW8_CP nLen
, ManTypes nType
);
1414 void ImportTox( int nFieldId
, const OUString
& aStr
);
1416 void EndSprm( sal_uInt16 nId
);
1419 void NewAttr( const SfxPoolItem
& rAttr
,
1420 const bool bFirstLineOfStSet
= false,
1421 const bool bLeftIndentSet
= false );
1423 bool GetFontParams(sal_uInt16
, FontFamily
&, OUString
&, FontPitch
&,
1425 bool SetNewFontAttr(sal_uInt16 nFCode
, bool bSetEnums
, sal_uInt16 nWhich
);
1426 void ResetCharSetVars();
1427 void ResetCJKCharSetVars();
1429 const SfxPoolItem
* GetFormatAttr( sal_uInt16 nWhich
);
1430 bool JoinNode(SwPaM
&rPam
, bool bStealAttr
= false);
1432 static bool IsBorder(const WW8_BRCVer9
* pbrc
, bool bChkBtwn
= false);
1434 //Set closest writer border equivalent into rBox from pbrc, optionally
1435 //recording true winword dimensions in pSizeArray. nSetBorders to mark a
1436 //border which has been previously set to a value and for which becoming
1437 //empty is valid. Set bCheBtwn to work with paragraphs that have a special
1438 //between paragraphs border
1440 // Note #i20672# we can't properly support between lines so best to ignore
1442 static bool SetBorder(SvxBoxItem
& rBox
, const WW8_BRCVer9
* pbrc
,
1443 short *pSizeArray
=nullptr, sal_uInt8 nSetBorders
=0xFF);
1444 static void GetBorderDistance(const WW8_BRCVer9
* pbrc
, Rectangle
& rInnerDist
);
1445 static sal_uInt16
GetParagraphAutoSpace(bool fDontUseHTMLAutoSpacing
);
1446 static bool SetShadow(SvxShadowItem
& rShadow
, const short *pSizeArray
,
1447 const WW8_BRCVer9
& aRightBrc
);
1448 //returns true is a shadow was set
1449 static bool SetFlyBordersShadow(SfxItemSet
& rFlySet
, const WW8_BRCVer9
*pbrc
,
1451 static void SetPageBorder(SwFrameFormat
&rFormat
, const wwSection
&rSection
);
1453 static sal_Int32
MatchSdrBoxIntoFlyBoxItem( const Color
& rLineColor
,
1454 MSO_LineStyle eLineStyle
, MSO_LineDashing eDashing
, MSO_SPT eShapeType
, sal_Int32
&rLineWidth
,
1456 void MatchSdrItemsIntoFlySet( SdrObject
* pSdrObj
, SfxItemSet
&aFlySet
,
1457 MSO_LineStyle eLineStyle
, MSO_LineDashing eDashing
, MSO_SPT eShapeType
, Rectangle
&rInnerDist
);
1458 static void AdjustLRWrapForWordMargins(const SvxMSDffImportRec
&rRecord
,
1459 SvxLRSpaceItem
&rLR
);
1460 static void AdjustULWrapForWordMargins(const SvxMSDffImportRec
&rRecord
,
1461 SvxULSpaceItem
&rUL
);
1462 static void MapWrapIntoFlyFormat(SvxMSDffImportRec
* pRecord
, SwFrameFormat
* pFlyFormat
);
1464 void SetAttributesAtGrfNode(SvxMSDffImportRec
const* pRecord
,
1465 SwFrameFormat
*pFlyFormat
, WW8_FSPA
*pF
);
1468 bool IsListOrDropcap() { return (!m_pAktItemSet
|| m_bDropCap
); };
1470 //Apo == Absolutely Positioned Object, MSWord's old-style frames
1471 WW8FlyPara
*ConstructApo(const ApoTestResults
&rApo
,
1472 const WW8_TablePos
*pTabPos
);
1473 bool StartApo(const ApoTestResults
&rApo
, const WW8_TablePos
*pTabPos
);
1475 bool TestSameApo(const ApoTestResults
&rApo
, const WW8_TablePos
*pTabPos
);
1476 ApoTestResults
TestApo(int nCellLevel
, bool bTableRowEnd
,
1477 const WW8_TablePos
*pTabPos
);
1478 static void StripNegativeAfterIndent(SwFrameFormat
*pFlyFormat
);
1481 bool ProcessSpecial(bool &rbReSync
, WW8_CP nStartCp
);
1482 sal_uInt16
TabRowSprm(int nLevel
) const;
1484 bool ReadGrafFile(OUString
& rFileName
, Graphic
*& rpGraphic
,
1485 const WW8_PIC
& rPic
, SvStream
* pSt
, sal_uLong nFilePos
, bool* pDelIt
);
1487 static void ReplaceObj(const SdrObject
&rReplaceTextObj
,
1488 SdrObject
&rSubObj
);
1490 SwFlyFrameFormat
* MakeGrafNotInContent(const WW8PicDesc
& rPD
,
1491 const Graphic
* pGraph
, const OUString
& rFileName
,
1492 const SfxItemSet
& rGrfSet
);
1494 SwFrameFormat
* MakeGrafInContent(const WW8_PIC
& rPic
, const WW8PicDesc
& rPD
,
1495 const Graphic
* pGraph
, const OUString
& rFileName
,
1496 const SfxItemSet
& rGrfSet
);
1498 SwFrameFormat
*AddAutoAnchor(SwFrameFormat
*pFormat
);
1499 SwFrameFormat
* ImportGraf1(WW8_PIC
& rPic
, SvStream
* pSt
, sal_uLong nFilePos
);
1500 SwFrameFormat
* ImportGraf(SdrTextObj
* pTextObj
= nullptr, SwFrameFormat
* pFlyFormat
= nullptr);
1502 SdrObject
* ImportOleBase( Graphic
& rGraph
, const Graphic
* pGrf
=nullptr,
1503 const SfxItemSet
* pFlySet
=nullptr, const Rectangle
& aVisArea
= Rectangle() );
1505 SwFrameFormat
* ImportOle( const Graphic
* = nullptr, const SfxItemSet
* pFlySet
= nullptr,
1506 const SfxItemSet
* pGrfSet
= nullptr, const Rectangle
& aVisArea
= Rectangle() );
1507 SwFlyFrameFormat
* InsertOle(SdrOle2Obj
&rObject
, const SfxItemSet
&rFlySet
,
1508 const SfxItemSet
*rGrfSet
);
1510 bool ImportFormulaControl(WW8FormulaControl
&rBox
,WW8_CP nStart
,
1511 SwWw8ControlType nWhich
);
1515 //This converts MS Asian Typography information into OOo's
1516 void ImportDopTypography(const WW8DopTypography
&rTypo
);
1518 sal_uLong
LoadThroughDecryption(WW8Glossary
*pGloss
);
1519 sal_uLong
SetSubStreams(tools::SvRef
<SotStorageStream
> &rTableStream
, tools::SvRef
<SotStorageStream
> &rDataStream
);
1520 sal_uLong
CoreLoad(WW8Glossary
*pGloss
);
1524 bool StartTable(WW8_CP nStartCp
);
1525 bool InEqualApo(int nLvl
) const;
1526 bool InLocalApo() const { return InEqualApo(m_nInTable
); }
1527 bool InEqualOrHigherApo(int nLvl
) const;
1530 bool IsInvalidOrToBeMergedTabCell() const;
1532 // Enumerations / lists ( Autonumbered List Data Descriptor )
1533 // list: ANLD ( Autonumbered List Data Descriptor )
1534 // one level: ANLV ( Autonumber Level Descriptor )
1537 // lists are separate structures in WW8 that are handled via the following three tables:
1538 // rglst, hpllfo and hsttbListNames
1539 // the corresponding structures are: LSTF, LVLF, LFO LFOLVL
1541 void SetAnlvStrings(SwNumFormat
&rNum
, WW8_ANLV
const &rAV
, const sal_uInt8
* pText
,
1542 size_t nStart
, size_t nElements
, bool bOutline
);
1543 void SetAnld(SwNumRule
* pNumR
, WW8_ANLD
const * pAD
, sal_uInt8 nSwLevel
, bool bOutLine
);
1544 void SetNumOlst( SwNumRule
* pNumR
, WW8_OLST
* pO
, sal_uInt8 nSwLevel
);
1545 SwNumRule
* GetStyRule();
1547 void StartAnl(const sal_uInt8
* pSprm13
);
1548 void NextAnlLine(const sal_uInt8
* pSprm13
);
1549 void StopAllAnl(bool bGoBack
= true);
1550 void StopAnlToRestart(sal_uInt8 nType
, bool bGoBack
= true);
1554 bool ReadGrafStart(void* pData
, short nDataSiz
, WW8_DPHEAD
* pHd
,
1555 SfxAllItemSet
&rSet
);
1556 SdrObject
*ReadLine(WW8_DPHEAD
* pHd
, SfxAllItemSet
&rSet
);
1557 SdrObject
*ReadRect(WW8_DPHEAD
* pHd
, SfxAllItemSet
&rSet
);
1558 SdrObject
*ReadElipse(WW8_DPHEAD
* pHd
, SfxAllItemSet
&rSet
);
1559 SdrObject
*ReadArc(WW8_DPHEAD
* pHd
, SfxAllItemSet
&rSet
);
1560 SdrObject
*ReadPolyLine(WW8_DPHEAD
* pHd
, SfxAllItemSet
&rSet
);
1561 void InsertTxbxStyAttrs( SfxItemSet
& rS
, sal_uInt16 nColl
);
1562 void InsertAttrsAsDrawingAttrs(long nStartCp
, long nEndCp
, ManTypes eType
, bool bONLYnPicLocFc
=false);
1564 bool GetTxbxTextSttEndCp(WW8_CP
& rStartCp
, WW8_CP
& rEndCp
, sal_uInt16 nTxBxS
,
1565 sal_uInt16 nSequence
);
1566 sal_Int32
GetRangeAsDrawingString(OUString
& rString
, long StartCp
, long nEndCp
, ManTypes eType
);
1567 OutlinerParaObject
* ImportAsOutliner(OUString
&rString
, WW8_CP nStartCp
, WW8_CP nEndCp
, ManTypes eType
);
1568 void InsertTxbxText(SdrTextObj
* pTextObj
, Size
* pObjSiz
,
1569 sal_uInt16 nTxBxS
, sal_uInt16 nSequence
, long nPosCp
, SwFrameFormat
* pFlyFormat
,
1570 bool bMakeSdrGrafObj
, bool& rbEraseTextObj
,
1571 bool* pbTestTxbxContainsText
= nullptr, long* pnStartCp
= nullptr,
1572 long* pnEndCp
= nullptr, bool* pbContainsGraphics
= nullptr,
1573 SvxMSDffImportRec
* pRecord
= nullptr);
1574 bool TxbxChainContainsRealText( sal_uInt16 nTxBxS
,
1577 SdrObject
*ReadTextBox(WW8_DPHEAD
* pHd
, SfxAllItemSet
&rSet
);
1578 SdrObject
*ReadCaptionBox(WW8_DPHEAD
* pHd
, SfxAllItemSet
&rSet
);
1579 SdrObject
*ReadGroup(WW8_DPHEAD
* pHd
, SfxAllItemSet
&rSet
);
1580 SdrObject
*ReadGrafPrimitive(short& rLeft
, SfxAllItemSet
&rSet
);
1581 void ReadGrafLayer1( WW8PLCFspecial
* pPF
, long nGrafAnchorCp
);
1582 SdrObject
* CreateContactObject(SwFrameFormat
* pFlyFormat
);
1583 RndStdIds
ProcessEscherAlign(SvxMSDffImportRec
* pRecord
, WW8_FSPA
*pFSPA
,
1584 SfxItemSet
&rFlySet
, bool bOrgObjectWasReplace
);
1585 bool MiserableRTLGraphicsHack(SwTwips
&rLeft
, SwTwips nWidth
,
1586 sal_Int16 eHoriOri
, sal_Int16 eHoriRel
);
1587 SwFrameFormat
* Read_GrafLayer( long nGrafAnchorCp
);
1588 SwFlyFrameFormat
* ImportReplaceableDrawables( SdrObject
* &rpObject
,
1589 SdrObject
* &rpOurNewObject
, SvxMSDffImportRec
* pRecord
, WW8_FSPA
*pF
,
1590 SfxItemSet
&rFlySet
);
1591 SwFlyFrameFormat
*ConvertDrawTextToFly( SdrObject
* &rpObject
,
1592 SdrObject
* &rpOurNewObject
, SvxMSDffImportRec
* pRecord
,
1593 RndStdIds eAnchor
, WW8_FSPA
*pF
, SfxItemSet
&rFlySet
);
1594 SwFrameFormat
* MungeTextIntoDrawBox(SdrObject
* pTrueObject
,
1595 SvxMSDffImportRec
*pRecord
, long nGrafAnchorCp
, SwFrameFormat
*pRetFrameFormat
);
1601 OUString
GetFieldResult( WW8FieldDesc
* pF
);
1602 void MakeTagString( OUString
& rStr
, const OUString
& rOrg
);
1603 void UpdateFields();
1604 OUString
ConvertFFileName(const OUString
& rRaw
);
1605 long Read_F_Tag( WW8FieldDesc
* pF
);
1606 void InsertTagField( const sal_uInt16 nId
, const OUString
& rTagText
);
1607 long ImportExtSprm(WW8PLCFManResult
* pRes
);
1608 void EndExtSprm(sal_uInt16 nSprmId
);
1613 void RegisterNumFormatOnTextNode(sal_uInt16 nActLFO
, sal_uInt8 nActLevel
,
1614 const bool bSetAttr
= true);
1616 void RegisterNumFormatOnStyle(sal_uInt16 nStyle
);
1617 void SetStylesList(sal_uInt16 nStyle
, sal_uInt16 nActLFO
,
1618 sal_uInt8 nActLevel
);
1619 void RegisterNumFormat(sal_uInt16 nActLFO
, sal_uInt8 nActLevel
);
1621 // to be replaced by calls in the appropriate extended SvxMSDffManager
1623 const OUString
* GetAnnotationAuthor(sal_uInt16 nIdx
);
1625 void GetSmartTagInfo(SwFltRDFMark
& rMark
);
1627 // interfaces for the toggle attributes
1628 void SetToggleAttr(sal_uInt8 nAttrId
, bool bOn
);
1629 void SetToggleBiDiAttr(sal_uInt8 nAttrId
, bool bOn
);
1630 void ChkToggleAttr_( sal_uInt16 nOldStyle81Mask
, sal_uInt16 nNewStyle81Mask
);
1632 void ChkToggleAttr( sal_uInt16 nOldStyle81Mask
, sal_uInt16 nNewStyle81Mask
)
1634 if( nOldStyle81Mask
!= nNewStyle81Mask
&&
1635 m_pCtrlStck
->GetToggleAttrFlags() )
1636 ChkToggleAttr_( nOldStyle81Mask
, nNewStyle81Mask
);
1639 void ChkToggleBiDiAttr_( sal_uInt16 nOldStyle81Mask
, sal_uInt16 nNewStyle81Mask
);
1641 void ChkToggleBiDiAttr( sal_uInt16 nOldStyle81Mask
, sal_uInt16 nNewStyle81Mask
)
1643 if( nOldStyle81Mask
!= nNewStyle81Mask
&&
1644 m_pCtrlStck
->GetToggleBiDiAttrFlags() )
1645 ChkToggleBiDiAttr_( nOldStyle81Mask
, nNewStyle81Mask
);
1648 void PopTableDesc();
1649 void MoveInsideFly(const SwFrameFormat
*pFlyFormat
);
1650 SwTwips
MoveOutsideFly(SwFrameFormat
*pFlyFormat
, const SwPosition
&rPos
,
1651 bool bTableJoin
= true);
1653 void SetOutlineStyles();
1655 bool SetSpacing(SwPaM
&rMyPam
, int nSpace
, bool bIsUpper
);
1656 bool SetUpperSpacing(SwPaM
&pMyPam
, int nSpace
);
1657 bool SetLowerSpacing(SwPaM
&rMyPam
, int nSpace
);
1659 bool IsInlineEscherHack() const
1660 { return !m_aFieldStack
.empty() && m_aFieldStack
.back().mnFieldId
== 95; };
1662 void StoreMacroCmds();
1665 // determine object attribute "Layout in Table Cell"
1666 bool IsObjectLayoutInTableCell( const sal_uInt32 nLayoutInTableCell
) const;
1667 void ReadGlobalTemplateSettings( const OUString
& sCreatedFrom
, const css::uno::Reference
< css::container::XNameContainer
>& xPrjNameMap
);
1668 SwWW8ImplReader(const SwWW8ImplReader
&) = delete;
1669 SwWW8ImplReader
& operator=(const SwWW8ImplReader
&) = delete;
1670 public: // really private, but can only be done public
1671 sal_uInt16
GetToggleAttrFlags() const;
1672 sal_uInt16
GetToggleBiDiAttrFlags() const;
1673 void SetToggleAttrFlags(sal_uInt16 nFlags
);
1674 void SetToggleBiDiAttrFlags(sal_uInt16 nFlags
);
1675 WW8_CP
GetCurrAttrCP() const {return m_aCurrAttrCP
;}
1676 bool IsParaEndInCPs(sal_Int32
, sal_Int32
,bool bSdOD
=true) const;
1677 //Clear the para end position recorded in reader intermittently for the least impact on loading performance
1678 void ClearParaEndPosition();
1680 long Read_Footnote(WW8PLCFManResult
* pRes
);
1681 sal_uInt16
End_Footnote();
1682 long Read_Field(WW8PLCFManResult
* pRes
);
1683 sal_uInt16
End_Field();
1684 long Read_Book(WW8PLCFManResult
*);
1685 long Read_And(WW8PLCFManResult
* pRes
);
1686 long Read_AtnBook(WW8PLCFManResult
*);
1687 long Read_FactoidBook(WW8PLCFManResult
*);
1691 void Read_Special(sal_uInt16
, const sal_uInt8
*, short nLen
);
1692 void Read_Obj(sal_uInt16
, const sal_uInt8
*, short nLen
);
1693 void Read_PicLoc(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1694 void Read_BoldUsw(sal_uInt16 nId
, const sal_uInt8
*, short nLen
);
1695 void Read_Bidi(sal_uInt16 nId
, const sal_uInt8
*, short nLen
);
1696 void Read_BoldBiDiUsw(sal_uInt16 nId
, const sal_uInt8
*, short nLen
);
1697 void Read_AmbiguousSPRM(sal_uInt16 nId
, const sal_uInt8
*, short nLen
);
1698 void Read_SubSuper( sal_uInt16
, const sal_uInt8
*, short nLen
);
1699 bool ConvertSubToGraphicPlacement();
1700 static SwFrameFormat
*ContainsSingleInlineGraphic(const SwPaM
&rRegion
);
1701 void Read_SubSuperProp( sal_uInt16
, const sal_uInt8
*, short nLen
);
1702 void Read_Underline( sal_uInt16
, const sal_uInt8
*, short nLen
);
1703 void Read_TextColor( sal_uInt16
, const sal_uInt8
*, short nLen
);
1704 void openFont(sal_uInt16 nFCode
, sal_uInt16 nId
);
1705 void closeFont(sal_uInt16 nId
);
1706 void Read_FontCode( sal_uInt16
, const sal_uInt8
*, short nLen
);
1707 void Read_FontSize( sal_uInt16
, const sal_uInt8
*, short nLen
);
1708 void Read_CharSet(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1709 void Read_Language( sal_uInt16
, const sal_uInt8
*, short nLen
);
1710 void Read_CColl( sal_uInt16
, const sal_uInt8
*, short nLen
);
1711 void Read_Kern( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1712 void Read_FontKern( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1713 void Read_Emphasis( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1714 void Read_ScaleWidth( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1715 void Read_Relief( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1716 void Read_TextAnim( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1718 void Read_NoLineNumb( sal_uInt16 nId
, const sal_uInt8
* pData
, short nLen
);
1720 void Read_LR( sal_uInt16 nId
, const sal_uInt8
*, short nLen
);
1721 void Read_UL( sal_uInt16 nId
, const sal_uInt8
*, short nLen
);
1722 void Read_ParaAutoBefore(sal_uInt16
, const sal_uInt8
*pData
, short nLen
);
1723 void Read_ParaAutoAfter(sal_uInt16
, const sal_uInt8
*pData
, short nLen
);
1724 void Read_ParaContextualSpacing( sal_uInt16 nId
, const sal_uInt8
* pData
, short nLen
);
1725 void Read_LineSpace( sal_uInt16
, const sal_uInt8
*, short nLen
);
1726 void Read_Justify(sal_uInt16
, const sal_uInt8
*, short nLen
);
1727 void Read_IdctHint(sal_uInt16
, const sal_uInt8
*, short nLen
);
1728 bool IsRightToLeft();
1729 void Read_RTLJustify(sal_uInt16
, const sal_uInt8
*, short nLen
);
1730 void Read_Hyphenation( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1731 void Read_WidowControl( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1732 void Read_AlignFont( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1733 void Read_UsePgsuSettings( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1734 void Read_KeepLines( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1735 void Read_KeepParas( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1736 void Read_BreakBefore( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1737 void Read_ApoPPC(sal_uInt16
, const sal_uInt8
* pData
, short);
1739 void Read_BoolItem( sal_uInt16 nId
, const sal_uInt8
*, short nLen
);
1741 void Read_Border( sal_uInt16 nId
, const sal_uInt8
* pData
, short nLen
);
1742 void Read_CharBorder(sal_uInt16 nId
, const sal_uInt8
* pData
, short nLen
);
1743 void Read_Tab( sal_uInt16 nId
, const sal_uInt8
* pData
, short nLen
);
1744 void Read_Symbol(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1745 void Read_FieldVanish( sal_uInt16 nId
, const sal_uInt8
* pData
, short nLen
);
1747 // Revision Marks ( == Redlining )
1749 // insert or delete content (change char attributes resp.)
1750 void Read_CRevisionMark(RedlineType_t eType
, const sal_uInt8
* pData
, short nLen
);
1751 // insert new content
1752 void Read_CFRMark(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1753 // delete old content
1754 void Read_CFRMarkDel(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1755 // change properties of content (e.g. char formatting)
1756 void Read_CPropRMark(sal_uInt16
, const sal_uInt8
* pData
, short nLen
); // complex!
1758 void Read_TabRowEnd( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1759 void Read_TabCellEnd( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1760 bool ParseTabPos(WW8_TablePos
*aTabPos
, WW8PLCFx_Cp_FKP
* pPap
);
1761 void Read_Shade( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1762 void Read_ANLevelNo( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1763 void Read_ANLevelDesc( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1765 // outline level Ver8
1766 void Read_POutLvl(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1768 void Read_OLST( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1770 void Read_CharShadow( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1771 void Read_CharHighlight( sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1774 void Read_ListLevel( sal_uInt16 nId
, const sal_uInt8
* pData
, short nLen
);
1777 * read and interpret the sprmPIlfo used to determine which list
1778 * contains the paragraph.
1779 * @param nId unused (sprm value, 0x460b for sprmPIlfo).
1780 * @param[in] pData operand.
1781 * @param[in] nLen size of the operand (pData) in byte, should be 2.
1782 * -1 to indicate the actual level is finished.
1784 void Read_LFOPosition( sal_uInt16 nId
, const sal_uInt8
* pData
, short nLen
);
1785 bool SetTextFormatCollAndListLevel(const SwPaM
& rRg
, SwWW8StyInf
& rStyleInfo
);
1787 void Read_StyleCode(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1788 void Read_Majority(sal_uInt16
, const sal_uInt8
* , short );
1789 void Read_DoubleLine_Rotate( sal_uInt16
, const sal_uInt8
* pDATA
, short nLen
);
1791 void Read_TextForeColor(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1792 void Read_TextBackColor(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1793 void Read_ParaBackColor(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1794 void Read_ParaBiDi(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1795 static sal_uInt32
ExtractColour(const sal_uInt8
* &rpData
, bool bVer67
);
1797 void Read_TextVerticalAdjustment(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1798 void Read_UnderlineColor(sal_uInt16
, const sal_uInt8
* pData
, short nLen
);
1799 long MapBookmarkVariables(const WW8FieldDesc
* pF
, OUString
&rOrigName
,
1800 const OUString
&rData
);
1801 OUString
GetMappedBookmark(const OUString
&rOrigName
);
1804 eF_ResT
Read_F_Input(WW8FieldDesc
*, OUString
& rStr
);
1805 eF_ResT
Read_F_InputVar(WW8FieldDesc
*, OUString
& rStr
);
1806 eF_ResT
Read_F_ANumber( WW8FieldDesc
*, OUString
& );
1807 eF_ResT
Read_F_DocInfo( WW8FieldDesc
* pF
, OUString
& rStr
);
1808 eF_ResT
Read_F_Author( WW8FieldDesc
*, OUString
& );
1809 eF_ResT
Read_F_TemplName( WW8FieldDesc
*, OUString
& );
1810 short GetTimeDatePara(OUString
& rStr
, sal_uInt32
& rFormat
, sal_uInt16
&rLang
,
1811 int nWhichDefault
, bool bHijri
= false);
1812 bool ForceFieldLanguage(SwField
&rField
, sal_uInt16 nLang
);
1813 eF_ResT
Read_F_DateTime( WW8FieldDesc
*, OUString
& rStr
);
1814 eF_ResT
Read_F_FileName( WW8FieldDesc
*, OUString
& rStr
);
1815 eF_ResT
Read_F_Num( WW8FieldDesc
* pF
, OUString
& );
1816 eF_ResT
Read_F_CurPage( WW8FieldDesc
*, OUString
& );
1817 eF_ResT
Read_F_Ref( WW8FieldDesc
* pF
, OUString
& );
1819 eF_ResT
Read_F_Set( WW8FieldDesc
*, OUString
& rStr
);
1820 eF_ResT
Read_F_PgRef( WW8FieldDesc
*, OUString
& rStr
);
1821 eF_ResT
Read_F_NoteReference( WW8FieldDesc
* pF
, OUString
& rStr
);
1823 eF_ResT
Read_F_Tox( WW8FieldDesc
* pF
, OUString
& rStr
);
1824 eF_ResT
Read_F_Symbol( WW8FieldDesc
*, OUString
& rStr
);
1825 eF_ResT
Read_F_Embedd( WW8FieldDesc
*, OUString
& rStr
);
1826 eF_ResT
Read_F_FormTextBox( WW8FieldDesc
* pF
, OUString
& rStr
);
1827 eF_ResT
Read_F_FormCheckBox( WW8FieldDesc
* pF
, OUString
& rStr
);
1828 eF_ResT
Read_F_FormListBox( WW8FieldDesc
* pF
, OUString
& rStr
);
1829 css::awt::Size
MiserableDropDownFormHack(const OUString
&rString
,
1830 css::uno::Reference
<css::beans::XPropertySet
>& rPropSet
);
1832 eF_ResT
Read_F_Macro( WW8FieldDesc
*, OUString
& rStr
);
1833 eF_ResT
Read_F_DBField( WW8FieldDesc
*, OUString
& rStr
);
1834 eF_ResT
Read_F_DBNext( WW8FieldDesc
*, OUString
& );
1835 eF_ResT
Read_F_DBNum( WW8FieldDesc
*, OUString
& );
1836 eF_ResT
Read_F_Equation( WW8FieldDesc
*, OUString
& );
1837 void Read_SubF_Ruby( msfilter::util::WW8ReadFieldParams
& rReadParam
);
1838 eF_ResT
Read_F_IncludePicture( WW8FieldDesc
*, OUString
& rStr
);
1839 eF_ResT
Read_F_IncludeText( WW8FieldDesc
*, OUString
& rStr
);
1840 eF_ResT
Read_F_Seq( WW8FieldDesc
*, OUString
& rStr
);
1841 /// Reads a STYLEREF field.
1842 eF_ResT
Read_F_Styleref(WW8FieldDesc
*, OUString
& rStr
);
1844 eF_ResT
Read_F_OCX(WW8FieldDesc
*, OUString
&);
1845 eF_ResT
Read_F_Hyperlink(WW8FieldDesc
*, OUString
& rStr
);
1846 eF_ResT
Read_F_Shape(WW8FieldDesc
* pF
, OUString
& rStr
);
1847 eF_ResT
Read_F_HTMLControl( WW8FieldDesc
* pF
, OUString
& rStr
);
1849 void DeleteFormImpl();
1851 short ImportSprm(const sal_uInt8
* pPos
, sal_Int32 nMemLen
, sal_uInt16 nId
= 0);
1853 bool SearchRowEnd(WW8PLCFx_Cp_FKP
* pPap
,WW8_CP
&rStartCp
, int nLevel
) const;
1854 /// Seek to the end of the table with pPap, returns true on success.
1855 bool SearchTableEnd(WW8PLCFx_Cp_FKP
* pPap
) const;
1856 bool FloatingTableConversion(WW8PLCFx_Cp_FKP
* pPap
);
1858 const WW8Fib
& GetFib() const { return *m_pWwFib
; }
1859 SwDoc
& GetDoc() const { return m_rDoc
; }
1860 sal_uInt16
GetNAktColl() const { return m_nAktColl
; }
1861 void SetNAktColl( sal_uInt16 nColl
) { m_nAktColl
= nColl
; }
1862 void SetAktItemSet( SfxItemSet
* pItemSet
) { m_pAktItemSet
= pItemSet
; }
1863 sal_uInt16
StyleUsingLFO( sal_uInt16 nLFOIndex
) const ;
1864 const SwFormat
* GetStyleWithOrgWWName( OUString
& rName
) const ;
1866 static bool GetPictGrafFromStream(Graphic
& rGraphic
, SvStream
& rSrc
);
1867 static void PicRead( SvStream
*pDataStream
, WW8_PIC
*pPic
, bool bVer67
);
1868 static bool ImportOleWMF( tools::SvRef
<SotStorage
> xSrc1
, GDIMetaFile
&rWMF
,
1869 long &rX
, long &rY
);
1870 static ColorData
GetCol(sal_uInt8 nIco
);
1872 SwWW8ImplReader( sal_uInt8 nVersionPara
, SotStorage
* pStorage
, SvStream
* pSt
,
1873 SwDoc
& rD
, const OUString
& rBaseURL
, bool bNewDoc
, bool bSkipImages
, SwPosition
&rPos
);
1875 const OUString
& GetBaseURL() const { return m_sBaseURL
; }
1876 // load a complete doc file
1877 sal_uLong
LoadDoc(WW8Glossary
*pGloss
=nullptr);
1878 rtl_TextEncoding
GetCurrentCharSet();
1879 rtl_TextEncoding
GetCurrentCJKCharSet();
1880 rtl_TextEncoding
GetCharSetFromLanguage();
1881 rtl_TextEncoding
GetCJKCharSetFromLanguage();
1883 void PostProcessAttrs();
1884 static void ReadEmbeddedData(SvMemoryStream
& rStrm
, SwDocShell
* pDocShell
, struct HyperLinksTable
& hlStr
);
1885 static OUString
ReadRawUniString(SvMemoryStream
& rStrm
, sal_uInt16 nChars
, bool b16Bit
);
1888 bool CanUseRemoteLink(const OUString
&rGrfName
);
1889 void UseListIndent(SwWW8StyInf
&rStyle
, const SwNumFormat
&rFormat
);
1890 void SetStyleIndent(SwWW8StyInf
&rStyleInfo
, const SwNumFormat
&rFormat
);
1893 void SyncIndentWithList( SvxLRSpaceItem
&rLR
,
1894 const SwNumFormat
&rFormat
,
1895 const bool bFirstLineOfStSet
,
1896 const bool bLeftIndentSet
);
1897 long GetListFirstLineIndent(const SwNumFormat
&rFormat
);
1898 OUString
BookmarkToWriter(const OUString
&rBookmark
);
1899 bool RTLGraphicsHack(SwTwips
&rLeft
, SwTwips nWidth
,
1900 sal_Int16 eHoriOri
, sal_Int16 eHoriRel
, SwTwips nPageLeft
,
1901 SwTwips nPageRight
, SwTwips nPageSize
);
1902 void MatchEscherMirrorIntoFlySet(const SvxMSDffImportRec
&rRecord
,
1903 SfxItemSet
&rFlySet
);
1904 bool RTLDrawingsHack(long &rLeft
, long nWidth
,
1905 sal_Int16 eHoriOri
, sal_Int16 eHoriRel
, SwTwips nPageLeft
,
1906 SwTwips nPageRight
, SwTwips nPageSize
);
1909 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */