xref: /aoo4110/main/sw/source/filter/html/swhtml.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SWHTML_HXX
24 #define _SWHTML_HXX
25 
26 #if !defined(_SVSTDARR_XUB_STRLEN_DECL) || !defined(_SVSTDARR_LONGS_DECL) || \
27 	!defined(_SVSTDARR_USHORTS_DECL) || !defined(_SVSTDARR_STRINGSDTOR_DECL)
28 #ifndef _SVSTDARR_XUB_STRLEN_DECL
29 #define _SVSTDARR_XUB_STRLEN
30 #endif
31 #ifndef _SVSTDARR_LONGS_DECL
32 #define _SVSTDARR_LONGS
33 #endif
34 #ifndef _SVSTDARR_USHORTS_DECL
35 #define _SVSTDARR_USHORTS
36 #endif
37 #ifndef _SVSTDARR_STRINGSDTOR_DECL
38 #define _SVSTDARR_STRINGSDTOR
39 #endif
40 #include <svl/svstdarr.hxx>
41 #endif
42 #include <tools/urlobj.hxx>
43 #include <sfx2/sfxhtml.hxx>
44 #include <svl/macitem.hxx>
45 #include <editeng/svxenum.hxx>
46 #include <fmtornt.hxx>
47 #include <com/sun/star/drawing/XShape.hpp>
48 #include <com/sun/star/form/XFormComponent.hpp>
49 #include <pam.hxx>
50 
51 #include "calbck.hxx"
52 #include "htmlvsh.hxx"
53 
54 class SfxMedium;
55 class SfxViewFrame;
56 class SdrObject;
57 class SvxMacroTableDtor;
58 class SvStringsDtor;
59 class SwDoc;
60 class SwPaM;
61 class ViewShell;
62 class SwStartNode;
63 class SwFmtColl;
64 class SwField;
65 class SwHTMLForm_Impl;
66 class SwApplet_Impl;
67 struct SwHTMLFootEndNote_Impl;
68 class HTMLTableCnts;
69 struct SwPendingStack;
70 class SvxCSS1PropertyInfo;
71 
72 #define HTML_PARSPACE (MM50)
73 
74 #define HTML_DFLT_IMG_WIDTH (MM50*4)
75 #define HTML_DFLT_IMG_HEIGHT (MM50*2)
76 
77 // ein par Sachen, die man oefter mal braucht
78 extern HTMLOptionEnum __FAR_DATA aHTMLPAlignTable[];
79 extern HTMLOptionEnum __FAR_DATA aHTMLImgHAlignTable[];
80 extern HTMLOptionEnum __FAR_DATA aHTMLImgVAlignTable[];
81 
82 
83 // der Attribut Stack:
84 
85 class _HTMLAttr;
86 typedef _HTMLAttr *_HTMLAttrPtr;
87 SV_DECL_PTRARR( _HTMLAttrs, _HTMLAttrPtr, 5, 5 )
88 
89 class _HTMLAttr
90 {
91 	friend class SwHTMLParser;
92 	friend class _CellSaveStruct;
93 
94 	SwNodeIndex nSttPara, nEndPara;
95 	xub_StrLen nSttCntnt, nEndCntnt;
96 	sal_Bool bInsAtStart : 1;
97 	sal_Bool bLikePara : 1; // Attribut ueber dem gesamten Absatz setzen
98 	sal_Bool bValid : 1;	// ist das Attribut gueltig?
99 
100 	SfxPoolItem* pItem;
101 	sal_uInt16 nCount;		// Anzahl noch zu schliessender Attrs mit einem Wert
102 	_HTMLAttr *pNext;	// noch zu schliessene Attrs mit unterschiedl. Werten
103 	_HTMLAttr *pPrev;	// bereits geschlossene aber noch nicht gesetze Attrs
104 	_HTMLAttr **ppHead;	// der Listenkopf
105 
106 	_HTMLAttr( const SwPosition& rPos, const SfxPoolItem& rItem,
107 			   _HTMLAttr **pHd=0 );
108 
109 	_HTMLAttr( const _HTMLAttr &rAttr, const SwNodeIndex &rEndPara,
110 			   xub_StrLen nEndCnt, _HTMLAttr **pHd );
111 
112 public:
113 
114 	~_HTMLAttr();
115 
116 	_HTMLAttr *Clone( const SwNodeIndex& rEndPara, xub_StrLen nEndCnt ) const;
117 	void Reset( const SwNodeIndex& rSttPara, xub_StrLen nSttCnt,
118 			    _HTMLAttr **pHd );
119 	inline void SetStart( const SwPosition& rPos );
120 
GetSttParaIdx() const121 	sal_uInt32 GetSttParaIdx() const { return nSttPara.GetIndex(); }
GetEndParaIdx() const122 	sal_uInt32 GetEndParaIdx() const { return nEndPara.GetIndex(); }
123 
GetSttPara() const124 	const SwNodeIndex& GetSttPara() const { return nSttPara; }
GetEndPara() const125 	const SwNodeIndex& GetEndPara() const { return nEndPara; }
126 
GetSttCnt() const127 	xub_StrLen GetSttCnt() const { return nSttCntnt; }
GetEndCnt() const128 	xub_StrLen GetEndCnt() const { return nEndCntnt; }
129 
IsLikePara() const130 	sal_Bool IsLikePara() const { return bLikePara; }
SetLikePara(sal_Bool bPara=sal_True)131 	void SetLikePara( sal_Bool bPara=sal_True ) { bLikePara = bPara; }
132 
GetItem()133 		  SfxPoolItem& GetItem()		{ return *pItem; }
GetItem() const134 	const SfxPoolItem& GetItem() const	{ return *pItem; }
135 
GetNext() const136 	_HTMLAttr *GetNext() const { return pNext; }
InsertNext(_HTMLAttr * pNxt)137 	void InsertNext( _HTMLAttr *pNxt ) { pNext = pNxt; }
138 
GetPrev() const139 	_HTMLAttr *GetPrev() const { return pPrev; }
140 	void InsertPrev( _HTMLAttr *pPrv );
ClearPrev()141 	void ClearPrev() { pPrev = 0; }
142 
SetHead(_HTMLAttr ** ppHd)143 	void SetHead( _HTMLAttr **ppHd ) { ppHead = ppHd; }
144 
145 	// Beim Setzen von Attributen aus Vorlagen kann es passieren,
146 	// dass Attribute doch nicht mehr gesetzt werden sollen. Die zu loeschen
147 	// waere sehr aufwendig, da man nicht so genau weiss, wo sie eingekettet
148 	// sind. Sie werden deshalb einfach invalidiert und erst beim naechsten
149 	// _SetAttr() geloescht.
Invalidate()150 	void Invalidate() { bValid = sal_False; }
IsValid() const151 	sal_Bool IsValid() const { return bValid; }
152 };
153 
154 // Tabelle der Attribute: Hier ist die Reihenfolge wichtig: Die Attribute
155 // vorne in der Tabelle werden in EndAllAttrs auch zuerst gesetzt.
156 struct _HTMLAttrTable
157 {
158 	_HTMLAttr
159 				*pKeep,			// ::com::sun::star::frame::Frame-Attribure
160 				*pBox,
161 				*pBrush,
162 				*pBreak,
163 				*pPageDesc,
164 
165 				*pLRSpace,		// Absatz-Attribute
166 				*pULSpace,
167 				*pLineSpacing,
168 				*pAdjust,
169 				*pDropCap,
170 				*pSplit,
171 				*pWidows,
172 				*pOrphans,
173 				*pDirection,
174 
175 				*pCharFmts,		// Text-Attribute
176 				*pINetFmt,
177 
178 				*pBold,			// Zeichen-Attribute
179 				*pBoldCJK,
180 				*pBoldCTL,
181 				*pItalic,
182 				*pItalicCJK,
183 				*pItalicCTL,
184 				*pStrike,
185 				*pUnderline,
186 				*pBlink,
187 				*pFont,
188 				*pFontCJK,
189 				*pFontCTL,
190 				*pFontHeight,
191 				*pFontHeightCJK,
192 				*pFontHeightCTL,
193 				*pFontColor,
194 				*pEscapement,
195 				*pCaseMap,
196 				*pKerning,		// (nur fuer SPACER)
197 				*pCharBrush,	// Zeichen-Hintergrund
198 				*pLanguage,
199 				*pLanguageCJK,
200 				*pLanguageCTL
201 				;
202 };
203 
204 class _HTMLAttrContext_SaveDoc;
205 
206 enum SwHTMLAppendMode {
207 	 AM_NORMAL, 		// keine Absatz-Abstand-Behandlung
208 	 AM_NOSPACE, 		// Abstand hart auf 0cm setzen
209 	 AM_SPACE, 			// Abstand hart auf 0.5cm setzen
210 	 AM_SOFTNOSPACE, 	// Abstand nicht setzen aber 0cm merken
211 	 AM_NONE			// gar kein Append
212 };
213 
214 class _HTMLAttrContext
215 {
216 	_HTMLAttrs aAttrs;		// die in dem Kontext gestarteten Attribute
217 
218 	String aClass;			// die Klasse des Kontexts
219 
220 	_HTMLAttrContext_SaveDoc *pSaveDocContext;
221 	SfxItemSet *pFrmItemSet;
222 
223 	sal_uInt16 	nToken;			// das Token, zu dem der Kontext gehoehrt
224 
225 	sal_uInt16 	nTxtFmtColl;	// eine in dem Kontext begonnene Vorlage oder 0
226 
227 	sal_uInt16 	nLeftMargin;		// ein veraenderter linker Rand
228 	sal_uInt16 	nRightMargin;		// ein veraenderter rechter Rand
229 	sal_uInt16	nFirstLineIndent;	// ein veraenderter Erstzeilen-Einzug
230 
231 	sal_uInt16	nUpperSpace;
232 	sal_uInt16	nLowerSpace;
233 
234 	SwHTMLAppendMode eAppend;
235 
236 	sal_Bool	bLRSpaceChanged : 1;// linker/rechtr Rand, Einzug veraendert?
237 	sal_Bool	bULSpaceChanged : 1;// oberer/unterer Rand veraendert?
238 	sal_Bool	bDfltTxtFmtColl : 1;// nTxtFmtColl ist nur ein default
239 	sal_Bool	bSpansSection : 1; 	// Der Kontext spannt eine SwSection auf
240 	sal_Bool	bPopStack : 1; 		// Oberhalb liegende Stack-Elemente entf.
241 	sal_Bool	bFinishPREListingXMP : 1;
242 	sal_Bool	bRestartPRE : 1;
243 	sal_Bool	bRestartXMP : 1;
244 	sal_Bool	bRestartListing : 1;
245 
246 public:
247 	void ClearSaveDocContext();
248 
_HTMLAttrContext(sal_uInt16 nTokn,sal_uInt16 nPoolId,const String & rClass,sal_Bool bDfltColl=sal_False)249 	_HTMLAttrContext( sal_uInt16 nTokn, sal_uInt16 nPoolId, const String& rClass,
250 					  sal_Bool bDfltColl=sal_False ) :
251 		aClass( rClass ),
252 		pSaveDocContext( 0 ),
253 		pFrmItemSet( 0 ),
254 		nToken( nTokn ),
255 		nTxtFmtColl( nPoolId ),
256 		nLeftMargin( 0 ),
257 		nRightMargin( 0 ),
258 		nFirstLineIndent( 0 ),
259 		nUpperSpace( 0 ),
260 		nLowerSpace( 0 ),
261 		eAppend( AM_NONE ),
262 		bLRSpaceChanged( sal_False ),
263 		bULSpaceChanged( sal_False ),
264 		bDfltTxtFmtColl( bDfltColl ),
265 		bSpansSection( sal_False ),
266 		bPopStack( sal_False ),
267 		bFinishPREListingXMP( sal_False ),
268 		bRestartPRE( sal_False ),
269 		bRestartXMP( sal_False ),
270 		bRestartListing( sal_False )
271 	{}
272 
_HTMLAttrContext(sal_uInt16 nTokn)273 	_HTMLAttrContext( sal_uInt16 nTokn ) :
274 		pSaveDocContext( 0 ),
275 		pFrmItemSet( 0 ),
276 		nToken( nTokn ),
277 		nTxtFmtColl( 0 ),
278 		nLeftMargin( 0 ),
279 		nRightMargin( 0 ),
280 		nFirstLineIndent( 0 ),
281 		nUpperSpace( 0 ),
282 		nLowerSpace( 0 ),
283 		eAppend( AM_NONE ),
284 		bLRSpaceChanged( sal_False ),
285 		bULSpaceChanged( sal_False ),
286 		bDfltTxtFmtColl( sal_False ),
287 		bSpansSection( sal_False ),
288 		bPopStack( sal_False ),
289 		bFinishPREListingXMP( sal_False ),
290 		bRestartPRE( sal_False ),
291 		bRestartXMP( sal_False ),
292 		bRestartListing( sal_False )
293 	{}
294 
~_HTMLAttrContext()295 	~_HTMLAttrContext() { ClearSaveDocContext(); delete pFrmItemSet; }
296 
GetToken() const297 	sal_uInt16 GetToken() const { return nToken; }
298 
GetTxtFmtColl() const299 	sal_uInt16 GetTxtFmtColl() const { return bDfltTxtFmtColl ? 0 : nTxtFmtColl; }
GetDfltTxtFmtColl() const300 	sal_uInt16 GetDfltTxtFmtColl() const { return bDfltTxtFmtColl ? nTxtFmtColl : 0; }
301 
GetClass() const302 	const String& GetClass() const { return aClass; }
303 
304 	inline void SetMargins( sal_uInt16 nLeft, sal_uInt16 nRight, short nIndent );
305 
IsLRSpaceChanged() const306 	inline sal_Bool IsLRSpaceChanged() const { return bLRSpaceChanged; }
307 	inline void GetMargins( sal_uInt16& nLeft, sal_uInt16& nRight,
308 							short &nIndent ) const;
309 
310 	inline void SetULSpace( sal_uInt16 nUpper, sal_uInt16 nLower );
IsULSpaceChanged() const311 	inline sal_Bool IsULSpaceChanged() const { return bULSpaceChanged; }
312 	inline void GetULSpace( sal_uInt16& rUpper, sal_uInt16& rLower ) const;
313 
HasAttrs() const314 	sal_Bool HasAttrs() const { return aAttrs.Count() != 0; }
GetAttrs() const315 	const _HTMLAttrs& GetAttrs() const { return aAttrs; }
GetAttrs()316 	_HTMLAttrs& GetAttrs() { return aAttrs; }
317 
SetSpansSection(sal_Bool bSet)318 	void SetSpansSection( sal_Bool bSet ) { bSpansSection = bSet; }
GetSpansSection() const319 	sal_Bool GetSpansSection() const { return bSpansSection; }
320 
SetPopStack(sal_Bool bSet)321 	void SetPopStack( sal_Bool bSet ) { bPopStack = bSet; }
GetPopStack() const322 	sal_Bool GetPopStack() const { return bPopStack; }
323 
HasSaveDocContext() const324 	sal_Bool HasSaveDocContext() const { return pSaveDocContext!=0; }
325 	_HTMLAttrContext_SaveDoc *GetSaveDocContext( sal_Bool bCreate=sal_False );
326 
GetFrmItemSet() const327 	const SfxItemSet *GetFrmItemSet() const { return pFrmItemSet; }
328 	SfxItemSet *GetFrmItemSet( SwDoc *pCreateDoc );
329 
SetFinishPREListingXMP(sal_Bool bSet)330 	void SetFinishPREListingXMP( sal_Bool bSet ) { bFinishPREListingXMP = bSet; }
IsFinishPREListingXMP() const331 	sal_Bool IsFinishPREListingXMP() const { return bFinishPREListingXMP; }
332 
SetRestartPRE(sal_Bool bSet)333 	void SetRestartPRE( sal_Bool bSet ) { bRestartPRE = bSet; }
IsRestartPRE() const334 	sal_Bool IsRestartPRE() const { return bRestartPRE; }
335 
SetRestartXMP(sal_Bool bSet)336 	void SetRestartXMP( sal_Bool bSet ) { bRestartXMP = bSet; }
IsRestartXMP() const337 	sal_Bool IsRestartXMP() const { return bRestartXMP; }
338 
SetRestartListing(sal_Bool bSet)339 	void SetRestartListing( sal_Bool bSet ) { bRestartListing = bSet; }
IsRestartListing() const340 	sal_Bool IsRestartListing() const { return bRestartListing; }
341 
SetAppendMode(SwHTMLAppendMode eMode=AM_NORMAL)342 	void SetAppendMode( SwHTMLAppendMode eMode=AM_NORMAL ) { eAppend = eMode; }
GetAppendMode() const343 	SwHTMLAppendMode GetAppendMode() const { return eAppend; }
344 };
345 
346 typedef _HTMLAttrContext *_HTMLAttrContextPtr;
347 SV_DECL_PTRARR( _HTMLAttrContexts, _HTMLAttrContextPtr, 5, 5 )
348 
349 class HTMLTable;
350 class SwCSS1Parser;
351 class SwHTMLNumRuleInfo;
352 
353 typedef ImageMap *ImageMapPtr;
354 SV_DECL_PTRARR_DEL( ImageMaps, ImageMapPtr, 1, 1 )
355 typedef SwFrmFmt *SwFrmFmtPtr;
356 SV_DECL_PTRARR( SwHTMLFrmFmts, SwFrmFmtPtr, 2, 2 )
357 
358 #define HTML_CNTXT_PROTECT_STACK	0x0001
359 #define HTML_CNTXT_STRIP_PARA		0x0002
360 #define HTML_CNTXT_KEEP_NUMRULE		0x0004
361 #define HTML_CNTXT_HEADER_DIST		0x0008
362 #define HTML_CNTXT_FOOTER_DIST	 	0x0010
363 #define HTML_CNTXT_KEEP_ATTRS		0x0020
364 
365 #define CONTEXT_FLAGS_ABSPOS	\
366 	(HTML_CNTXT_PROTECT_STACK | \
367 	 HTML_CNTXT_STRIP_PARA)
368 
369 #define HTML_FF_BOX		 			0x0001
370 #define HTML_FF_BACKGROUND			0x0002
371 #define HTML_FF_PADDING				0x0004
372 #define HTML_FF_DIRECTION			0x0008
373 
374 class SwHTMLParser : public SfxHTMLParser, public SwClient
375 {
376 	friend class _SectionSaveStruct;
377 	friend class _CellSaveStruct;
378 	friend class _CaptionSaveStruct;
379 
380 	String		aPathToFile;
381 	String		sBaseURL;
382 	String		sSaveBaseURL;
383 	String		aBasicLib;
384 	String		aBasicModule;
385 	String		aScriptSource;	// Inhalt des aktuellen Script-Blocks
386 	String		aScriptType;	// Type des gelesenen Scripts (StarBasic/VB/JAVA)
387 	String		aScriptURL;		// URL eines Scripts
388 	String		aStyleSource;	// Inhalt des aktuellen Style-Sheets
389 	String		aContents;		// Text des akteullen Marquee, Feldes etc.
390 	String		sTitle;
391 	String		aUnknownToken;	// ein gestartetes unbekanntes Token
392 	String		aBulletGrfs[MAXLEVEL];
393 	String		sJmpMark;
394 
395 	SvUShorts	aBaseFontStack; // Stack fuer <BASEFONT>
396 								// Bit 0-2: Fontgroesse (1-7)
397 	SvUShorts	aFontStack; 	// Stack fuer <FONT>, <BIG>, <SMALL>
398 								// Bit 0-2: Fontgroesse (1-7)
399 								// Bit 15: Fontfarbe wurde gesetzt
400 
401 	_HTMLAttrs		aSetAttrTab;// "geschlossene", noch nicht gesetzte Attr.
402 	_HTMLAttrs		aParaAttrs;	// vorlauefige Absatz-Attribute
403 	_HTMLAttrTable	aAttrTab;	// "offene" Attribute
404 	_HTMLAttrContexts aContexts;// der aktuelle Attribut/Token-Kontext
405 	SwHTMLFrmFmts	aMoveFlyFrms;// Fly-Frames, the anchor is moved
406 	SvXub_StrLens	aMoveFlyCnts;// and the Content-Positions
407 
408 	SwApplet_Impl *pAppletImpl;	// das aktuelle Applet
409 
410 	SwCSS1Parser 	*pCSS1Parser;	// der Style-Sheet-Parser
411 	SwHTMLNumRuleInfo *pNumRuleInfo;
412 	SwPendingStack	*pPendStack;
413 
414 	SwDoc			*pDoc;
415 	SwPaM			*pPam;		// SwPosition duerfte doch reichen, oder ??
416 	ViewShell		*pActionViewShell;	// ViewShell, an der das StartAction
417 										// gerufen wurde.
418 	SwNodeIndex		*pSttNdIdx;
419 
420 	HTMLTable		*pTable;	// die aktuelle "auesserste" Tabelle
421 	SwHTMLForm_Impl *pFormImpl;// die aktuelle Form
422 	SdrObject		*pMarquee;	// aktuelles Marquee
423 	SwField			*pField;	// aktuelles Feld
424 	ImageMap		*pImageMap;	// aktuelle Image-Map
425 	ImageMaps		*pImageMaps;// alle gelesenen Image-Maps
426 	SwHTMLFootEndNote_Impl *pFootEndNoteImpl;
427 
428 	Size 	aHTMLPageSize;	 	// die Seitengroesse der HTML-Vorlage
429 
430 	sal_uInt32 	aFontHeights[7];	// die Font-Hoehen 1-7
431 	sal_uInt32	nScriptStartLineNr;	// Zeilennummer eines Script-Blocks
432 	sal_uLong		nEventId;
433 
434 	sal_uInt16	nBaseFontStMin;		//
435 	sal_uInt16	nFontStMin; 		//
436 	sal_uInt16	nDefListDeep;       //
437 	sal_uInt16	nFontStHeadStart;	// Elemente im Font-Stack bei <Hn>
438 	sal_uInt16	nSBModuleCnt;		// Zaehler fuer Basic-Module
439 	sal_uInt16	nMissingImgMaps;	// Wie viele Image-Maps fehlen noch?
440 	sal_uInt16 	nParaCnt;
441 	sal_uInt16	nContextStMin;		// Untergrenze fuer PopContext
442 	sal_uInt16	nContextStAttrMin;	// Untergrenze fuer Attributierung
443 	sal_uInt16	nSelectEntryCnt;	// Anzahl der Eintraege der akt. Listbox
444 	sal_uInt16	nOpenParaToken;		// ein geoeffnetes Absatz-Element
445 
446 	enum JumpToMarks { JUMPTO_NONE, JUMPTO_MARK, JUMPTO_TABLE, JUMPTO_FRAME,
447 						JUMPTO_REGION, JUMPTO_GRAPHIC } eJumpTo;
448 
449 #ifdef DBG_UTIL
450 	sal_uInt16	nContinue;			// Tiefe der Continue-Aufrufe
451 #endif
452 
453 	SvxAdjust	eParaAdjust;	// Ausrichtung des aktuellen Absatz
454 	HTMLScriptLanguage eScriptLang; // die aktuelle Script-Language
455 
456 	sal_Bool bOldIsHTMLMode : 1;	// War's mal ein HTML-Dokument?
457 
458 	sal_Bool bDocInitalized : 1;	// Dokument bzw. Shell wurden initialisiert
459 								// Flag um doppeltes init durch Rekursion
460 								// zu verhindern.
461 	sal_Bool bViewCreated : 1;		// die View wurde schon erzeugt (asynchron)
462 	sal_Bool bSetCrsr : 1;			// Crsr wieder auf den Anfang setzen
463 	sal_Bool bSetModEnabled : 1;
464 
465 	sal_Bool bInFloatingFrame : 1;	// Wir sind in einen Floating ::com::sun::star::frame::Frame
466 	sal_Bool bInField : 1;
467 	sal_Bool bKeepUnknown : 1;		// unbekannte/nicht unterstuetze Tokens beh.
468 	// 8
469 	sal_Bool bCallNextToken : 1;	// In Tabellen: NextToken in jedem Fall rufen
470 	sal_Bool bIgnoreRawData : 1;	// Inhalt eines Scripts/Styles ignorieren.
471 	sal_Bool bLBEntrySelected : 1;	// Ist der aktuelle Listbox-Eintrag selekt.
472 	sal_Bool bTAIgnoreNewPara : 1;	// naechstes LF in TextArea ignorieren?
473 	sal_Bool bFixMarqueeWidth : 1;	// Groesse einer Laufschrift anpassen?
474 	sal_Bool bFixMarqueeHeight : 1;
475 
476 	sal_Bool bUpperSpace : 1;		// obererer Absatz-Abstand wird benoetigt
477 	sal_Bool bNoParSpace : 1;
478 	// 16
479 
480 	sal_Bool bAnyStarBasic : 1;		// gibt es ueberhaupt ein StarBasic-Modul
481 	sal_Bool bInNoEmbed : 1;		// Wir sind in einem NOEMBED-Bereich
482 
483 	sal_Bool bInTitle : 1;			// Wir sind im Titel
484 
485 	sal_Bool bChkJumpMark : 1;		// springe ggfs. zu einem vorgegebenem Mark
486 	sal_Bool bUpdateDocStat : 1;
487 	sal_Bool bFixSelectWidth : 1;	// Breite eines Selects neu setzen?
488 	sal_Bool bFixSelectHeight : 1;	// Breite eines Selects neu setzen?
489 	sal_Bool bTextArea : 1;
490 	// 24
491 	sal_Bool bSelect : 1;
492 	sal_Bool bInFootEndNoteAnchor : 1;
493 	sal_Bool bInFootEndNoteSymbol : 1;
494     sal_Bool bIgnoreHTMLComments : 1;
495     sal_Bool bRemoveHidden : 1; // the filter implementation might set the hidden flag
496 
497     /// the names corresponding to the DOCINFO field subtypes INFO[1-4]
498     ::rtl::OUString m_InfoNames[4];
499 
500 	SfxViewFrame* pTempViewFrame;
501 
502 	void DeleteFormImpl();
503 
504 	void DocumentDetected();
505 	void Show();
506 	void ShowStatline();
507 	ViewShell *CallStartAction( ViewShell *pVSh = 0, sal_Bool bChkPtr = sal_True );
508 	ViewShell *CallEndAction( sal_Bool bChkAction = sal_False, sal_Bool bChkPtr = sal_True );
509 	ViewShell *CheckActionViewShell();
510 
511 	DECL_LINK( AsyncCallback, void* );
512 
513 	// Attribute am Dok setzen
514 	void _SetAttr( sal_Bool bChkEnd, sal_Bool bBeforeTable, _HTMLAttrs *pPostIts );
SetAttr(sal_Bool bChkEnd=sal_True,sal_Bool bBeforeTable=sal_False,_HTMLAttrs * pPostIts=0)515 	inline void SetAttr( sal_Bool bChkEnd = sal_True, sal_Bool bBeforeTable = sal_False,
516 						 _HTMLAttrs *pPostIts = 0 )
517 	{
518 		if( aSetAttrTab.Count() || aMoveFlyFrms.Count() )
519 			_SetAttr( bChkEnd, bBeforeTable, pPostIts );
520 	}
521 
522 	_HTMLAttr **GetAttrTabEntry( sal_uInt16 nWhich );
523 
524 	// Einen neuen Textknoten an PaM-Position anlegen
525 	sal_Bool AppendTxtNode( SwHTMLAppendMode eMode=AM_NORMAL, sal_Bool bUpdateNum=sal_True );
526 	void AddParSpace();
527 
528 	// Ein Attribut beginnen/beenden
529 	// ppDepAttr gibt einen Attribut-Tabellen-Eintrag an, dessen Attribute
530 	// gesetzt sein muessen, bevor das Attribut beendet werden darf
531 	void NewAttr( _HTMLAttr **ppAttr, const SfxPoolItem& rItem );
532 	void EndAttr( _HTMLAttr *pAttr, _HTMLAttr **ppDepAttr=0,
533 				  sal_Bool bChkEmpty=sal_True );
534 	void DeleteAttr( _HTMLAttr* pAttr );
535 
536 	void EndContextAttrs( _HTMLAttrContext *pContext, sal_Bool bRemove=sal_False );
537 	void SaveAttrTab( _HTMLAttrTable& rNewAttrTab );
538 	void SplitAttrTab( const SwPosition& rNewPos );
539 	void SplitAttrTab( _HTMLAttrTable& rNewAttrTab, sal_Bool bMoveEndBack = sal_True );
540 	void RestoreAttrTab( const _HTMLAttrTable& rNewAttrTab,
541 						 sal_Bool bSetNewStart = sal_False );
542 	void InsertAttr( const SfxPoolItem& rItem, sal_Bool bLikePara = sal_False,
543 					 sal_Bool bInsAtStart=sal_False );
544 	void InsertAttrs( _HTMLAttrs& rAttrs );
545 
546 	sal_Bool DoPositioning( SfxItemSet &rItemSet,
547 						SvxCSS1PropertyInfo &rPropInfo,
548 						_HTMLAttrContext *pContext );
549 	sal_Bool CreateContainer( const String& rClass, SfxItemSet &rItemSet,
550 						  SvxCSS1PropertyInfo &rPropInfo,
551 						  _HTMLAttrContext *pContext );
552 	sal_Bool EndSection( sal_Bool bLFStripped=sal_False );
553 
554 	void InsertAttrs( SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo,
555 					  _HTMLAttrContext *pContext, sal_Bool bCharLvl=sal_False );
556 	void InsertAttr( _HTMLAttr **ppAttr, const SfxPoolItem & rItem,
557 					 _HTMLAttrContext *pCntxt );
558 	void SplitPREListingXMP( _HTMLAttrContext *pCntxt );
559 	void FixHeaderFooterDistance( sal_Bool bHeader,	const SwPosition *pOldPos );
560 
561 	void EndContext( _HTMLAttrContext *pContext );
562 	void ClearContext( _HTMLAttrContext *pContext );
563 
564 	const SwFmtColl *GetCurrFmtColl() const;
565 
566 	SwTwips GetCurrentBrowseWidth();
567 
GetNumInfo()568 	SwHTMLNumRuleInfo& GetNumInfo() { return *pNumRuleInfo; }
569     // --> OD 2008-04-02 #refactorlists#
570     // add parameter <bCountedInList>
571     void SetNodeNum( sal_uInt8 nLevel, bool bCountedInList );
572     // <--
573 
574 	// Verwalten von Absatz-Vorlagen
575 
576 	// die Vorlagen auf dem Stack bzw. deren Attribute setzen
577 	void SetTxtCollAttrs( _HTMLAttrContext *pContext = 0 );
578 
579 	void InsertParaAttrs( const SfxItemSet& rItemSet );
580 
581 	// Verwalten des Attribut-Kontexts
582 
583 	// aktuellen Kontext merken
584 	inline void PushContext( _HTMLAttrContext *pCntxt );
585 
586 	// den obersten/spezifizierten Kontext holen, aber nicht ausserhalb
587 	// des Kontexts mit Token nLimit suchen. Wenn bRemove gesetzt ist,
588 	// wird er entfernt
589 	_HTMLAttrContext *PopContext( sal_uInt16 nToken=0, sal_uInt16 nLimit=0,
590 								  sal_Bool bRemove=sal_True );
591 	inline const _HTMLAttrContext *GetTopContext() const;
592 
593 	sal_Bool GetMarginsFromContext( sal_uInt16 &nLeft, sal_uInt16 &nRight, short& nIndent,
594 								sal_Bool bIgnoreCurrent=sal_False ) const;
595 	sal_Bool GetMarginsFromContextWithNumBul( sal_uInt16 &nLeft, sal_uInt16 &nRight,
596 										  short& nIndent ) const;
597 	void GetULSpaceFromContext( sal_uInt16 &rUpper, sal_uInt16 &rLower ) const;
598 
599 
600 	void MovePageDescAttrs( SwNode *pSrcNd, sal_uLong nDestIdx, sal_Bool bFmtBreak );
601 
602 	// Behandlung von Tags auf Absatz-Ebene
603 
604 	// <P> und <H1> bis <H6>
605 	void NewPara();
606 	void EndPara( sal_Bool bReal = sal_False );
607 	void NewHeading( int nToken );
608 	void EndHeading();
609 
610 	// <ADDRESS>, <BLOCKQUOTE> und <PRE>
611 	void NewTxtFmtColl( int nToken, sal_uInt16 nPoolId );
612 	void EndTxtFmtColl( int nToken );
613 
614 	// <DIV> und <CENTER>
615 	void NewDivision( int nToken );
616 	void EndDivision( int nToken );
617 
618 	// Fly-Frames einfuegen/verlassen
619 	void InsertFlyFrame( const SfxItemSet& rItemSet, _HTMLAttrContext *pCntxt,
620 						 const String& rId, sal_uInt16 nFlags );
621 
622 	void SaveDocContext( _HTMLAttrContext *pCntxt, sal_uInt16 nFlags,
623 					   const SwPosition *pNewPos );
624 	void RestoreDocContext( _HTMLAttrContext *pCntxt );
625 
626 	// alle durch <DIV> aufgespannten Bereiche verlassen
627 	sal_Bool EndSections( sal_Bool bLFStripped );
628 
629 	// <MULTICOL>
630 	void NewMultiCol();
631 	void EndMultiCol();
632 
633 	// <MARQUEE>
634 	void NewMarquee( HTMLTable *pCurTable=0 );
635 	void EndMarquee();
636 	void InsertMarqueeText();
637 
638 	// Behandluung von Listen
639 
640 	// Numerierungs <OL> und Aufzaehlungs-Listen <UL> mit <LI>
641 	void NewNumBulList( int nToken );
642 	void EndNumBulList( int nToken=0 );
643 	void NewNumBulListItem( int nToken );
644 	void EndNumBulListItem( int nToken=0, sal_Bool bSetColl=sal_True,
645 							sal_Bool bLastPara=sal_False );
646 
647 	// Definitions-Listen <DL> mit <DD>, <DT>
648 	void NewDefList();
649 	void EndDefList();
650 	void NewDefListItem( int nToken );
651 	void EndDefListItem( int nToken=0, sal_Bool bSetColl=sal_True,
652 						 sal_Bool bLastPara=sal_False );
653 
654 
655 	// Behandlung von Tags auf Zeichen-Ebene
656 
657 	// Tags wie <B>, <I> etc behandeln, die ein bestimmtes Attribut
658 	// an und ausschalten, oder die wie SPAN nur Attribute aus Styles holen
659 	void NewStdAttr( int nToken );
660 	void NewStdAttr( int nToken,
661 					 _HTMLAttr **ppAttr, const SfxPoolItem & rItem,
662 					 _HTMLAttr **ppAttr2=0, const SfxPoolItem *pItem2=0,
663 					 _HTMLAttr **ppAttr3=0, const SfxPoolItem *pItem3=0 );
664 	void EndTag( int nToken );
665 
666 	// Font-Attribute behandeln
667 	void NewBasefontAttr(); 			// fuer <BASEFONT>
668 	void EndBasefontAttr();
669 	void NewFontAttr( int nToken );	// fuer <FONT>, <BIG> und <SMALL>
670 	void EndFontAttr( int nToken );
671 
672 	// Tags, die durch Zeichenvorlagen realisiert werden
673 	void NewCharFmt( int nToken );
674 
675 	// <SDFIELD>
676 public:
677 	static sal_uInt16 GetNumType( const String& rStr, sal_uInt16 eDfltType );
678 private:
679 	void NewField();
680 	void EndField();
681 	void InsertFieldText();
682 
683 	// <SPACER>
684 	void InsertSpacer();
685 
686 	// Einfuegen von Grafiken, Plugins und Applets
687 
688 	// Image-Maps suchen und mit Grafik-Nodes verbinden
689 	ImageMap *FindImageMap( const String& rURL ) const;
690 	void ConnectImageMaps();
691 
692 	// Verankerung eines Fly-Frames bestimmen und entsprechende Attribute
693 	// in den Attrset setzen (htmlgrin.cxx)
694     void SetAnchorAndAdjustment( sal_Int16 eVertOri,
695                                  sal_Int16 eHoriOri,
696 								 const SfxItemSet &rItemSet,
697 								 const SvxCSS1PropertyInfo &rPropInfo,
698 								 SfxItemSet& rFrmSet );
699     void SetAnchorAndAdjustment( sal_Int16 eVertOri,
700                                  sal_Int16 eHoriOri,
701 								 SfxItemSet& rFrmSet,
702 								 sal_Bool bDontAppend=sal_False );
703 	void SetAnchorAndAdjustment( const SfxItemSet &rItemSet,
704 								 const SvxCSS1PropertyInfo &rPropInfo,
705 								 SfxItemSet &rFrmItemSet );
706 
707 	void SetFrmFmtAttrs( SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo,
708 						 sal_uInt16 nFlags, SfxItemSet &rFrmItemSet );
709 
710 	// Frames anlegen und Auto-gebundene Rahmen registrieren
711 	void RegisterFlyFrm( SwFrmFmt *pFlyFrm );
712 
713 	// Die Groesse des Fly-Frames an die Vorgaben und Gegebenheiten anpassen
714 	// (nicht fuer Grafiken, deshalb htmlplug.cxx)
715 	void SetFixSize( const Size& rPixSize, const Size& rTwipDfltSize,
716 					 sal_Bool bPrcWidth, sal_Bool bPrcHeight,
717 					 SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo,
718 					 SfxItemSet& rFlyItemSet );
719 	void SetVarSize( SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo,
720 					 SfxItemSet& rFlyItemSet, SwTwips nDfltWidth=MINLAY,
721 					 sal_uInt8 nDltPrcWidth=0 );
722 	void SetSpace( const Size& rPixSpace, SfxItemSet &rItemSet,
723 				   SvxCSS1PropertyInfo &rPropInfo, SfxItemSet& rFlyItemSet );
724 
725 	sal_uInt16 IncGrfsThatResizeTable();
726 
727 	void GetDefaultScriptType( ScriptType& rType,
728 							   String& rTypeStr ) const;
729 
730 	// die eigentlichen Einfuege-Methoden fuer <IMG>, <EMBED> und <APPLET>
731 	// und <PARAM>
732 	void InsertImage();		// htmlgrin.cxx
733 	void InsertEmbed();		// htmlplug.cxx
734 
735 #ifdef SOLAR_JAVA
736 	void NewObject();	// htmlplug.cxx
737 #endif
738 	void EndObject();		// CommandLine mit Applet verkn. (htmlplug.cxx)
739 #ifdef SOLAR_JAVA
740 	void InsertApplet();	// htmlplug.cxx
741 #endif
742 	void EndApplet();		// CommandLine mit Applet verkn. (htmlplug.cxx)
743 	void InsertParam();		// htmlplug.cxx
744 
745 	void InsertFloatingFrame();
EndFloatingFrame()746 	void EndFloatingFrame() { bInFloatingFrame = sal_False; }
747 
748 	// <BODY>-Tag auswerten: Hintergrund-Grafiken und -Farben setzen (htmlgrin.cxx)
749 	void InsertBodyOptions();
750 
751 
752 	// Einfuegen von Links und ::com::sun::star::text::Bookmarks (htmlgrin.cxx)
753 
754 	// <A>-Tag auswerten: einen Link bzw. eine ::com::sun::star::text::Bookmark einfuegen
755 	void NewAnchor();
756 	void EndAnchor();
757 
758 	// eine ::com::sun::star::text::Bookmark einfuegen
759 	void InsertBookmark( const String& rName );
760 
761 
762 	void InsertCommentText( const sal_Char *pTag = 0 );
763 	void InsertComment( const String& rName, const sal_Char *pTag = 0 );
764 
765 	// sind im aktuellen Absatz ::com::sun::star::text::Bookmarks vorhanden?
766 	sal_Bool HasCurrentParaBookmarks( sal_Bool bIgnoreStack=sal_False ) const;
767 
768 
769 	// Einfuegen von Script/Basic-Elementen
770 
771 	// das zueletzt gelsene Basic-Modul parsen (htmlbas.cxx)
772 	void NewScript();
773 	void EndScript();
774 
775 	void AddScriptSource();
776 
777 	// ein Event in die SFX-Konfiguation eintragen (htmlbas.cxx)
778 	void InsertBasicDocEvent( rtl::OUString aEventName, const String& rName,
779 							  ScriptType eScrType, const String& rScrType );
780 
781 	// ein Event an ein VC-Control anhaengen (htmlform.cxx)
782 	void InsertBasicCtrlEvent( sal_uInt16 nEvent, const String& rName );
783 
784 	// Einfuegen von Styles
785 
786 	// <STYLE>
787 	void NewStyle();
788 	void EndStyle();
789 
790 	inline sal_Bool HasStyleOptions( const String &rStyle, const String &rId,
791 								 const String &rClass, const String *pLang=0,
792 		   						 const String *pDir=0 );
793 	sal_Bool ParseStyleOptions( const String &rStyle, const String &rId,
794 							const String &rClass, SfxItemSet &rItemSet,
795 							SvxCSS1PropertyInfo &rPropInfo,
796 							 const String *pLang=0, const String *pDir=0 );
797 
798 
799 	// Einfuegen von Controls und ::com::sun::star::form::Forms (htmlform.cxx)
800 
801 	// Ein Draw-Objekt in das Dokuement eintragen
802 	void InsertDrawObject( SdrObject* pNewDrawObj, const Size& rSpace,
803                            sal_Int16 eVertOri,
804                            sal_Int16 eHoriOri,
805 						   SfxItemSet& rCSS1ItemSet,
806 						   SvxCSS1PropertyInfo& rCSS1PropInfo,
807 						   sal_Bool bHidden=sal_False );
808 						::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >  InsertControl( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & rFormComp,
809 						const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rFCompPropSet,
810 						const Size& rSize,
811                         sal_Int16 eVertOri,
812                         sal_Int16 eHoriOri,
813 						SfxItemSet& rCSS1ItemSet,
814 						SvxCSS1PropertyInfo& rCSS1PropInfo,
815 						const SvxMacroTableDtor& rMacroTbl,
816 						const SvStringsDtor& rUnoMacroTbl,
817 						const SvStringsDtor& rUnoMacroParamTbl,
818 						sal_Bool bSetPropSet = sal_True,
819 						sal_Bool bHidden = sal_False );
820 	void SetControlSize( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape, const Size& rTextSz,
821 						 sal_Bool bMinWidth, sal_Bool bMinHeight, int nToken );
822 	void SetPendingControlSize( int nToken );
823 
824 public:
825 	void ResizeDrawObject( SdrObject* pObj, SwTwips nWidth );
826 private:
827 	void RegisterDrawObjectToTable( HTMLTable *pCurTable, SdrObject* pObj,
828 									sal_uInt8 nWidth );
829 
830 
831 	// eine neue Form beginnen
832 	void NewForm( sal_Bool bAppend=sal_True );
833 	void EndForm( sal_Bool bAppend=sal_True );
834 
835 	// die Einfuege-Methoden fuer <INPUT>, <TEXTAREA> und <SELECT>
836 	void InsertInput();
837 
838 	void NewTextArea();
839 	void InsertTextAreaText( sal_uInt16 nToken );
840 	void EndTextArea();
841 
842 	void NewSelect();
843 	void InsertSelectOption();
844 	void InsertSelectText();
845 	void EndSelect();
846 
847 	// Einfuegen von Tabellen (htmltab.cxx)
848 
849 public:			// wird in Tabellen benoetigt
850 
851 	// einen Boxen-Inhalt hinter dem angegebenen Node einfuegen
852 	const SwStartNode *InsertTableSection( const SwStartNode *pPrevStNd );
853 
854 	// Einen Boxen-Inhalt am Ende der Tabelle einfuegen, in der der PaM
855 	// steht un den PaM in die Zelle schieben
856 	const SwStartNode *InsertTableSection( sal_uInt16 nPoolId );
857 
858 	// Einfeuge-Methoden fuer die diversen Tabellen-Tags
859 	HTMLTableCnts *InsertTableContents( sal_Bool bHead );
860 
861 private:
862 	// Eine Section fuer die voruebergende Aufnahme der Tabellen-Ueberschrift
863 	// anlegen
864 	SwStartNode *InsertTempTableCaptionSection();
865 
866 	void BuildTableCell( HTMLTable *pTable, sal_Bool bReadOptions, sal_Bool bHead );
867 	void BuildTableRow( HTMLTable *pTable, sal_Bool bReadOptions,
868                         SvxAdjust eGrpAdjust, sal_Int16 eVertOri );
869 	void BuildTableSection( HTMLTable *pTable, sal_Bool bReadOptions, sal_Bool bHead );
870 	void BuildTableColGroup( HTMLTable *pTable, sal_Bool bReadOptions );
871 	void BuildTableCaption( HTMLTable *pTable );
872 	HTMLTable *BuildTable( SvxAdjust eCellAdjust,
873 						   sal_Bool bIsParentHead = sal_False,
874 						   sal_Bool bHasParentSection=sal_True,
875 						   sal_Bool bIsInMulticol = sal_False,
876 						   sal_Bool bHasToFlow = sal_False );
877 
878 
879 	// sonstiges ...
880 
881 	void ParseMoreMetaOptions();
882 
883 	sal_Bool FileDownload( const String& rURL, String& rStr );
884 	void InsertLink();
885 
886 	void InsertIDOption();
887 	void InsertLineBreak();
888 	void InsertHorzRule();
889 
890 	void FillEndNoteInfo( const String& rContent );
891 	void FillFootNoteInfo( const String& rContent );
892 	void InsertFootEndNote( const String& rName, sal_Bool bEndNote, sal_Bool bFixed );
893 	void FinishFootEndNote();
894 	void InsertFootEndNoteText();
895 	SwNodeIndex *GetFootEndNoteSection( const String& rName );
896 	void DeleteFootEndNoteImpl();
897 
898 	// Line-Break am Ende eines Absatzes entfernen
899 	xub_StrLen StripTrailingLF();
900 
901 	// Einen leeren Absatz an der PaM-Position entfernen
902 	void StripTrailingPara();
903 
904 	// sind im aktuellen Absatz Fly-Frames vorhanden?
905 	sal_Bool HasCurrentParaFlys( sal_Bool bNoSurroundOnly = sal_False,
906 							 sal_Bool bSurroundOnly = sal_False ) const;
907 
908 public:			// wird in Tabellen benoetigt
909 
910 	// generieren eines BrushItems (mit new) oder 0
911 	SvxBrushItem* CreateBrushItem( const Color *pColor,
912 								   const String &rImageURL,
913 								   const String &rStyle,
914 								   const String &rId,
915 								   const String &rClass );
916 
917 protected:
918 	// wird fuer jedes Token gerufen, das in CallParser erkannt wird
919 	virtual void NextToken( int nToken );
920 	virtual ~SwHTMLParser();
921 
922 	// wird das Dok geloescht, ist auch der Parser zu loeschen
923 	virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
924 
925     virtual void AddMetaUserDefined( ::rtl::OUString const & i_rMetaName );
926 
927 public:
928 
929 	SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
930                     const String& rFileName,
931                     const String& rBaseURL,
932                     int bReadNewDoc = sal_True,
933 					SfxMedium* pMed = 0, sal_Bool bReadUTF8 = sal_False,
934                     sal_Bool bIgnoreHTMLComments = sal_False );
935 
936 	virtual SvParserState CallParser();   // Aufruf des Parsers
937 
938 
939 	sal_uInt16 ToTwips( sal_uInt16 nPixel ) const;
940 
941 	// fuers asynchrone lesen aus dem SvStream
942 	virtual void Continue( int nToken );
943 
944     virtual bool ParseMetaOptions( const ::com::sun::star::uno::Reference<
945                 ::com::sun::star::document::XDocumentProperties>&,
946             SvKeyValueIterator* );
947 };
948 
949 
950 struct SwPendingStackData
951 {
~SwPendingStackDataSwPendingStackData952 	virtual ~SwPendingStackData() {}
953 };
954 
955 struct SwPendingStack
956 {
957 	int nToken;
958 	SwPendingStackData* pData;
959 	SwPendingStack* pNext;
960 
SwPendingStackSwPendingStack961 	SwPendingStack( int nTkn, SwPendingStack* pNxt )
962 		: nToken( nTkn ), pData( 0 ), pNext( pNxt )
963 		{}
964 };
965 
SetStart(const SwPosition & rPos)966 inline void _HTMLAttr::SetStart( const SwPosition& rPos )
967 {
968 	nSttPara = rPos.nNode;
969 	nSttCntnt = rPos.nContent.GetIndex();
970 	nEndPara = nSttPara;
971 	nEndCntnt = nSttCntnt;
972 }
973 
SetMargins(sal_uInt16 nLeft,sal_uInt16 nRight,short nIndent)974 inline void _HTMLAttrContext::SetMargins( sal_uInt16 nLeft, sal_uInt16 nRight,
975 										  short nIndent )
976 {
977 	nLeftMargin = nLeft;
978 	nRightMargin = nRight;
979 	nFirstLineIndent = nIndent;
980 	bLRSpaceChanged = sal_True;
981 }
982 
GetMargins(sal_uInt16 & nLeft,sal_uInt16 & nRight,short & nIndent) const983 inline void _HTMLAttrContext::GetMargins( sal_uInt16& nLeft,
984 										  sal_uInt16& nRight,
985 										  short& nIndent ) const
986 {
987 	if( bLRSpaceChanged )
988 	{
989 		nLeft = nLeftMargin;
990 		nRight = nRightMargin;
991 		nIndent = nFirstLineIndent;
992 	}
993 }
994 
SetULSpace(sal_uInt16 nUpper,sal_uInt16 nLower)995 inline void _HTMLAttrContext::SetULSpace( sal_uInt16 nUpper, sal_uInt16 nLower )
996 {
997 	nUpperSpace = nUpper;
998 	nLowerSpace = nLower;
999 	bULSpaceChanged = sal_True;
1000 }
1001 
GetULSpace(sal_uInt16 & rUpper,sal_uInt16 & rLower) const1002 inline void _HTMLAttrContext::GetULSpace( sal_uInt16& rUpper,
1003 										  sal_uInt16& rLower ) const
1004 {
1005 	if( bULSpaceChanged )
1006 	{
1007 		rUpper = nUpperSpace;
1008 		rLower = nLowerSpace;
1009 	}
1010 }
1011 
HasStyleOptions(const String & rStyle,const String & rId,const String & rClass,const String * pLang,const String * pDir)1012 inline sal_Bool SwHTMLParser::HasStyleOptions( const String &rStyle,
1013 											const String &rId,
1014 											const String &rClass,
1015 											const String *pLang,
1016 	   										const String *pDir )
1017 {
1018 	return rStyle.Len() || rId.Len() || rClass.Len() ||
1019 		   (pLang && pLang->Len()) || (pDir && pDir->Len());
1020 }
1021 
GetTopContext() const1022 inline const _HTMLAttrContext *SwHTMLParser::GetTopContext() const
1023 {
1024 	return aContexts.Count() > nContextStMin
1025 			? aContexts[aContexts.Count()-1] : 0;
1026 }
1027 
PushContext(_HTMLAttrContext * pCntxt)1028 inline void SwHTMLParser::PushContext( _HTMLAttrContext *pCntxt )
1029 {
1030 	aContexts.Insert( pCntxt, aContexts.Count() );
1031 }
1032 
1033 
1034 #endif
1035 
1036 
1037