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