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: ww8par2.hxx,v $
10 * $Revision: 1.47.214.1 $
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 -*- */
36 #include <swtypes.hxx> // enum RndStdIds
38 #include <fmtfsize.hxx>
39 #include <fmtornt.hxx>
40 #include <fmtsrnd.hxx>
41 #include <svx/lrspitem.hxx>
44 #include "ww8scan.hxx" // class WW8Style
47 #include "ww8par.hxx" // WW8_BRC5
52 class WW8DupProperties
55 WW8DupProperties(SwDoc
&rDoc
, SwWW8FltControlStack
*pStk
);
56 void Insert(const SwPosition
&rPos
);
59 WW8DupProperties(const WW8DupProperties
&);
60 WW8DupProperties
& operator=(const WW8DupProperties
&);
61 SwWW8FltControlStack
* pCtrlStck
;
62 SfxItemSet aChrSet
,aParSet
;
66 { // WinWord-Attribute
67 // Achtung: *Nicht* umsortieren, da Teile mit
68 // memcmp verglichen werden
70 INT16 nSp26
, nSp27
; // rohe Position
71 INT16 nSp45
, nSp28
; // Breite / Hoehe
72 INT16 nLeMgn
, nRiMgn
, nUpMgn
, nLoMgn
; // Raender
73 BYTE nSp29
; // rohe Bindung + Alignment
74 BYTE nSp37
; // Wrap-Mode ( 1 / 2; 0 = no Apo ? )
75 WW8_BRC5 brc
; // Umrandung Top, Left, Bottom, Right, Between
76 bool bBorderLines
; // Umrandungslinien
77 bool bGrafApo
; // true: Dieser Rahmen dient allein dazu, die
78 // enthaltene Grafik anders als zeichengebunden
80 bool mbVertSet
; // true if vertical positioning has been set
83 WW8FlyPara(bool bIsVer67
, const WW8FlyPara
* pSrc
= 0);
84 bool operator==(const WW8FlyPara
& rSrc
) const;
85 void Read(const BYTE
* pSprm29
, WW8PLCFx_Cp_FKP
* pPap
);
86 void ReadFull(const BYTE
* pSprm29
, SwWW8ImplReader
* pIo
);
87 void Read(const BYTE
* pSprm29
, WW8RStyle
* pStyle
);
88 void ApplyTabPos(const WW8_TablePos
*pTabPos
);
96 // 1. Teil: daraus abgeleitete Sw-Attribute
97 INT16 nXPos
, nYPos
; // Position
98 INT16 nLeMgn
, nRiMgn
; // Raender
99 INT16 nUpMgn
, nLoMgn
; // Raender
100 INT16 nWidth
, nHeight
; // Groesse
103 SwFrmSize eHeightFix
; // Hoehe Fix oder Min
104 RndStdIds eAnchor
; // Bindung
105 short eHRel
; // Seite oder Seitenrand
106 short eVRel
; // Seite oder Seitenrand
107 sal_Int16 eVAlign
; // Oben, unten, mittig
108 sal_Int16 eHAlign
; // links, rechts, mittig
109 SwSurround eSurround
; // Wrap-Mode
111 BYTE nXBind
, nYBind
; // relativ zu was gebunden
113 // 2.Teil: sich waehrend des Einlesens ergebende AEnderungen
115 SwPosition
* pMainTextPos
; // um nach Apo in Haupttext zurueckzukehren
116 USHORT nLineSpace
; // LineSpace in tw fuer Graf-Apos
120 // --> OD 2007-07-03 #148498#
121 // add parameter <nWWPgTop> - WW8's page top margin
122 WW8SwFlyPara( SwPaM
& rPaM
,
123 SwWW8ImplReader
& rIo
,
125 const sal_uInt32 nWWPgTop
,
126 const sal_uInt32 nPgLeft
,
127 const sal_uInt32 nPgWidth
,
128 const INT32 nIniFlyDx
,
129 const INT32 nIniFlyDy
);
131 void BoxUpWidth( long nWidth
);
132 SwWW8FltAnchorStack
*pOldAnchorStck
;
140 rtl_TextEncoding eLTRFontSrcCharSet
; // rtl_TextEncoding fuer den Font
141 rtl_TextEncoding eRTLFontSrcCharSet
; // rtl_TextEncoding fuer den Font
142 rtl_TextEncoding eCJKFontSrcCharSet
; // rtl_TextEncoding fuer den Font
145 SwNumRule
* pOutlineNumrule
;
151 BYTE nOutlineLevel
; // falls Gliederungs-Style
152 sal_uInt16 n81Flags
; // Fuer Bold, Italic, ...
153 sal_uInt16 n81BiDiFlags
; // Fuer Bold, Italic, ...
154 SvxLRSpaceItem maWordLR
;
155 bool bValid
; // leer oder Valid
156 bool bImported
; // fuers rekursive Importieren
157 bool bColl
; // true-> pFmt ist SwTxtFmtColl
158 bool bImportSkipped
; // nur true bei !bNewDoc && vorh. Style
159 bool bHasStyNumRule
; // true-> Benannter NumRule in Style
160 bool bHasBrokenWW6List
; // true-> WW8+ style has a WW7- list
161 bool bListReleventIndentSet
; //true if this style's indent has
162 //been explicitly set, it's set to the value
163 //of pFmt->GetItemState(RES_LR_SPACE, false)
164 //if it was possible to get the ItemState
165 //for L of the LR space independantly
166 bool bParaAutoBefore
; // For Auto spacing before a paragraph
167 bool bParaAutoAfter
; // For Auto Spacing after a paragraph
170 sWWStyleName( aEmptyStr
),
172 eLTRFontSrcCharSet(0),
173 eRTLFontSrcCharSet(0),
174 eCJKFontSrcCharSet(0),
177 pOutlineNumrule( 0 ),
181 nLFOIndex( USHRT_MAX
),
182 nListLevel(WW8ListManager::nMaxLevel
),
183 nOutlineLevel( MAXLEVEL
),
186 maWordLR( RES_LR_SPACE
),
190 bImportSkipped(false),
191 bHasStyNumRule(false),
192 bHasBrokenWW6List(false),
193 bListReleventIndentSet(false),
194 bParaAutoBefore(false),
195 bParaAutoAfter(false)
204 void SetOrgWWIdent( const String
& rName
, const USHORT nId
)
206 sWWStyleName
= rName
;
209 USHORT
GetWWStyleId() const { return nWWStyleId
; }
210 const String
& GetOrgWWName() const
214 bool IsOutline() const
216 return (pFmt
&& (MAXLEVEL
> nOutlineLevel
));
218 bool IsOutlineNumbered() const
220 return pOutlineNumrule
&& IsOutline();
222 const SwNumRule
* GetOutlineNumrule() const
224 return pOutlineNumrule
;
226 CharSet
GetCharSet() const;
227 CharSet
GetCJKCharSet() const;
230 class WW8RStyle
: public WW8Style
232 friend class SwWW8ImplReader
;
233 wwSprmParser maSprmParser
;
234 SwWW8ImplReader
* pIo
; // Parser-Klasse
235 SvStream
* pStStrm
; // Input-File
237 SwNumRule
* pStyRule
; // Bullets und Aufzaehlungen in Styles
239 BYTE
* pParaSprms
; // alle ParaSprms des UPX falls UPX.Papx
240 USHORT nSprmsLen
; // Laenge davon
242 BYTE nWwNumLevel
; // fuer Bullets und Aufzaehlungen in Styles
245 bool bFontChanged
; // For Simulating Default-Font
246 bool bCJKFontChanged
; // For Simulating Default-CJK Font
247 bool bCTLFontChanged
; // For Simulating Default-CTL Font
248 bool bFSizeChanged
; // For Simulating Default-FontSize
249 bool bFCTLSizeChanged
; // For Simulating Default-CTL FontSize
250 bool bWidowsChanged
; // For Simulating Default-Widows / Orphans
252 void ImportSprms(sal_Size nPosFc
, short nLen
, bool bPap
);
253 void ImportSprms(BYTE
*pSprms
, short nLen
, bool bPap
);
254 void ImportGrupx(short nLen
, bool bPara
, bool bOdd
);
255 short ImportUPX(short nLen
, bool bPAP
, bool bOdd
);
257 void Set1StyleDefaults();
258 void Import1Style(USHORT nNr
);
259 void RecursiveReg(USHORT nNr
);
263 void ImportNewFormatStyles();
265 void ImportOldFormatStyles();
267 bool PrepareStyle(SwWW8StyInf
&rSI
, ww::sti eSti
, sal_uInt16 nThisStyle
, sal_uInt16 nNextStyle
);
268 void PostStyle(SwWW8StyInf
&rSI
, bool bOldNoImp
);
271 WW8RStyle(const WW8RStyle
&);
272 WW8RStyle
& operator=(const WW8RStyle
&);
274 WW8RStyle( WW8Fib
& rFib
, SwWW8ImplReader
* pI
);
276 void PostProcessStyles();
277 const BYTE
* HasParaSprm( USHORT nId
) const;
280 class WW8FlySet
: public SfxItemSet
284 const WW8FlySet
& operator=(const WW8FlySet
&);
285 void Init(const SwWW8ImplReader
& rReader
, const SwPaM
* pPaM
);
287 WW8FlySet(SwWW8ImplReader
& rReader
, const WW8FlyPara
* pFW
,
288 const WW8SwFlyPara
* pFS
, bool bGraf
);
289 WW8FlySet(SwWW8ImplReader
& rReader
, const SwPaM
* pPaM
, const WW8_PIC
& rPic
,
290 long nWidth
, long nHeight
);
291 WW8FlySet(const SwWW8ImplReader
& rReader
, const SwPaM
* pPaM
);
294 enum WW8LvlType
{WW8_None
, WW8_Outline
, WW8_Numbering
, WW8_Sequence
, WW8_Pause
};
296 WW8LvlType
GetNumType(BYTE nWwLevelNo
);
299 /* vi:set tabstop=4 shiftwidth=4 expandtab: */