1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ww8par.hxx,v $
10 * $Revision: 1.159.12.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
35 #include <tools/string.hxx>
36 #include <svx/msdffimp.hxx>
37 #include <svx/msocximex.hxx>
38 #include <svx/frmdir.hxx>
39 #include <fltshell.hxx> // fuer den Attribut Stack
41 #ifndef __SGI_STL_VECTOR
44 #ifndef __SGI_STL_STACK
47 #ifndef __SGI_STL_DEQUE
53 #ifndef __SGI_STL_UTILITY
58 #include "ww8struc.hxx" // WW8_BRC
59 #include "ww8scan.hxx" // WW8Fib
60 #include "ww8glsy.hxx"
62 #include "../inc/msfilter.hxx"
63 #include <ecmaflds.hxx>
83 struct WW8PLCFManResult
;
113 // alt: class SvStorageRef;
118 class _ReadFieldParams
;
120 class OutlinerParaObject
;
122 namespace com
{namespace sun
{namespace star
{
123 namespace beans
{ class XPropertySet
;}
124 namespace form
{ class XFormComponent
;}
125 namespace drawing
{class XShape
;}
126 namespace lang
{class XMultiServiceFactory
;}
129 // defines nur fuer die WW8-variable der INI-Datei
130 #define WW8FL_NO_TEXT 1
131 #define WW8FL_NO_STYLES 2
132 #define WW8FL_NO_ZSTYLES 4 // keine Zeichenstyles importieren
133 #define WW8FL_NO_GRAF 0x80
135 // falls gestetzt, werden fuer Writer-Def-Styles neue Styles mit den
136 // WW8-Def-Style-Eigenschaften erzeugt, statt die Writer-Standards zu
138 #define WW8FL_NO_DEFSTYLES 0x400
140 #define WW8FL_NO_OUTLINE 0x1000
141 #define WW8FL_NO_IMPLPASP 0x4000 // no implicit para space
142 #define WW8FL_NO_GRAFLAYER 0x8000
144 // Zusatz-Filter-Flags, gueltig ab Winword 8
145 #define WW8FL_NO_FLY_FOR_TXBX 1
147 //-----------------------------------------
148 // Listen-Manager (ab Ver8)
149 //-----------------------------------------
152 typedef WW8LFOInfo
* WW8LFOInfo_Ptr
;
153 // Redlining: match WinWord author ids to StarWriter author ids
155 typedef WW8OleMap
* WW8OleMap_Ptr
;
157 SV_DECL_PTRARR_DEL(WW8LFOInfos
,WW8LFOInfo_Ptr
,16,16)
158 // SV_DECL_PTRARR_SORT_DEL(WW8AuthorInfos, WW8AuthorInfo_Ptr,16,16)
159 SV_DECL_PTRARR_SORT_DEL(WW8OleMaps
, WW8OleMap_Ptr
,16,16)
161 class WW8Reader
: public StgReader
163 virtual ULONG
Read(SwDoc
&, const String
& rBaseURL
, SwPaM
&,const String
&);
165 virtual int GetReaderType();
167 virtual BOOL
HasGlossaries() const;
168 virtual BOOL
ReadGlossaries( SwTextBlocks
&, BOOL bSaveRelFiles
) const;
174 String msStorageName
;
176 WW8OleMap(sal_uInt32 nWWid
)
179 WW8OleMap(sal_uInt32 nWWid
, String sStorageName
)
180 : mnWWid(nWWid
), msStorageName(sStorageName
) {}
182 bool operator==(const WW8OleMap
& rEntry
) const
184 return (mnWWid
== rEntry
.mnWWid
);
186 bool operator<(const WW8OleMap
& rEntry
) const
188 return (mnWWid
< rEntry
.mnWWid
);
192 class SwWW8ImplReader
;
197 WW8ListManager(SvStream
& rSt_
, SwWW8ImplReader
& rReader_
);
198 //Min and Max possible List Levels in Word
199 enum ListLevel
{nMinLevel
=1, nMaxLevel
=9};
200 //the rParaSprms returns back the original word paragraph indent
201 //sprms which were attached to the original numbering format
202 SwNumRule
* GetNumRuleForActivation(USHORT nLFOPosition
, const BYTE nLevel
,
203 std::vector
<sal_uInt8
> &rParaSprms
, SwTxtNode
*pNode
=0);
204 SwNumRule
* CreateNextRule(bool bSimple
);
207 wwSprmParser maSprmParser
;
208 SwWW8ImplReader
& rReader
;
212 std::vector
<WW8LSTInfo
* > maLSTInfos
;
213 WW8LFOInfos
* pLFOInfos
;// D. aus PLF LFO, sortiert genau wie im WW8 Stream
214 USHORT nUniqueList
; // current number for creating unique list names
215 BYTE
* GrpprlHasSprm(USHORT nId
, BYTE
& rSprms
, BYTE nLen
);
216 WW8LSTInfo
* GetLSTByListId( sal_uInt32 nIdLst
) const;
217 //the rParaSprms returns back the original word paragraph indent
218 //sprms which are attached to this numbering level
219 bool ReadLVL(SwNumFmt
& rNumFmt
, SfxItemSet
*& rpItemSet
, USHORT nLevelStyle
,
220 bool bSetStartNo
, std::deque
<bool> &rNotReallyThere
, sal_uInt16 nLevel
,
221 std::vector
<sal_uInt8
> &rParaSprms
);
223 // Zeichenattribute aus GrpprlChpx
224 typedef SfxItemSet
* WW8aISet
[nMaxLevel
];
225 // Zeichen Style Pointer
226 typedef SwCharFmt
* WW8aCFmt
[nMaxLevel
];
228 void AdjustLVL(BYTE nLevel
, SwNumRule
& rNumRule
, WW8aISet
& rListItemSet
,
229 WW8aCFmt
& aCharFmt
, bool& bNewCharFmtCreated
,
230 String aPrefix
= aEmptyStr
);
233 WW8ListManager(const WW8ListManager
&);
234 WW8ListManager
& operator=(const WW8ListManager
&);
235 sal_uInt16 nLastLFOPosition
;
238 //-----------------------------------------
240 //-----------------------------------------
241 class SwWW8FltControlStack
: public SwFltControlStack
244 SwWW8ImplReader
& rReader
;
245 USHORT nToggleAttrFlags
;
246 USHORT nToggleBiDiAttrFlags
;
248 SwWW8FltControlStack(const SwWW8FltControlStack
&);
249 SwWW8FltControlStack
& operator=(const SwWW8FltControlStack
&);
250 const SwNumFmt
* GetNumFmtFromStack(const SwPosition
&rPos
,
251 const SwTxtNode
&rTxtNode
);
253 virtual void SetAttrInDoc(const SwPosition
& rTmpPos
,
254 SwFltStackEntry
* pEntry
);
257 SwWW8FltControlStack(SwDoc
* pDo
, ULONG nFieldFl
, SwWW8ImplReader
& rReader_
)
258 : SwFltControlStack( pDo
, nFieldFl
), rReader( rReader_
),
259 nToggleAttrFlags(0), nToggleBiDiAttrFlags(0)
262 void NewAttr(const SwPosition
& rPos
, const SfxPoolItem
& rAttr
);
264 virtual void SetAttr(const SwPosition
& rPos
, USHORT nAttrId
=0, BOOL bTstEnde
=TRUE
, long nHand
=LONG_MAX
, BOOL consumedByField
=FALSE
);
266 void SetToggleAttr(BYTE nId
, bool bOn
)
269 nToggleAttrFlags
|= (1 << nId
);
271 nToggleAttrFlags
&= ~(1 << nId
);
274 USHORT
GetToggleAttrFlags() const { return nToggleAttrFlags
; }
276 void SetToggleBiDiAttr(BYTE nId
, bool bOn
)
279 nToggleBiDiAttrFlags
|= (1 << nId
);
281 nToggleBiDiAttrFlags
&= ~(1 << nId
);
284 USHORT
GetToggleBiDiAttrFlags() const { return nToggleBiDiAttrFlags
; }
285 void SetToggleAttrFlags(USHORT nFlags
) { nToggleAttrFlags
= nFlags
; }
286 void SetToggleBiDiAttrFlags(USHORT nFlags
) {nToggleBiDiAttrFlags
= nFlags
;}
288 const SfxPoolItem
* GetFmtAttr(const SwPosition
& rPos
, USHORT nWhich
);
289 const SfxPoolItem
* GetStackAttr(const SwPosition
& rPos
, USHORT nWhich
);
292 //The only thing this is for is RES_FLTR_ANCHOR, anything else is an error.
293 //For graphics whose anchoring position would otherwise be automatically moved
294 //along by the insertion of text.
295 class SwWW8FltAnchorStack
: public SwFltControlStack
298 SwWW8FltAnchorStack(SwDoc
* pDo
, ULONG nFieldFl
)
299 : SwFltControlStack( pDo
, nFieldFl
) {}
300 void AddAnchor(const SwPosition
& rPos
,SwFrmFmt
*pFmt
);
304 SwWW8FltAnchorStack(const SwWW8FltAnchorStack
&);
305 SwWW8FltAnchorStack
& operator=(const SwWW8FltAnchorStack
&);
308 //For fields whose handling cannot be fully resolved until we hit the end of
313 SwNodeIndex maMkNode
;
314 SwNodeIndex maPtNode
;
315 xub_StrLen mnMkCntnt
;
316 xub_StrLen mnPtCntnt
;
317 Position(const SwPaM
&rPaM
);
318 Position(const Position
&rEntry
);
321 Position
& operator=(const Position
&);
324 class SwWW8FltRefStack
: public SwFltEndStack
327 SwWW8FltRefStack(SwDoc
* pDo
, ULONG nFieldFl
)
328 : SwFltEndStack( pDo
, nFieldFl
)
330 bool IsFtnEdnBkmField(const SwFmtFld
& rFmtFld
, USHORT
& rBkmNo
);
334 bool operator()(const String
&r1
, const String
&r2
) const
336 return r1
.CompareIgnoreCaseToAscii(r2
) == COMPARE_LESS
;
339 //Keep track of variable names created with fields, and the bookmark
340 //mapped to their position, hopefully the same, but very possibly
341 //an additional pseudo bookmark
342 std::map
<String
, String
, ltstr
> aFieldVarNames
;
344 SwFltStackEntry
*RefToVar(const SwField
* pFld
,SwFltStackEntry
*pEntry
);
345 virtual void SetAttrInDoc(const SwPosition
& rTmpPos
,
346 SwFltStackEntry
* pEntry
);
349 SwWW8FltRefStack(const SwWW8FltRefStack
&);
350 SwWW8FltRefStack
& operator=(const SwWW8FltRefStack
&);
361 SwNodeIndex maPtNode
;
362 xub_StrLen mnPtCntnt
;
364 Position(const SwPosition
&rPos
);
365 Position(const Position
&rPos
);
366 operator SwPosition() const;
367 SwNodeIndex
GetPtNode() { return maPtNode
; };
368 xub_StrLen
GetPtCntnt() { return mnPtCntnt
; };
376 typedef ::std::vector
<sw::mark::IFieldmark::ParamPair_t
> Params_t
;
379 ::rtl::OUString msBookmarkName
;
380 ::rtl::OUString msMarkType
;
384 sw::hack::Position maStartPos
;
385 sal_uInt16 mnFieldId
;
386 FieldEntry(SwPosition
&rPos
, sal_uInt16 nFieldId
) throw();
387 FieldEntry(const FieldEntry
&rOther
) throw();
388 FieldEntry
&operator=(const FieldEntry
&rOther
) throw();
389 void Swap(FieldEntry
&rOther
) throw();
391 SwNodeIndex
GetPtNode() { return maStartPos
.GetPtNode(); };
392 xub_StrLen
GetPtCntnt() { return maStartPos
.GetPtCntnt(); };
394 ::rtl::OUString
GetBookmarkName();
395 ::rtl::OUString
GetBookmarkType();
396 void SetBookmarkName(::rtl::OUString bookmarkName
);
397 void SetBookmarkType(::rtl::OUString bookmarkType
);
398 void AddParam(::rtl::OUString name
, ::rtl::OUString value
);
399 Params_t
&getParams();
403 //-----------------------------------------
404 // Mini-Merker fuer einige Flags
405 //-----------------------------------------
409 WW8PLCFxSaveAll maPLCFxSave
;
411 std::deque
<bool> maOldApos
;
412 std::deque
<FieldEntry
> maOldFieldStack
;
413 SwWW8FltControlStack
* mpOldStck
;
414 SwWW8FltAnchorStack
* mpOldAnchorStck
;
415 sw::util::RedlineStack
*mpOldRedlines
;
416 WW8PLCFMan
* mpOldPlcxMan
;
417 WW8FlyPara
* mpWFlyPara
;
418 WW8SwFlyPara
* mpSFlyPara
;
419 SwPaM
* mpPreviousNumPaM
;
420 const SwNumRule
* mpPrevNumRule
;
421 WW8TabDesc
* mpTableDesc
;
424 sal_Unicode mcSymbol
;
428 bool mbTxbxFlySection
;
436 WW8ReaderSave(SwWW8ImplReader
* pRdr
, WW8_CP nStart
=-1);
437 void Restore(SwWW8ImplReader
* pRdr
);
438 const SwPosition
&GetStartPos() const { return maTmpPos
; }
441 enum eF_ResT
{ FLD_OK
, FLD_TEXT
, FLD_TAGIGN
, FLD_TAGTXT
, FLD_READ_FSPA
};
447 SwWW8Shade(bool bVer67
, const WW8_SHD
& rSHD
);
448 SwWW8Shade(ColorData nFore
, ColorData nBack
, sal_uInt16 nIndex
)
450 SetShade(nFore
, nBack
, nIndex
);
453 void SetShade(ColorData nFore
, ColorData nBack
, sal_uInt16 nIndex
);
457 //-----------------------------------------
459 //-----------------------------------------
460 enum SwWw8ControlType
468 class WW8FormulaControl
: public OCX_Control
471 SwWW8ImplReader
&rRdr
;
473 WW8FormulaControl(const String
& rN
, SwWW8ImplReader
&rR
)
474 : OCX_Control(rN
), rRdr(rR
), fUnknown(0), fDropdownIndex(0),
475 fToolTip(0), fNoMark(0), fUseSize(0), fNumbersOnly(0), fDateOnly(0),
476 fUnused(0), nSize(0), hpsCheckBox(20), nChecked(0)
480 UINT8 fDropdownIndex
:6;
484 UINT8 fNumbersOnly
:1;
491 UINT16 nDefaultChecked
;
498 std::vector
<String
> maListEntries
;
499 virtual ~WW8FormulaControl() {}
500 void FormulaRead(SwWw8ControlType nWhich
,SvStream
*pD
);
503 WW8FormulaControl(const WW8FormulaControl
&);
504 WW8FormulaControl
& operator=(const WW8FormulaControl
&);
507 class WW8FormulaCheckBox
: public WW8FormulaControl
511 WW8FormulaCheckBox(const WW8FormulaCheckBox
&);
512 WW8FormulaCheckBox
& operator=(const WW8FormulaCheckBox
&);
514 using OCX_Control::Import
;
517 WW8FormulaCheckBox(SwWW8ImplReader
&rR
);
519 virtual sal_Bool
Import(const com::sun::star::uno::Reference
<
520 com::sun::star::lang::XMultiServiceFactory
> &rServiceFactory
,
521 com::sun::star::uno::Reference
<
522 com::sun::star::form::XFormComponent
> &rFComp
,
523 com::sun::star::awt::Size
&rSz
);
526 class WW8FormulaListBox
: public WW8FormulaControl
530 WW8FormulaListBox(const WW8FormulaListBox
&);
531 WW8FormulaListBox
& operator=(const WW8FormulaListBox
&);
533 using OCX_Control::Import
;
536 WW8FormulaListBox(SwWW8ImplReader
&rR
);
538 virtual sal_Bool
Import(const com::sun::star::uno::Reference
<
539 com::sun::star::lang::XMultiServiceFactory
> &rServiceFactory
,
540 com::sun::star::uno::Reference
<
541 com::sun::star::form::XFormComponent
> &rFComp
,
542 com::sun::star::awt::Size
&rSz
);
545 class WW8FormulaEditBox
: public WW8FormulaControl
549 WW8FormulaEditBox(const WW8FormulaEditBox
&);
550 WW8FormulaEditBox
& operator=(const WW8FormulaEditBox
&);
552 WW8FormulaEditBox(SwWW8ImplReader
&rR
);
554 //#i3029# we are no longer importing editboxes as uno textboxes, using
555 //input fields instead for superior layout.
556 virtual sal_Bool
Import(const com::sun::star::uno::Reference
<
557 com::sun::star::lang::XMultiServiceFactory
> &rServiceFactory
,
558 com::sun::star::uno::Reference
<
559 com::sun::star::form::XFormComponent
> &rFComp
,
560 com::sun::star::awt::Size
&rSz
);
564 class SwMSConvertControls
: public SvxMSConvertOCXControls
567 SwMSConvertControls( SfxObjectShell
*pDSh
,SwPaM
*pP
) :
568 SvxMSConvertOCXControls( pDSh
,pP
) {}
569 virtual sal_Bool
InsertFormula( WW8FormulaControl
&rFormula
);
570 virtual sal_Bool
InsertControl(const com::sun::star::uno::Reference
<
571 com::sun::star::form::XFormComponent
>& rFComp
,
572 const ::com::sun::star::awt::Size
& rSize
,
573 com::sun::star::uno::Reference
<
574 com::sun::star::drawing::XShape
> *pShape
,BOOL bFloatingCtrl
);
575 bool ExportControl(WW8Export
&rWrt
, const SdrObject
*pObj
);
578 class SwMSDffManager
: public SvxMSDffManager
581 SwWW8ImplReader
& rReader
;
582 SvStream
*pFallbackStream
;
583 List
*pOldEscherBlipCache
;
585 virtual BOOL
GetOLEStorageName( long nOLEId
, String
& rStorageName
,
586 SvStorageRef
& rSrcStorage
, com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>& rDestStorage
) const;
587 virtual BOOL
ShapeHasText( ULONG nShapeId
, ULONG nFilePos
) const;
588 // --> OD 2004-12-14 #i32596# - new parameter <_nCalledByGroup>, which
589 // indicates, if the OLE object is imported inside a group object
590 virtual SdrObject
* ImportOLE( long nOLEId
,
592 const Rectangle
& rBoundRect
,
593 const Rectangle
& rVisArea
,
594 const int _nCalledByGroup
,
595 sal_Int64 nAspect
) const;
599 SwMSDffManager(const SwMSDffManager
&);
600 SwMSDffManager
& operator=(const SwMSDffManager
&);
602 static UINT32
GetFilterFlags();
603 static INT32
GetEscherLineMatch(MSO_LineStyle eStyle
, MSO_SPT eShapeType
,
605 SwMSDffManager( SwWW8ImplReader
& rRdr
);
606 void DisableFallbackStream();
607 void EnableFallbackStream();
609 virtual SdrObject
* ProcessObj( SvStream
& rSt
, DffObjData
& rObjData
, void* pData
, Rectangle
& rTextRect
, SdrObject
* pObj
);
616 wwSection(const SwPosition
&rPos
);
620 SwSection
*mpSection
;
621 SwPageDesc
*mpTitlePage
;
623 SvxFrameDirection meDir
;
633 void SetLinkId(short sLinkId
) { mLinkId
= sLinkId
; }
634 bool DoesContainFootnote() const { return mbHasFootnote
; }
635 bool IsContinous() const { return maSep
.bkc
== 0; }
636 bool IsLinked() const { return mLinkId
!= 0; }
637 bool IsNotProtected() const { return maSep
.fUnlocked
!= 0; }
638 bool IsVertical() const;
639 sal_Int16
NoCols() const { return maSep
.ccolM1
+ 1; }
640 sal_Int32
StandardColSeperation() const { return maSep
.dxaColumns
; }
641 bool HasTitlePage() const { return maSep
.fTitlePage
? true : false; }
642 sal_uInt16
PageStartAt() const { return maSep
.pgnStart
; }
643 bool PageRestartNo() const { return maSep
.fPgnRestart
? true : false; }
644 bool IsBiDi() const { return maSep
.fBiDi
? true : false; }
645 sal_uInt32
GetPageWidth() const { return nPgWidth
; }
646 sal_uInt32
GetTextAreaWidth() const
647 { return GetPageWidth() - GetPageLeft() - GetPageRight(); }
648 sal_uInt32
GetPageHeight() const { return maSep
.yaPage
; }
649 sal_uInt32
GetPageLeft() const { return nPgLeft
; }
650 sal_uInt32
GetPageRight() const { return nPgRight
; }
651 bool IsLandScape() const { return maSep
.dmOrientPage
? true : false; }
652 bool IsFixedHeightHeader() const { return maSep
.dyaTop
< 0; }
653 bool IsFixedHeightFooter() const { return maSep
.dyaBottom
< 0; }
656 class wwSectionManager
660 A queue of the ms sections in the document
662 SwWW8ImplReader
& mrReader
;
663 std::deque
<wwSection
> maSegments
;
664 typedef ::std::deque
<wwSection
>::iterator mySegIter
;
665 typedef ::std::deque
<wwSection
>::reverse_iterator mySegrIter
;
667 //Num of page desc's entered into the document
672 bool bHasHeader
, bHasFooter
;
673 sal_uInt32 nSwHLo
, nSwFUp
, nSwUp
, nSwLo
;
674 wwULSpaceData() : bHasHeader(false), bHasFooter(false) {}
677 void SetSegmentToPageDesc(const wwSection
&rSection
, bool bTitlePage
,
680 void GetPageULData(const wwSection
&rNewSection
, bool bFirst
,
681 wwULSpaceData
& rData
) const;
682 void SetPageULSpaceItems(SwFrmFmt
&rFmt
, wwULSpaceData
& rData
,
683 const wwSection
&rSection
) const;
685 void SetPage(SwPageDesc
&rPageDesc
, SwFrmFmt
&rFmt
,
686 const wwSection
&rSection
, bool bIgnoreCols
) const;
688 void SetNumberingType(const wwSection
&rNewSection
, SwPageDesc
&rPageDesc
)
691 void SetUseOn(wwSection
&rSection
);
692 void SetHdFt(wwSection
&rSection
, int nSect
, const wwSection
*pPrevious
);
694 SwSectionFmt
*InsertSection(SwPaM
& rMyPaM
, wwSection
&rSection
);
695 bool SetCols(SwFrmFmt
&rFmt
, const wwSection
&rSection
,
696 sal_uInt32 nNettoWidth
) const;
697 bool SectionIsProtected(const wwSection
&rSection
) const;
698 void SetLeftRight(wwSection
&rSection
);
699 bool IsNewDoc() const;
701 The segment we're inserting, the start of the segments container, and the
702 nodeindex of where we want the page break to (normally the segments start
705 SwFmtPageDesc
SetSwFmtPageDesc(mySegIter
&rIter
, mySegIter
&rStart
,
709 wwSectionManager(const wwSectionManager
&);
710 wwSectionManager
& operator=(const wwSectionManager
&);
712 wwSectionManager(SwWW8ImplReader
&rReader
) : mrReader(rReader
), mnDesc(0)
714 void SetCurrentSectionHasFootnote();
715 bool CurrentSectionIsVertical() const;
716 bool CurrentSectionIsProtected() const;
717 void PrependedInlineNode(const SwPosition
&rPos
, const SwNode
&rNode
);
718 USHORT
CurrentSectionColCount() const;
719 bool WillHavePageDescHere(SwNodeIndex aIdx
) const;
720 void CreateSep(const long nTxtPos
, bool bMustHaveBreak
);
721 void InsertSegments();
722 void JoinNode(const SwPosition
&rPos
, const SwNode
&rNode
);
723 sal_uInt32
GetPageLeft() const;
724 sal_uInt32
GetPageRight() const;
725 sal_uInt32
GetPageWidth() const;
726 // --> OD 2007-07-03 #148498#
727 sal_uInt32
GetWWPageTopMargin() const;
729 bool empty() const { return maSegments
.empty(); }
730 sal_uInt32
GetTextAreaWidth() const;
737 int mnImportedGraphicsCount
;
740 wwFrameNamer(const wwFrameNamer
&);
741 wwFrameNamer
& operator=(const wwFrameNamer
&);
743 void SetUniqueGraphName(SwFrmFmt
*pFrmFmt
,const String
&rFixedPart
);
744 wwFrameNamer(bool bIsDisabled
, const String
&rSeed
)
745 : msSeed(rSeed
), mnImportedGraphicsCount(0), mbIsDisabled(bIsDisabled
)
753 String msFileLinkSeed
;
756 wwSectionNamer(const wwSectionNamer
&);
757 wwSectionNamer
& operator=(const wwSectionNamer
&);
760 wwSectionNamer(const SwDoc
&rDoc
, const String
&rSeed
)
761 : mrDoc(rDoc
), msFileLinkSeed(rSeed
), mnFileSectionNo(0)
774 struct ApoTestResults
778 const BYTE
* mpSprm37
;
779 const BYTE
* mpSprm29
;
780 WW8FlyPara
* mpStyleApo
;
782 mbStartApo(false), mbStopApo(false), mpSprm37(0), mpSprm29(0),
784 bool HasStartStop() const { return (mbStartApo
|| mbStopApo
); }
785 bool HasFrame() const { return (mpSprm29
|| mpSprm37
|| mpStyleApo
); }
790 SwNumRule
* mpOutlineNumRule
; // WinWord 6 numbering, varient 1
791 SwNumRule
* mpNumberingNumRule
; // WinWord 6 numbering, varient 2
792 SwNumRule
* GetNumRule(BYTE nNumType
);
793 void SetNumRule(SwNumRule
*, BYTE nNumType
);
794 ANLDRuleMap() : mpOutlineNumRule(0), mpNumberingNumRule(0) {}
799 struct WW8PostProcessAttrsInfo
807 WW8PostProcessAttrsInfo(WW8_CP nCpStart
, WW8_CP nCpEnd
, SwPaM
& rPaM
);
810 //-----------------------------------------
812 //-----------------------------------------
813 class SwWW8ImplReader
816 SwDocShell
*mpDocShell
; // The Real DocShell
818 friend class WW8RStyle
;
819 friend class WW8TabDesc
;
820 friend class WW8ReaderSave
;
821 friend struct WW8FlyPara
;
822 friend struct WW8SwFlyPara
;
823 friend class WW8FlySet
;
824 friend class SwMSDffManager
;
825 friend class SwWW8FltControlStack
;
826 friend class WW8FormulaControl
;
827 friend class wwSectionManager
;
831 To log unimplemented features
833 sw::log::Tracer maTracer
;
836 SvStorage
* pStg
; // Input-Storage
837 SvStream
* pStrm
; // Input-(Storage)Stream
838 SvStream
* pTableStream
; // Input-(Storage)Stream
839 SvStream
* pDataStream
; // Input-(Storage)Stream
845 SwWW8FltControlStack
* pCtrlStck
; // Stack fuer die Attribute
848 This stack is for redlines, because their sequence of discovery can
849 be out of order of their order of insertion into the document.
851 sw::util::RedlineStack
*mpRedlineStack
;
854 This stack is for fields that get referneced later, e.g. BookMarks and TOX.
855 They get inserted at the end of the document, it is the same stack for
856 headers/footers/main text/textboxes/tables etc...
858 SwFltEndStack
*pReffedStck
;
861 This stack is for fields whose true conversion cannot be determined until
862 the end of the document, it is the same stack for headers/footers/main
863 text/textboxes/tables etc... They are things that reference other things
864 e.g. NoteRef and Ref, they are processed after pReffedStck
866 SwWW8FltRefStack
*pReffingStck
;
869 For graphics anchors. Determines the graphics whose anchors are in the
870 current paragraph, and works around the difficulty in inserting a graphic
871 anchored to character before a character to be anchored to has been
872 inserted. Is emptied at the end of each paragraph.
874 SwWW8FltAnchorStack
* pAnchorStck
;
877 A stack of fields identifiers to keep track of any open fields that need
878 to be closed. Generally word fields are inserted as writer fields as soon
879 as they are encountered, and so their end point is normally unimportant.
880 But hyperlink fields need to be applied as attributes to text and it is
881 far easier and safer to set the end point of an attribute when we
882 encounter the end marker of the field instead of caculating in advance
883 where the end point will fall, to do so fully correctly duplicates the
884 main logic of the filter itself.
886 std::deque
<FieldEntry
> maFieldStack
;
887 typedef std::deque
<FieldEntry
>::const_iterator mycFieldIter
;
890 A stack of open footnotes. Should only be one in it at any time.
892 std::deque
<FtnDescriptor
> maFtnStack
;
895 A queue of the ms sections in the document
897 wwSectionManager maSectionManager
;
900 A map of of tables to their follow nodes for use in inserting tables into
901 already existing document, i.e. insert file
903 sw::util::InsertedTablesManager maInsertedTables
;
906 Creates unique names to give to (file link) sections (WW1/WW2/...)
908 wwSectionNamer maSectionNameGenerator
;
911 Knows how to split a series of bytes into sprms and their arguments
913 wwSprmParser
*mpSprmParser
;
916 Creates unique names to give to graphics
918 wwFrameNamer maGrfNameGenerator
;
921 Knows which writer style a given word style should be imported as.
923 sw::util::ParaStyleMapper maParaStyleMapper
;
924 sw::util::CharStyleMapper maCharStyleMapper
;
927 Stack of textencoding being used as we progress through the document text
929 std::stack
<rtl_TextEncoding
> maFontSrcCharSets
;
932 Winword numbering gets imported as SwNumRules, there is a problem that
933 winword can have multiple outline numberings, only one gets chosen as
934 the writer outline numbering rule. The one that gets chosen is set here
935 as mpChosenOutlineNumRule
937 SwNumRule
*mpChosenOutlineNumRule
;
939 SwMSConvertControls
*pFormImpl
; // Control-Implementierung
941 SwFlyFrmFmt
* pFlyFmtOfJustInsertedGraphic
;
942 SwFrmFmt
* pFmtOfJustInsertedApo
;
943 SwPaM
* pPreviousNumPaM
;
944 const SwNumRule
* pPrevNumRule
;
946 //Keep track of APO environments
947 std::deque
<bool> maApos
;
948 typedef std::deque
<bool>::const_iterator mycApoIter
;
950 Keep track of generated Ruby character formats we we can minimize the
951 number of character formats created
953 std::vector
<const SwCharFmt
*> aRubyCharFmts
;
955 WW8PostProcessAttrsInfo
* mpPostProcessAttrsInfo
;
960 WW8ListManager
* pLstManager
;
961 WW8ScannerBase
* pSBase
;
962 WW8PLCFMan
* pPlcxMan
;
963 std::map
<short, String
> aLinkStringMap
;
965 WW8RStyle
* pStyles
; // Pointer auf die Style-Einleseklasse
966 SwFmt
* pAktColl
; // gerade zu erzeugende Collection
967 // ( ist ausserhalb einer Style-Def immer 0 )
968 SfxItemSet
* pAktItemSet
;// gerade einzulesende Zeichenattribute
969 // (ausserhalb des WW8ListManager Ctor's immer 0)
970 SwWW8StyInf
* pCollA
; // UEbersetzungs-Array der Styles
971 const SwTxtFmtColl
* pDfltTxtFmtColl
; // Default
972 SwFmt
* pStandardFmtColl
;// "Standard"
974 WW8PLCF_HdFt
* pHdFt
; // Pointer auf Header / Footer - Scannerklasse
976 WW8FlyPara
* pWFlyPara
; // WW-Parameter
977 WW8SwFlyPara
* pSFlyPara
; // daraus erzeugte Sw-Parameter
979 WW8TabDesc
* pTableDesc
; // Beschreibung der Tabelleneigenschaften
980 //Keep track of tables within tables
981 std::stack
<WW8TabDesc
*> maTableStack
;
983 ANLDRuleMap maANLDRules
;
984 WW8_OLST
* pNumOlst
; // Gliederung im Text
986 SwNode
* pNode_FLY_AT_CNTNT
; // set: WW8SwFlyPara() read: CreateSwTable()
988 SdrModel
* pDrawModel
;
990 EditEngine
* mpDrawEditEngine
;
991 wwZOrderer
*pWWZOrder
;
993 SwFieldType
* pNumFldType
; // fuer Nummernkreis
995 SwMSDffManager
* pMSDffManager
;
997 std::vector
<String
>* mpAtnNames
;
999 sw::util::AuthorInfos
* pAuthorInfos
;
1003 ULONG nIniFlags
; // Flags aus der writer.ini
1004 ULONG nIniFlags1
; // dito ( zusaetzliche Flags )
1005 ULONG nFieldFlags
; // dito fuer Feldern
1006 ULONG nFieldTagAlways
[3]; // dito fuers Taggen von Feldern
1007 ULONG nFieldTagBad
[3]; // dito fuers Taggen von nicht importierbaren F.
1008 bool m_bRegardHindiDigits
; // import digits in CTL scripts as Hindi numbers
1010 WW8_CP nDrawCpO
; // Anfang der Txbx-SubDocs
1012 ULONG nPicLocFc
; // Picture Location in File (FC)
1013 ULONG nObjLocFc
; // Object Location in File (FC)
1015 INT32 nIniFlyDx
; // X-Verschiebung von Flys
1016 INT32 nIniFlyDy
; // Y-Verschiebung von Flys
1018 rtl_TextEncoding eTextCharSet
; // Default charset for Text
1019 rtl_TextEncoding eStructCharSet
; // rtl_TextEncoding for structures
1020 rtl_TextEncoding eHardCharSet
; // Hard rtl_TextEncoding-Attribute
1021 USHORT nProgress
; // %-Angabe fuer Progressbar
1022 USHORT nColls
; // Groesse des Arrays
1023 USHORT nAktColl
; // gemaess WW-Zaehlung
1024 USHORT nFldNum
; // laufende Nummer dafuer
1025 USHORT nLFOPosition
;
1027 short nCharFmt
; // gemaess WW-Zaehlung, <0 fuer keine
1029 short nDrawXOfs
, nDrawYOfs
;
1030 short nDrawXOfs2
, nDrawYOfs2
;
1032 sal_Unicode cSymbol
; // aktuell einzulesendes Symbolzeichen
1035 BYTE nWantedVersion
; // urspruenglich vom Writer
1036 // angeforderte WW-Doc-Version
1039 BYTE nSwNumLevel
; // LevelNummer fuer Outline / Nummerierung
1040 BYTE nWwNumType
; // Gliederung / Nummerg / Aufzaehlg
1043 BYTE nPgChpDelim
; // ChapterDelim from PageNum
1044 BYTE nPgChpLevel
; // ChapterLevel of Heading from PageNum
1046 bool mbNewDoc
; // Neues Dokument ?
1047 bool bReadNoTbl
; // Keine Tabellen
1048 bool bPgSecBreak
; // Page- oder Sectionbreak ist noch einzufuegen
1049 bool bSpec
; // Special-Char im Text folgt
1050 bool bObj
; // Obj im Text
1051 bool bTxbxFlySection
; // FlyFrame, der als Ersatz fuer Winword Textbox eingefuegt wurde
1052 bool bHasBorder
; // fuer Buendelung der Border
1053 bool bSymbol
; // z.B. Symbol statt Times
1054 bool bIgnoreText
; // z.B. fuer FieldVanish
1055 int nInTable
; // wird gerade eine Tabelle eingelesen
1056 bool bWasTabRowEnd
; // Tabelle : Row End Mark
1057 bool bWasTabCellEnd
; // table: Cell End Mark
1059 bool bShdTxtCol
; // Textfarbe indirekt gesetzt ( Hintergrund sw )
1060 bool bCharShdTxtCol
; // Textfarbe indirekt gesetzt ( Zeichenhintergrund sw )
1061 bool bAnl
; // Nummerierung in Bearbeitung
1062 // Anl heisst Autonumber level
1064 bool bHdFtFtnEdn
; // Spezialtext: Kopf- Fuss- usw.
1065 bool bFtnEdn
; // Fussnote oder Endnote
1066 bool bIsHeader
; // Text aus Header wird gelesen ( Zeilenhoehe )
1067 bool bIsFooter
; // Text aus Footer wird gelesen ( Zeilenhoehe )
1069 bool bIsUnicode
; // aktuelles Text-Stueck ist als 2-Bytiger-Unicode kodiert
1070 // bitte NICHT als Bitfeld kodieren!
1072 bool bCpxStyle
; // Style im Complex Part
1073 bool bStyNormal
; // Style mit Id 0 wird gelesen
1074 bool bWWBugNormal
; // WW-Version nit Bug Dya in Style Normal
1075 bool bNoAttrImport
; // Attribute ignorieren zum Ignorieren v. Styles
1076 bool bInHyperlink
; // Sonderfall zum einlesen eines 0x01
1077 // siehe: SwWW8ImplReader::Read_F_Hyperlink()
1080 // praktische Hilfsvariablen:
1081 bool bVer67
; // ( (6 == nVersion) || (7 == nVersion) );
1082 bool bVer6
; // (6 == nVersion);
1083 bool bVer7
; // (7 == nVersion);
1084 bool bVer8
; // (8 == nVersion);
1086 bool bPgChpLevel
; // ChapterLevel of Heading from PageNum
1087 bool bEmbeddObj
; // EmbeddField gelesen
1089 bool bAktAND_fNumberAcross
; // current active Annotated List Deskriptor - ROW flag
1091 bool bNoLnNumYet
; // no Line Numbering has been activated yet (we import
1092 // the very 1st Line Numbering and ignore the rest)
1094 bool bFirstPara
; // first paragraph?
1096 bool bParaAutoBefore
;
1097 bool bParaAutoAfter
;
1105 boost::shared_ptr
<SwPaM
> mpTableEndPaM
;
1107 //---------------------------------------------
1109 const SprmReadInfo
& GetSprmReadInfo(USHORT nId
) const;
1111 bool StyleExists(int nColl
) const { return (nColl
< nColls
); }
1112 SwWW8StyInf
*GetStyle(USHORT nColl
) const;
1113 void AppendTxtNode(SwPosition
& rPos
);
1115 void Read_HdFt(bool bIsTitle
, int nSect
, const SwPageDesc
*pPrev
,
1116 const wwSection
&rSection
);
1117 void Read_HdFtText(long nStartCp
, long nLen
, SwFrmFmt
* pHdFtFmt
);
1118 void Read_HdFtTextAsHackedFrame(long nStart
, long nLen
,
1119 SwFrmFmt
&rHdFtFmt
, sal_uInt16 nPageWidth
);
1121 bool HasOwnHeaderFooter(BYTE nWhichItems
, BYTE grpfIhdt
, int nSect
);
1123 void HandleLineNumbering(const wwSection
&rSection
);
1125 void CopyPageDescHdFt( const SwPageDesc
* pOrgPageDesc
,
1126 SwPageDesc
* pNewPageDesc
, BYTE nCode
);
1128 void DeleteStk(SwFltControlStack
* prStck
);
1129 void DeleteCtrlStk() { DeleteStk( pCtrlStck
); pCtrlStck
= 0; }
1130 void DeleteRefStks()
1132 DeleteStk( pReffedStck
);
1134 DeleteStk( pReffingStck
);
1137 void DeleteAnchorStk() { DeleteStk( pAnchorStck
); pAnchorStck
= 0; }
1138 bool AddTextToParagraph(const String
& sAddString
);
1139 bool HandlePageBreakChar();
1140 bool ReadChar(long nPosCp
, long nCpOfs
);
1141 bool ReadPlainChars(WW8_CP
& rPos
, long nEnd
, long nCpOfs
);
1142 bool ReadChars(WW8_CP
& rPos
, WW8_CP nNextAttr
, long nTextEnd
, long nCpOfs
);
1143 bool LangUsesHindiNumbers(USHORT nLang
);
1144 sal_Unicode
TranslateToHindiNumbers(sal_Unicode
);
1146 void SetDocumentGrid(SwFrmFmt
&rFmt
, const wwSection
&rSection
);
1148 void ProcessAktCollChange(WW8PLCFManResult
& rRes
, bool* pStartAttr
,
1149 bool bCallProcessSpecial
);
1150 long ReadTextAttr(WW8_CP
& rTxtPos
, bool& rbStartLine
);
1151 void ReadAttrs(WW8_CP
& rNext
, WW8_CP
& rTxtPos
, bool& rbStartLine
);
1152 void CloseAttrEnds();
1153 bool ReadText(long nStartCp
, long nTextLen
, ManTypes nType
);
1155 void ReadRevMarkAuthorStrTabl( SvStream
& rStrm
, INT32 nTblPos
,
1156 INT32 nTblSiz
, SwDoc
& rDoc
);
1158 void Read_HdFtFtnText( const SwNodeIndex
* pSttIdx
, long nStartCp
,
1159 long nLen
, ManTypes nType
);
1161 void ImportTox( int nFldId
, String aStr
);
1163 void EndSprm( USHORT nId
);
1164 void NewAttr( const SfxPoolItem
& rAttr
);
1166 bool GetFontParams(USHORT
, FontFamily
&, String
&, FontPitch
&,
1168 bool SetNewFontAttr(USHORT nFCode
, bool bSetEnums
, USHORT nWhich
);
1169 void ResetCharSetVars();
1171 const SfxPoolItem
* GetFmtAttr( USHORT nWhich
);
1172 bool JoinNode(SwPaM
&rPam
, bool bStealAttr
= false);
1174 bool IsBorder(const WW8_BRC
* pbrc
, bool bChkBtwn
= false) const;
1176 //Set closest writer border equivalent into rBox from pbrc, optionally
1177 //recording true winword dimensions in pSizeArray. nSetBorders to mark a
1178 //border which has been previously set to a value and for which becoming
1179 //empty is valid. Set bCheBtwn to work with paragraphs that have a special
1180 //between paragraphs border
1182 // #i20672# we can't properly support between lines so best to ignore
1184 bool SetBorder(SvxBoxItem
& rBox
, const WW8_BRC
* pbrc
, short *pSizeArray
=0,
1185 BYTE nSetBorders
=0xFF, bool bChkBtwn
= false) const;
1187 bool SetBorder(SvxBoxItem
& rBox
, const WW8_BRC
* pbrc
, short *pSizeArray
=0,
1188 BYTE nSetBorders
=0xFF) const;
1189 void GetBorderDistance(const WW8_BRC
* pbrc
, Rectangle
& rInnerDist
) const;
1190 sal_uInt16
GetParagraphAutoSpace(bool fDontUseHTMLAutoSpacing
);
1191 bool SetShadow(SvxShadowItem
& rShadow
, const short *pSizeArray
,
1192 const WW8_BRC
*pbrc
) const;
1193 //returns true is a shadow was set
1194 bool SetFlyBordersShadow(SfxItemSet
& rFlySet
, const WW8_BRC
*pbrc
,
1195 short *SizeArray
=0) const;
1196 void SetPageBorder(SwFrmFmt
&rFmt
, const wwSection
&rSection
) const;
1198 INT32
MatchSdrBoxIntoFlyBoxItem( const Color
& rLineColor
,
1199 MSO_LineStyle eLineStyle
, MSO_SPT eShapeType
, INT32
&rLineWidth
,
1201 void MatchSdrItemsIntoFlySet( SdrObject
* pSdrObj
, SfxItemSet
&aFlySet
,
1202 MSO_LineStyle eLineStyle
, MSO_SPT eShapeType
, Rectangle
&rInnerDist
);
1203 void AdjustLRWrapForWordMargins(const SvxMSDffImportRec
&rRecord
,
1204 SvxLRSpaceItem
&rLR
);
1205 void AdjustULWrapForWordMargins(const SvxMSDffImportRec
&rRecord
,
1206 SvxULSpaceItem
&rUL
);
1207 void MapWrapIntoFlyFmt(SvxMSDffImportRec
* pRecord
, SwFrmFmt
* pFlyFmt
);
1209 void SetAttributesAtGrfNode( SvxMSDffImportRec
* pRecord
, SwFrmFmt
*pFlyFmt
,
1213 bool IsListOrDropcap() { return (!pAktItemSet
|| bDropCap
); };
1215 WW8FlyPara
*ConstructApo(const ApoTestResults
&rApo
,
1216 const WW8_TablePos
*pTabPos
);
1217 bool StartApo(const ApoTestResults
&rApo
, const WW8_TablePos
*pTabPos
);
1219 bool TestSameApo(const ApoTestResults
&rApo
, const WW8_TablePos
*pTabPos
);
1220 ApoTestResults
TestApo(int nCellLevel
, bool bTableRowEnd
,
1221 const WW8_TablePos
*pTabPos
);
1224 bool ProcessSpecial(bool &rbReSync
, WW8_CP nStartCp
);
1225 USHORT
TabRowSprm(int nLevel
) const;
1227 bool ReadGrafFile(String
& rFileName
, Graphic
*& rpGraphic
,
1228 const WW8_PIC
& rPic
, SvStream
* pSt
, ULONG nFilePos
, bool* pDelIt
);
1230 void ReplaceObj(const SdrObject
&rReplaceTextObj
,
1231 SdrObject
&rSubObj
);
1233 SwFlyFrmFmt
* MakeGrafNotInCntnt(const WW8PicDesc
& rPD
,
1234 const Graphic
* pGraph
, const String
& rFileName
,
1235 const SfxItemSet
& rGrfSet
);
1237 SwFrmFmt
* MakeGrafInCntnt(const WW8_PIC
& rPic
, const WW8PicDesc
& rPD
,
1238 const Graphic
* pGraph
, const String
& rFileName
,
1239 const SfxItemSet
& rGrfSet
);
1241 SwFrmFmt
*AddAutoAnchor(SwFrmFmt
*pFmt
);
1242 SwFrmFmt
* ImportGraf1(WW8_PIC
& rPic
, SvStream
* pSt
, ULONG nFilePos
);
1243 SwFrmFmt
* ImportGraf(SdrTextObj
* pTextObj
= 0, SwFrmFmt
* pFlyFmt
= 0);
1245 SdrObject
* ImportOleBase( Graphic
& rGraph
, const Graphic
* pGrf
=0,
1246 const SfxItemSet
* pFlySet
=0, const Rectangle
& aVisArea
= Rectangle() );
1248 SwFrmFmt
* ImportOle( const Graphic
* = 0, const SfxItemSet
* pFlySet
= 0,
1249 const SfxItemSet
* pGrfSet
= 0, const Rectangle
& aVisArea
= Rectangle() );
1250 SwFlyFrmFmt
* InsertOle(SdrOle2Obj
&rObject
, const SfxItemSet
&rFlySet
,
1251 const SfxItemSet
&rGrfSet
);
1253 bool ImportFormulaControl(WW8FormulaControl
&rBox
,WW8_CP nStart
,
1254 SwWw8ControlType nWhich
);
1258 //This converts MS Asian Typography information into OOo's
1259 void ImportDopTypography(const WW8DopTypography
&rTypo
);
1261 ULONG
LoadThroughDecryption(SwPaM
& rPaM
,WW8Glossary
*pGloss
);
1262 ULONG
SetSubStreams(SvStorageStreamRef
&rTableStream
, SvStorageStreamRef
&rDataStream
);
1263 ULONG
CoreLoad(WW8Glossary
*pGloss
, const SwPosition
&rPos
);
1267 bool StartTable(WW8_CP nStartCp
);
1268 bool InEqualApo(int nLvl
) const;
1269 bool InLocalApo() const { return InEqualApo(nInTable
); }
1270 bool InEqualOrHigherApo(int nLvl
) const;
1271 bool InAnyApo() const { return InEqualOrHigherApo(1); }
1274 short GetTableLeft();
1275 bool IsInvalidOrToBeMergedTabCell() const;
1277 // Nummerierungen / Aufzaehlungen ( Autonumbered List Data Descriptor )
1278 // Liste: ANLD ( Autonumbered List Data Descriptor )
1279 // eine Ebene: ANLV ( Autonumber Level Descriptor )
1282 // Listen sind in WW8 eigene Strukturen, die ueber folgende drei Tabellen
1283 // verwaltet werden: rglst, hpllfo und hsttbListNames
1284 // die Strukturen hierfuer sind: LSTF, LVLF, LFO LFOLVL
1286 void SetAnlvStrings(SwNumFmt
&rNum
, WW8_ANLV
&rAV
, const BYTE
* pTxt
,
1288 void SetAnld(SwNumRule
* pNumR
, WW8_ANLD
* pAD
, BYTE nSwLevel
, bool bOutLine
);
1289 void SetNumOlst( SwNumRule
* pNumR
, WW8_OLST
* pO
, BYTE nSwLevel
);
1290 SwNumRule
* GetStyRule();
1292 void StartAnl(const BYTE
* pSprm13
);
1293 void NextAnlLine(const BYTE
* pSprm13
);
1294 void StopAllAnl(bool bGoBack
= true);
1295 void StopAnlToRestart(BYTE nType
, bool bGoBack
= true);
1299 bool ReadGrafStart(void* pData
, short nDataSiz
, WW8_DPHEAD
* pHd
,
1300 const WW8_DO
* pDo
, SfxAllItemSet
&rSet
);
1301 SdrObject
*ReadLine(WW8_DPHEAD
* pHd
, const WW8_DO
* pDo
,
1302 SfxAllItemSet
&rSet
);
1303 SdrObject
*ReadRect(WW8_DPHEAD
* pHd
, const WW8_DO
* pDo
,
1304 SfxAllItemSet
&rSet
);
1305 SdrObject
*ReadElipse(WW8_DPHEAD
* pHd
, const WW8_DO
* pDo
,
1306 SfxAllItemSet
&rSet
);
1307 SdrObject
*ReadArc(WW8_DPHEAD
* pHd
, const WW8_DO
* pDo
,
1308 SfxAllItemSet
&rSet
);
1309 SdrObject
*ReadPolyLine(WW8_DPHEAD
* pHd
, const WW8_DO
* pDo
,
1310 SfxAllItemSet
&rSet
);
1311 ESelection
GetESelection( long nCpStart
, long nCpEnd
);
1312 void InsertTxbxStyAttrs( SfxItemSet
& rS
, USHORT nColl
);
1313 void InsertAttrsAsDrawingAttrs(long nStartCp
, long nEndCp
, ManTypes eType
, bool bONLYnPicLocFc
=false);
1315 bool GetTxbxTextSttEndCp(WW8_CP
& rStartCp
, WW8_CP
& rEndCp
, USHORT nTxBxS
,
1317 bool GetRangeAsDrawingString(String
& rString
, long StartCp
, long nEndCp
, ManTypes eType
);
1318 OutlinerParaObject
* ImportAsOutliner(String
&rString
, WW8_CP nStartCp
, WW8_CP nEndCp
, ManTypes eType
);
1319 SwFrmFmt
* InsertTxbxText(SdrTextObj
* pTextObj
, Size
* pObjSiz
,
1320 USHORT nTxBxS
, USHORT nSequence
, long nPosCp
, SwFrmFmt
* pFlyFmt
,
1321 bool bMakeSdrGrafObj
, bool& rbEraseTextObj
,
1322 bool* pbTestTxbxContainsText
= 0, long* pnStartCp
= 0,
1323 long* pnEndCp
= 0, bool* pbContainsGraphics
= 0,
1324 SvxMSDffImportRec
* pRecord
= 0);
1325 bool TxbxChainContainsRealText( USHORT nTxBxS
,
1328 SdrObject
*ReadTxtBox(WW8_DPHEAD
* pHd
, const WW8_DO
* pDo
,
1329 SfxAllItemSet
&rSet
);
1330 SdrObject
*ReadCaptionBox(WW8_DPHEAD
* pHd
, const WW8_DO
* pDo
,
1331 SfxAllItemSet
&rSet
);
1332 SdrObject
*ReadGroup(WW8_DPHEAD
* pHd
, const WW8_DO
* pDo
,
1333 SfxAllItemSet
&rSet
);
1334 SdrObject
*ReadGrafPrimitive(short& rLeft
, const WW8_DO
* pDo
,
1335 SfxAllItemSet
&rSet
);
1336 void ReadGrafLayer1( WW8PLCFspecial
* pPF
, long nGrafAnchorCp
);
1337 SdrObject
* CreateContactObject(SwFrmFmt
* pFlyFmt
);
1338 RndStdIds
ProcessEscherAlign(SvxMSDffImportRec
* pRecord
, WW8_FSPA
*pFSPA
,
1339 SfxItemSet
&rFlySet
, bool bOrgObjectWasReplace
);
1340 bool MiserableRTLGraphicsHack(SwTwips
&rLeft
, SwTwips nWidth
,
1341 sal_Int16 eHoriOri
, sal_Int16 eHoriRel
);
1342 SwFrmFmt
* Read_GrafLayer( long nGrafAnchorCp
);
1343 SwFlyFrmFmt
* ImportReplaceableDrawables( SdrObject
* &rpObject
,
1344 SdrObject
* &rpOurNewObject
, SvxMSDffImportRec
* pRecord
, WW8_FSPA
*pF
,
1345 SfxItemSet
&rFlySet
);
1346 SwFlyFrmFmt
*ConvertDrawTextToFly( SdrObject
* &rpObject
,
1347 SdrObject
* &rpOurNewObject
, SvxMSDffImportRec
* pRecord
,
1348 RndStdIds eAnchor
, WW8_FSPA
*pF
, SfxItemSet
&rFlySet
);
1349 SwFrmFmt
* MungeTextIntoDrawBox(SdrObject
* pTrueObject
,
1350 SvxMSDffImportRec
*pRecord
, long nGrafAnchorCp
, SwFrmFmt
*pRetFrmFmt
);
1356 String
GetFieldResult( WW8FieldDesc
* pF
);
1357 void MakeTagString( String
& rStr
, const String
& rOrg
);
1358 void UpdateFields();
1359 void ConvertFFileName( String
& rName
, const String
& rRaw
);
1360 long Read_F_Tag( WW8FieldDesc
* pF
);
1361 void InsertTagField( const USHORT nId
, const String
& rTagText
);
1362 long ImportExtSprm(WW8PLCFManResult
* pRes
);
1363 void EndExtSprm(USHORT nSprmId
);
1368 void RegisterNumFmtOnTxtNode(USHORT nActLFO
, BYTE nActLevel
,
1369 bool bSetAttr
= true);
1370 void RegisterNumFmtOnStyle(USHORT nStyle
);
1371 void SetStylesList(sal_uInt16 nStyle
, sal_uInt16 nActLFO
,
1372 sal_uInt8 nActLevel
);
1373 void RegisterNumFmt(USHORT nActLFO
, BYTE nActLevel
);
1375 // spaeter zu ersetzen durch Aufruf in entsprechend erweiterten SvxMSDffManager
1377 const String
* GetAnnotationAuthor(sal_uInt16 nIdx
);
1379 // Schnittstellen fuer die Toggle-Attribute
1380 void SetToggleAttr(BYTE nAttrId
, bool bOn
);
1381 void SetToggleBiDiAttr(BYTE nAttrId
, bool bOn
);
1382 void _ChkToggleAttr( USHORT nOldStyle81Mask
, USHORT nNewStyle81Mask
);
1384 void ChkToggleAttr( USHORT nOldStyle81Mask
, USHORT nNewStyle81Mask
)
1386 if( nOldStyle81Mask
!= nNewStyle81Mask
&&
1387 pCtrlStck
->GetToggleAttrFlags() )
1388 _ChkToggleAttr( nOldStyle81Mask
, nNewStyle81Mask
);
1391 void _ChkToggleBiDiAttr( USHORT nOldStyle81Mask
, USHORT nNewStyle81Mask
);
1393 void ChkToggleBiDiAttr( USHORT nOldStyle81Mask
, USHORT nNewStyle81Mask
)
1395 if( nOldStyle81Mask
!= nNewStyle81Mask
&&
1396 pCtrlStck
->GetToggleBiDiAttrFlags() )
1397 _ChkToggleBiDiAttr( nOldStyle81Mask
, nNewStyle81Mask
);
1400 void PopTableDesc();
1401 void MoveInsideFly(const SwFrmFmt
*pFlyFmt
);
1402 SwTwips
MoveOutsideFly(SwFrmFmt
*pFlyFmt
, const SwPosition
&rPos
,
1403 bool bTableJoin
= true);
1405 void SetOutLineStyles();
1407 bool SetSpacing(SwPaM
&rMyPam
, int nSpace
, bool bIsUpper
);
1408 bool SetUpperSpacing(SwPaM
&pMyPam
, int nSpace
);
1409 bool SetLowerSpacing(SwPaM
&rMyPam
, int nSpace
);
1411 bool IsInlineEscherHack() const
1412 {return !maFieldStack
.empty() ? maFieldStack
.back().mnFieldId
== 95 : false; };
1414 void StoreMacroCmds();
1416 // --> OD 2008-04-10 #i84783#
1417 // determine object attribute "Layout in Table Cell"
1418 bool IsObjectLayoutInTableCell( const UINT32 nLayoutInTableCell
) const;
1420 bool ReadGlobalTemplateSettings( const rtl::OUString
& sCreatedFrom
, const com::sun::star::uno::Reference
< com::sun::star::container::XNameContainer
>& xPrjNameMap
);
1422 SwWW8ImplReader(const SwWW8ImplReader
&);
1423 SwWW8ImplReader
& operator=(const SwWW8ImplReader
&);
1424 public: // eigentlich private, geht aber leider nur public
1425 USHORT
GetToggleAttrFlags() const;
1426 USHORT
GetToggleBiDiAttrFlags() const;
1427 void SetToggleAttrFlags(USHORT nFlags
);
1428 void SetToggleBiDiAttrFlags(USHORT nFlags
);
1431 long Read_Ftn(WW8PLCFManResult
* pRes
);
1432 sal_uInt16
End_Ftn();
1433 long Read_Field(WW8PLCFManResult
* pRes
);
1434 sal_uInt16
End_Field();
1435 long Read_Book(WW8PLCFManResult
*);
1436 long Read_And(WW8PLCFManResult
* pRes
);
1440 void Read_Special(USHORT
, const BYTE
*, short nLen
);
1441 void Read_Obj(USHORT
, const BYTE
*, short nLen
);
1442 void Read_PicLoc(USHORT
, const BYTE
* pData
, short nLen
);
1443 void Read_BoldUsw(USHORT nId
, const BYTE
*, short nLen
);
1444 void Read_Bidi(USHORT nId
, const BYTE
*, short nLen
);
1445 void Read_BoldBiDiUsw(USHORT nId
, const BYTE
*, short nLen
);
1446 void Read_SubSuper( USHORT
, const BYTE
*, short nLen
);
1447 bool ConvertSubToGraphicPlacement();
1448 SwFrmFmt
*ContainsSingleInlineGraphic(const SwPaM
&rRegion
);
1449 void Read_SubSuperProp( USHORT
, const BYTE
*, short nLen
);
1450 void Read_Underline( USHORT
, const BYTE
*, short nLen
);
1451 void Read_TxtColor( USHORT
, const BYTE
*, short nLen
);
1452 void Read_FontCode( USHORT
, const BYTE
*, short nLen
);
1453 void Read_FontSize( USHORT
, const BYTE
*, short nLen
);
1454 void Read_CharSet(USHORT
, const BYTE
* pData
, short nLen
);
1455 void Read_Language( USHORT
, const BYTE
*, short nLen
);
1456 void Read_CColl( USHORT
, const BYTE
*, short nLen
);
1457 void Read_Kern( USHORT
, const BYTE
* pData
, short nLen
);
1458 void Read_FontKern( USHORT
, const BYTE
* pData
, short nLen
);
1459 void Read_Emphasis( USHORT
, const BYTE
* pData
, short nLen
);
1460 void Read_ScaleWidth( USHORT
, const BYTE
* pData
, short nLen
);
1461 void Read_Relief( USHORT
, const BYTE
* pData
, short nLen
);
1462 void Read_TxtAnim( USHORT
, const BYTE
* pData
, short nLen
);
1464 void Read_NoLineNumb( USHORT nId
, const BYTE
* pData
, short nLen
);
1466 void Read_LR( USHORT nId
, const BYTE
*, short nLen
);
1467 void Read_UL( USHORT nId
, const BYTE
*, short nLen
);
1468 void Read_ParaAutoBefore(USHORT
, const BYTE
*pData
, short nLen
);
1469 void Read_ParaAutoAfter(USHORT
, const BYTE
*pData
, short nLen
);
1470 void Read_DontAddEqual(USHORT
, const BYTE
*pData
, short nLen
);
1471 void Read_LineSpace( USHORT
, const BYTE
*, short nLen
);
1472 void Read_Justify(USHORT
, const BYTE
*, short nLen
);
1473 void Read_IdctHint(USHORT
, const BYTE
*, short nLen
);
1474 bool IsRightToLeft();
1475 void Read_RTLJustify(USHORT
, const BYTE
*, short nLen
);
1476 void Read_Hyphenation( USHORT
, const BYTE
* pData
, short nLen
);
1477 void Read_WidowControl( USHORT
, const BYTE
* pData
, short nLen
);
1478 void Read_AlignFont( USHORT
, const BYTE
* pData
, short nLen
);
1479 void Read_UsePgsuSettings( USHORT
, const BYTE
* pData
, short nLen
);
1480 void Read_KeepLines( USHORT
, const BYTE
* pData
, short nLen
);
1481 void Read_KeepParas( USHORT
, const BYTE
* pData
, short nLen
);
1482 void Read_BreakBefore( USHORT
, const BYTE
* pData
, short nLen
);
1483 void Read_Apo(USHORT nId
, const BYTE
* pData
, short nLen
);
1484 void Read_ApoPPC(USHORT
, const BYTE
* pData
, short);
1486 void Read_BoolItem( USHORT nId
, const BYTE
*, short nLen
);
1488 void Read_Border( USHORT nId
, const BYTE
* pData
, short nLen
);
1489 void Read_Tab( USHORT nId
, const BYTE
* pData
, short nLen
);
1490 void Read_Symbol(USHORT
, const BYTE
* pData
, short nLen
);
1491 void Read_FldVanish( USHORT nId
, const BYTE
* pData
, short nLen
);
1493 // Revision Marks ( == Redlining )
1495 // insert or delete content (change char attributes resp.)
1496 void Read_CRevisionMark(RedlineType_t eType
, const BYTE
* pData
, short nLen
);
1497 // insert new content
1498 void Read_CFRMark(USHORT
, const BYTE
* pData
, short nLen
);
1499 // delete old content
1500 void Read_CFRMarkDel(USHORT
, const BYTE
* pData
, short nLen
);
1501 // change properties of content (e.g. char formating)
1502 void Read_CPropRMark(USHORT
, const BYTE
* pData
, short nLen
); // complex!
1505 void Read_TabRowEnd( USHORT
, const BYTE
* pData
, short nLen
);
1506 void Read_TabCellEnd( USHORT
, const BYTE
* pData
, short nLen
);
1507 static bool ParseTabPos(WW8_TablePos
*aTabPos
, WW8PLCFx_Cp_FKP
* pPap
);
1508 void Read_Shade( USHORT
, const BYTE
* pData
, short nLen
);
1509 void Read_ANLevelNo( USHORT
, const BYTE
* pData
, short nLen
);
1510 void Read_ANLevelDesc( USHORT
, const BYTE
* pData
, short nLen
);
1512 // Gliederungsebene Ver8
1513 void Read_POutLvl(USHORT
, const BYTE
* pData
, short nLen
);
1515 void Read_OLST( USHORT
, const BYTE
* pData
, short nLen
);
1517 void Read_CharShadow( USHORT
, const BYTE
* pData
, short nLen
);
1518 void Read_CharHighlight( USHORT
, const BYTE
* pData
, short nLen
);
1521 void Read_ListLevel( USHORT nId
, const sal_uInt8
* pData
, short nLen
);
1522 void Read_LFOPosition( USHORT nId
, const sal_uInt8
* pData
, short nLen
);
1523 bool SetTxtFmtCollAndListLevel(const SwPaM
& rRg
, SwWW8StyInf
& rStyleInfo
);
1525 void Read_StyleCode(USHORT
, const BYTE
* pData
, short nLen
);
1526 void Read_Majority(USHORT
, const BYTE
* , short );
1527 void Read_DoubleLine_Rotate( USHORT
, const BYTE
* pDATA
, short nLen
);
1529 void Read_TxtForeColor(USHORT
, const BYTE
* pData
, short nLen
);
1530 void Read_TxtBackColor(USHORT
, const BYTE
* pData
, short nLen
);
1531 void Read_ParaBackColor(USHORT
, const BYTE
* pData
, short nLen
);
1532 void Read_ParaBiDi(USHORT
, const BYTE
* pData
, short nLen
);
1533 static sal_uInt32
ExtractColour(const BYTE
* &rpData
, bool bVer67
);
1535 long MapBookmarkVariables(const WW8FieldDesc
* pF
,String
&rOrigName
,
1536 const String
&rData
);
1537 String
GetMappedBookmark(const String
&rOrigName
);
1540 eF_ResT
Read_F_Input(WW8FieldDesc
*, String
& rStr
);
1541 eF_ResT
Read_F_InputVar(WW8FieldDesc
*, String
& rStr
);
1542 eF_ResT
Read_F_ANumber( WW8FieldDesc
*, String
& );
1543 eF_ResT
Read_F_DocInfo( WW8FieldDesc
* pF
, String
& rStr
);
1544 eF_ResT
Read_F_Author( WW8FieldDesc
*, String
& );
1545 eF_ResT
Read_F_TemplName( WW8FieldDesc
*, String
& );
1546 short GetTimeDatePara(String
& rStr
, sal_uInt32
& rFormat
, USHORT
&rLang
,
1547 int nWhichDefault
, bool bHijri
= false);
1548 bool ForceFieldLanguage(SwField
&rFld
, USHORT nLang
);
1549 eF_ResT
Read_F_DateTime( WW8FieldDesc
*, String
& rStr
);
1550 eF_ResT
Read_F_FileName( WW8FieldDesc
*, String
& rStr
);
1551 eF_ResT
Read_F_Anz( WW8FieldDesc
* pF
, String
& );
1552 eF_ResT
Read_F_CurPage( WW8FieldDesc
*, String
& );
1553 eF_ResT
Read_F_Ref( WW8FieldDesc
* pF
, String
& );
1555 eF_ResT
Read_F_Set( WW8FieldDesc
*, String
& rStr
);
1556 eF_ResT
Read_F_PgRef( WW8FieldDesc
*, String
& rStr
);
1557 eF_ResT
Read_F_NoteReference( WW8FieldDesc
* pF
, String
& rStr
);
1559 eF_ResT
Read_F_Tox( WW8FieldDesc
* pF
, String
& rStr
);
1560 bool AddExtraOutlinesAsExtraStyles(SwTOXBase
& rBase
);
1561 eF_ResT
Read_F_Symbol( WW8FieldDesc
*, String
& rStr
);
1562 eF_ResT
Read_F_Embedd( WW8FieldDesc
*, String
& rStr
);
1563 eF_ResT
Read_F_FormTextBox( WW8FieldDesc
* pF
, String
& rStr
);
1564 eF_ResT
Read_F_FormCheckBox( WW8FieldDesc
* pF
, String
& rStr
);
1565 eF_ResT
Read_F_FormListBox( WW8FieldDesc
* pF
, String
& rStr
);
1566 com::sun::star::awt::Size
MiserableDropDownFormHack(const String
&rString
,
1567 com::sun::star::uno::Reference
<com::sun::star::beans::XPropertySet
>&
1570 eF_ResT
Read_F_Macro( WW8FieldDesc
*, String
& rStr
);
1571 eF_ResT
Read_F_DBField( WW8FieldDesc
*, String
& rStr
);
1572 eF_ResT
Read_F_DBNext( WW8FieldDesc
*, String
& );
1573 eF_ResT
Read_F_DBNum( WW8FieldDesc
*, String
& );
1574 eF_ResT
Read_F_Equation( WW8FieldDesc
*, String
& );
1575 void Read_SubF_Ruby( _ReadFieldParams
& rReadParam
);
1576 void Read_SubF_Combined( _ReadFieldParams
& rReadParam
);
1577 eF_ResT
Read_F_IncludePicture( WW8FieldDesc
*, String
& rStr
);
1578 eF_ResT
Read_F_IncludeText( WW8FieldDesc
*, String
& rStr
);
1579 eF_ResT
Read_F_Seq( WW8FieldDesc
*, String
& rStr
);
1581 eF_ResT
Read_F_OCX(WW8FieldDesc
*, String
&);
1582 eF_ResT
Read_F_Hyperlink(WW8FieldDesc
*, String
& rStr
);
1583 eF_ResT
Read_F_Shape(WW8FieldDesc
* pF
, String
& rStr
);
1584 eF_ResT
Read_F_HTMLControl( WW8FieldDesc
* pF
, String
& rStr
);
1587 void DeleteFormImpl();
1589 short ImportSprm( const BYTE
* pPos
, USHORT nId
= 0 );
1591 bool SearchRowEnd(WW8PLCFx_Cp_FKP
* pPap
,WW8_CP
&rStartCp
, int nLevel
) const;
1593 const WW8Fib
& GetFib() const { return *pWwFib
; }
1594 SwDoc
& GetDoc() const { return rDoc
; }
1595 USHORT
GetNAktColl() const { return nAktColl
; }
1596 void SetNAktColl( USHORT nColl
) { nAktColl
= nColl
; }
1597 void SetAktItemSet( SfxItemSet
* pItemSet
) { pAktItemSet
= pItemSet
; }
1598 USHORT
StyleUsingLFO( USHORT nLFOIndex
) const ;
1599 const SwFmt
* GetStyleWithOrgWWName( String
& rName
) const ;
1601 static bool GetPictGrafFromStream(Graphic
& rGraphic
, SvStream
& rSrc
);
1602 static void PicRead( SvStream
*pDataStream
, WW8_PIC
*pPic
, bool bVer67
);
1603 static bool ImportOleWMF( SvStorageRef xSrc1
, GDIMetaFile
&rWMF
,
1604 long &rX
, long &rY
);
1605 static ColorData
GetCol(BYTE nIco
);
1607 SwWW8ImplReader( BYTE nVersionPara
, SvStorage
* pStorage
, SvStream
* pSt
,
1608 SwDoc
& rD
, const String
& rBaseURL
, bool bNewDoc
);
1610 const String
& GetBaseURL() const { return sBaseURL
; }
1611 // Laden eines kompletten DocFiles
1612 ULONG
LoadDoc( SwPaM
&,WW8Glossary
*pGloss
=0);
1613 CharSet
GetCurrentCharSet();
1615 void PostProcessAttrs();
1618 bool CanUseRemoteLink(const String
&rGrfName
);
1619 void UseListIndent(SwWW8StyInf
&rStyle
, const SwNumFmt
&rFmt
);
1620 void SetStyleIndent(SwWW8StyInf
&rStyleInfo
, const SwNumFmt
&rFmt
);
1621 void SyncIndentWithList(SvxLRSpaceItem
&rLR
, const SwNumFmt
&rFmt
);
1622 long GetListFirstLineIndent(const SwNumFmt
&rFmt
);
1623 String
BookmarkToWriter(const String
&rBookmark
);
1624 bool RTLGraphicsHack(SwTwips
&rLeft
, SwTwips nWidth
,
1625 sal_Int16 eHoriOri
, sal_Int16 eHoriRel
, SwTwips nPageLeft
,
1626 SwTwips nPageRight
, SwTwips nPageSize
);
1627 void MatchEscherMirrorIntoFlySet(const SvxMSDffImportRec
&rRecord
,
1628 SfxItemSet
&rFlySet
);
1629 bool RTLDrawingsHack(long &rLeft
, long nWidth
,
1630 sal_Int16 eHoriOri
, sal_Int16 eHoriRel
, SwTwips nPageLeft
,
1631 SwTwips nPageRight
, SwTwips nPageSize
);
1634 /* vi:set tabstop=4 shiftwidth=4 expandtab: */