11d2dbeb0SAndrew Rist /**************************************************************
2*81caa1bcSmseidel *
31d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file
51d2dbeb0SAndrew Rist * distributed with this work for additional information
61d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file
71d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at
10*81caa1bcSmseidel *
111d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*81caa1bcSmseidel *
131d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the
171d2dbeb0SAndrew Rist * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist * under the License.
19*81caa1bcSmseidel *
201d2dbeb0SAndrew Rist *************************************************************/
211d2dbeb0SAndrew Rist
221d2dbeb0SAndrew Rist
23*81caa1bcSmseidel
24cdf0e10cSrcweir #ifndef _SWHTML_HXX
25cdf0e10cSrcweir #define _SWHTML_HXX
26cdf0e10cSrcweir
27cdf0e10cSrcweir #if !defined(_SVSTDARR_XUB_STRLEN_DECL) || !defined(_SVSTDARR_LONGS_DECL) || \
28cdf0e10cSrcweir !defined(_SVSTDARR_USHORTS_DECL) || !defined(_SVSTDARR_STRINGSDTOR_DECL)
29cdf0e10cSrcweir #ifndef _SVSTDARR_XUB_STRLEN_DECL
30cdf0e10cSrcweir #define _SVSTDARR_XUB_STRLEN
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef _SVSTDARR_LONGS_DECL
33cdf0e10cSrcweir #define _SVSTDARR_LONGS
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef _SVSTDARR_USHORTS_DECL
36cdf0e10cSrcweir #define _SVSTDARR_USHORTS
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef _SVSTDARR_STRINGSDTOR_DECL
39cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #include <svl/svstdarr.hxx>
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir #include <tools/urlobj.hxx>
44cdf0e10cSrcweir #include <sfx2/sfxhtml.hxx>
45cdf0e10cSrcweir #include <svl/macitem.hxx>
46cdf0e10cSrcweir #include <editeng/svxenum.hxx>
47cdf0e10cSrcweir #include <fmtornt.hxx>
48cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
49cdf0e10cSrcweir #include <com/sun/star/form/XFormComponent.hpp>
50cdf0e10cSrcweir #include <pam.hxx>
51cdf0e10cSrcweir
52cdf0e10cSrcweir #include "calbck.hxx"
53cdf0e10cSrcweir #include "htmlvsh.hxx"
54cdf0e10cSrcweir
55cdf0e10cSrcweir class SfxMedium;
56cdf0e10cSrcweir class SfxViewFrame;
57cdf0e10cSrcweir class SdrObject;
58cdf0e10cSrcweir class SvxMacroTableDtor;
59cdf0e10cSrcweir class SvStringsDtor;
60cdf0e10cSrcweir class SwDoc;
61cdf0e10cSrcweir class SwPaM;
62cdf0e10cSrcweir class ViewShell;
63cdf0e10cSrcweir class SwStartNode;
64cdf0e10cSrcweir class SwFmtColl;
65cdf0e10cSrcweir class SwField;
66cdf0e10cSrcweir class SwHTMLForm_Impl;
67cdf0e10cSrcweir class SwApplet_Impl;
68cdf0e10cSrcweir struct SwHTMLFootEndNote_Impl;
69cdf0e10cSrcweir class HTMLTableCnts;
70cdf0e10cSrcweir struct SwPendingStack;
71cdf0e10cSrcweir class SvxCSS1PropertyInfo;
72cdf0e10cSrcweir
73cdf0e10cSrcweir #define HTML_PARSPACE (MM50)
74cdf0e10cSrcweir
75cdf0e10cSrcweir #define HTML_DFLT_IMG_WIDTH (MM50*4)
76cdf0e10cSrcweir #define HTML_DFLT_IMG_HEIGHT (MM50*2)
77cdf0e10cSrcweir
786494b7d7SPeter // a few things that are needed from time to time
79cdf0e10cSrcweir extern HTMLOptionEnum __FAR_DATA aHTMLPAlignTable[];
80cdf0e10cSrcweir extern HTMLOptionEnum __FAR_DATA aHTMLImgHAlignTable[];
81cdf0e10cSrcweir extern HTMLOptionEnum __FAR_DATA aHTMLImgVAlignTable[];
82cdf0e10cSrcweir
83cdf0e10cSrcweir
846494b7d7SPeter // the attribute stack:
85cdf0e10cSrcweir
86cdf0e10cSrcweir class _HTMLAttr;
87cdf0e10cSrcweir typedef _HTMLAttr *_HTMLAttrPtr;
88cdf0e10cSrcweir SV_DECL_PTRARR( _HTMLAttrs, _HTMLAttrPtr, 5, 5 )
89cdf0e10cSrcweir
90cdf0e10cSrcweir class _HTMLAttr
91cdf0e10cSrcweir {
92cdf0e10cSrcweir friend class SwHTMLParser;
93cdf0e10cSrcweir friend class _CellSaveStruct;
94cdf0e10cSrcweir
95cdf0e10cSrcweir SwNodeIndex nSttPara, nEndPara;
96cdf0e10cSrcweir xub_StrLen nSttCntnt, nEndCntnt;
97cdf0e10cSrcweir sal_Bool bInsAtStart : 1;
986494b7d7SPeter sal_Bool bLikePara : 1;// Set attribute over the entire paragraph
996494b7d7SPeter sal_Bool bValid : 1;// is the attribute valid?
100cdf0e10cSrcweir
101cdf0e10cSrcweir SfxPoolItem* pItem;
1026494b7d7SPeter sal_uInt16 nCount;// open attrs, with different values
1036494b7d7SPeter _HTMLAttr *pNext;// Attrs with different values still to be closed. Values
1046494b7d7SPeter _HTMLAttr *pPrev;// Attrs already closed but not yet legislated
1056494b7d7SPeter _HTMLAttr **ppHead;// the list header
106cdf0e10cSrcweir
1076494b7d7SPeter _HTMLAttr( const SwPosition& rPos, const SfxPoolItem& rItem, _HTMLAttr **pHd=0 );
108cdf0e10cSrcweir
1096494b7d7SPeter _HTMLAttr( const _HTMLAttr &rAttr, const SwNodeIndex &rEndPara, xub_StrLen nEndCnt, _HTMLAttr **pHd );
110cdf0e10cSrcweir
111cdf0e10cSrcweir public:
112cdf0e10cSrcweir
113cdf0e10cSrcweir ~_HTMLAttr();
114cdf0e10cSrcweir
115cdf0e10cSrcweir _HTMLAttr *Clone( const SwNodeIndex& rEndPara, xub_StrLen nEndCnt ) const;
1166494b7d7SPeter void Reset( const SwNodeIndex& rSttPara, xub_StrLen nSttCnt, _HTMLAttr **pHd );
117cdf0e10cSrcweir inline void SetStart( const SwPosition& rPos );
118cdf0e10cSrcweir
GetSttParaIdx() const119cdf0e10cSrcweir sal_uInt32 GetSttParaIdx() const { return nSttPara.GetIndex(); }
GetEndParaIdx() const120cdf0e10cSrcweir sal_uInt32 GetEndParaIdx() const { return nEndPara.GetIndex(); }
121cdf0e10cSrcweir
GetSttPara() const122cdf0e10cSrcweir const SwNodeIndex& GetSttPara() const { return nSttPara; }
GetEndPara() const123cdf0e10cSrcweir const SwNodeIndex& GetEndPara() const { return nEndPara; }
124cdf0e10cSrcweir
GetSttCnt() const125cdf0e10cSrcweir xub_StrLen GetSttCnt() const { return nSttCntnt; }
GetEndCnt() const126cdf0e10cSrcweir xub_StrLen GetEndCnt() const { return nEndCntnt; }
127cdf0e10cSrcweir
IsLikePara() const128cdf0e10cSrcweir sal_Bool IsLikePara() const { return bLikePara; }
SetLikePara(sal_Bool bPara=sal_True)129cdf0e10cSrcweir void SetLikePara( sal_Bool bPara=sal_True ) { bLikePara = bPara; }
130cdf0e10cSrcweir
GetItem()131cdf0e10cSrcweir SfxPoolItem& GetItem() { return *pItem; }
GetItem() const132cdf0e10cSrcweir const SfxPoolItem& GetItem() const { return *pItem; }
133cdf0e10cSrcweir
GetNext() const134cdf0e10cSrcweir _HTMLAttr *GetNext() const { return pNext; }
InsertNext(_HTMLAttr * pNxt)135cdf0e10cSrcweir void InsertNext( _HTMLAttr *pNxt ) { pNext = pNxt; }
136cdf0e10cSrcweir
GetPrev() const137cdf0e10cSrcweir _HTMLAttr *GetPrev() const { return pPrev; }
138cdf0e10cSrcweir void InsertPrev( _HTMLAttr *pPrv );
ClearPrev()139cdf0e10cSrcweir void ClearPrev() { pPrev = 0; }
140cdf0e10cSrcweir
SetHead(_HTMLAttr ** ppHd)141cdf0e10cSrcweir void SetHead( _HTMLAttr **ppHd ) { ppHead = ppHd; }
142cdf0e10cSrcweir
1436494b7d7SPeter // When setting attributes from templates, it can happen,
1446494b7d7SPeter // that attributes should not be set after all. To delete them
1456494b7d7SPeter // would be very time-consuming, because you don't know exactly
1466494b7d7SPeter // where they are chained. Therefore, they are simply invalidated
1476494b7d7SPeter // and deleted with next _SetAttr().
Invalidate()148cdf0e10cSrcweir void Invalidate() { bValid = sal_False; }
IsValid() const149cdf0e10cSrcweir sal_Bool IsValid() const { return bValid; }
150cdf0e10cSrcweir };
151cdf0e10cSrcweir
1526494b7d7SPeter // Table of attributes: Here the order is important: the attributes
1536494b7d7SPeter // at the front of the table are also set first in EndAllAttrs.
154cdf0e10cSrcweir struct _HTMLAttrTable
155cdf0e10cSrcweir {
156cdf0e10cSrcweir _HTMLAttr
1576494b7d7SPeter *pKeep,// ::com::sun::star::frame::Frame-Attribute
158cdf0e10cSrcweir *pBox,
159cdf0e10cSrcweir *pBrush,
160cdf0e10cSrcweir *pBreak,
161cdf0e10cSrcweir *pPageDesc,
162cdf0e10cSrcweir
1636494b7d7SPeter *pLRSpace,// paragraph-attributes
164cdf0e10cSrcweir *pULSpace,
165cdf0e10cSrcweir *pLineSpacing,
166cdf0e10cSrcweir *pAdjust,
167cdf0e10cSrcweir *pDropCap,
168cdf0e10cSrcweir *pSplit,
169cdf0e10cSrcweir *pWidows,
170cdf0e10cSrcweir *pOrphans,
171cdf0e10cSrcweir *pDirection,
172cdf0e10cSrcweir
1736494b7d7SPeter *pCharFmts,// text-attributes
174cdf0e10cSrcweir *pINetFmt,
175cdf0e10cSrcweir
1766494b7d7SPeter *pBold,// character-attributes
177cdf0e10cSrcweir *pBoldCJK,
178cdf0e10cSrcweir *pBoldCTL,
179cdf0e10cSrcweir *pItalic,
180cdf0e10cSrcweir *pItalicCJK,
181cdf0e10cSrcweir *pItalicCTL,
182cdf0e10cSrcweir *pStrike,
183cdf0e10cSrcweir *pUnderline,
184cdf0e10cSrcweir *pBlink,
185cdf0e10cSrcweir *pFont,
186cdf0e10cSrcweir *pFontCJK,
187cdf0e10cSrcweir *pFontCTL,
188cdf0e10cSrcweir *pFontHeight,
189cdf0e10cSrcweir *pFontHeightCJK,
190cdf0e10cSrcweir *pFontHeightCTL,
191cdf0e10cSrcweir *pFontColor,
192cdf0e10cSrcweir *pEscapement,
193cdf0e10cSrcweir *pCaseMap,
1946494b7d7SPeter *pKerning,// (only for SPACER)
1956494b7d7SPeter *pCharBrush,// Character background
196cdf0e10cSrcweir *pLanguage,
197cdf0e10cSrcweir *pLanguageCJK,
198cdf0e10cSrcweir *pLanguageCTL
199cdf0e10cSrcweir ;
200cdf0e10cSrcweir };
201cdf0e10cSrcweir
202cdf0e10cSrcweir class _HTMLAttrContext_SaveDoc;
203cdf0e10cSrcweir
204cdf0e10cSrcweir enum SwHTMLAppendMode {
2056494b7d7SPeter AM_NORMAL,// no paragraph spacing treatment
2066494b7d7SPeter AM_NOSPACE,// Force 0cm spacing
2076494b7d7SPeter AM_SPACE,// Force 0.5 cm spacing
2086494b7d7SPeter AM_SOFTNOSPACE,// Do not set distance but remember 0cm
2096494b7d7SPeter AM_NONE// no append at all
210cdf0e10cSrcweir };
211cdf0e10cSrcweir
212cdf0e10cSrcweir class _HTMLAttrContext
213cdf0e10cSrcweir {
2146494b7d7SPeter _HTMLAttrs aAttrs;// the attributes started in the context
215cdf0e10cSrcweir
2166494b7d7SPeter String aClass;// the class of the context
217cdf0e10cSrcweir
218cdf0e10cSrcweir _HTMLAttrContext_SaveDoc *pSaveDocContext;
219cdf0e10cSrcweir SfxItemSet *pFrmItemSet;
220cdf0e10cSrcweir
2216494b7d7SPeter sal_uInt16 nToken;// the token to which the context belongs
222cdf0e10cSrcweir
2236494b7d7SPeter sal_uInt16 nTxtFmtColl;// a template started in the context or 0
224cdf0e10cSrcweir
2256494b7d7SPeter sal_uInt16 nLeftMargin;// a changed left edge
2266494b7d7SPeter sal_uInt16 nRightMargin;// a changed right edge
2276494b7d7SPeter sal_uInt16 nFirstLineIndent;// a changed first line indent
228cdf0e10cSrcweir
229cdf0e10cSrcweir sal_uInt16 nUpperSpace;
230cdf0e10cSrcweir sal_uInt16 nLowerSpace;
231cdf0e10cSrcweir
232cdf0e10cSrcweir SwHTMLAppendMode eAppend;
233cdf0e10cSrcweir
2346494b7d7SPeter sal_Bool bLRSpaceChanged : 1;// left/right edge, indent changed?
2356494b7d7SPeter sal_Bool bULSpaceChanged : 1;// upper/lower edge changed?
2366494b7d7SPeter sal_Bool bDfltTxtFmtColl : 1;// nTxtFmtColl is only a default
2376494b7d7SPeter sal_Bool bSpansSection : 1;// The context spans a SwSection
2386494b7d7SPeter sal_Bool bPopStack : 1;// Delete the element above in the stack
239cdf0e10cSrcweir sal_Bool bFinishPREListingXMP : 1;
240cdf0e10cSrcweir sal_Bool bRestartPRE : 1;
241cdf0e10cSrcweir sal_Bool bRestartXMP : 1;
242cdf0e10cSrcweir sal_Bool bRestartListing : 1;
243cdf0e10cSrcweir
244cdf0e10cSrcweir public:
245cdf0e10cSrcweir void ClearSaveDocContext();
246cdf0e10cSrcweir
_HTMLAttrContext(sal_uInt16 nTokn,sal_uInt16 nPoolId,const String & rClass,sal_Bool bDfltColl=sal_False)247cdf0e10cSrcweir _HTMLAttrContext( sal_uInt16 nTokn, sal_uInt16 nPoolId, const String& rClass,
248cdf0e10cSrcweir sal_Bool bDfltColl=sal_False ) :
249cdf0e10cSrcweir aClass( rClass ),
250cdf0e10cSrcweir pSaveDocContext( 0 ),
251cdf0e10cSrcweir pFrmItemSet( 0 ),
252cdf0e10cSrcweir nToken( nTokn ),
253cdf0e10cSrcweir nTxtFmtColl( nPoolId ),
254cdf0e10cSrcweir nLeftMargin( 0 ),
255cdf0e10cSrcweir nRightMargin( 0 ),
256cdf0e10cSrcweir nFirstLineIndent( 0 ),
257cdf0e10cSrcweir nUpperSpace( 0 ),
258cdf0e10cSrcweir nLowerSpace( 0 ),
259cdf0e10cSrcweir eAppend( AM_NONE ),
260cdf0e10cSrcweir bLRSpaceChanged( sal_False ),
261cdf0e10cSrcweir bULSpaceChanged( sal_False ),
262cdf0e10cSrcweir bDfltTxtFmtColl( bDfltColl ),
263cdf0e10cSrcweir bSpansSection( sal_False ),
264cdf0e10cSrcweir bPopStack( sal_False ),
265cdf0e10cSrcweir bFinishPREListingXMP( sal_False ),
266cdf0e10cSrcweir bRestartPRE( sal_False ),
267cdf0e10cSrcweir bRestartXMP( sal_False ),
268cdf0e10cSrcweir bRestartListing( sal_False )
269cdf0e10cSrcweir {}
270cdf0e10cSrcweir
_HTMLAttrContext(sal_uInt16 nTokn)271cdf0e10cSrcweir _HTMLAttrContext( sal_uInt16 nTokn ) :
272cdf0e10cSrcweir pSaveDocContext( 0 ),
273cdf0e10cSrcweir pFrmItemSet( 0 ),
274cdf0e10cSrcweir nToken( nTokn ),
275cdf0e10cSrcweir nTxtFmtColl( 0 ),
276cdf0e10cSrcweir nLeftMargin( 0 ),
277cdf0e10cSrcweir nRightMargin( 0 ),
278cdf0e10cSrcweir nFirstLineIndent( 0 ),
279cdf0e10cSrcweir nUpperSpace( 0 ),
280cdf0e10cSrcweir nLowerSpace( 0 ),
281cdf0e10cSrcweir eAppend( AM_NONE ),
282cdf0e10cSrcweir bLRSpaceChanged( sal_False ),
283cdf0e10cSrcweir bULSpaceChanged( sal_False ),
284cdf0e10cSrcweir bDfltTxtFmtColl( sal_False ),
285cdf0e10cSrcweir bSpansSection( sal_False ),
286cdf0e10cSrcweir bPopStack( sal_False ),
287cdf0e10cSrcweir bFinishPREListingXMP( sal_False ),
288cdf0e10cSrcweir bRestartPRE( sal_False ),
289cdf0e10cSrcweir bRestartXMP( sal_False ),
290cdf0e10cSrcweir bRestartListing( sal_False )
291cdf0e10cSrcweir {}
292cdf0e10cSrcweir
~_HTMLAttrContext()293cdf0e10cSrcweir ~_HTMLAttrContext() { ClearSaveDocContext(); delete pFrmItemSet; }
294cdf0e10cSrcweir
GetToken() const295cdf0e10cSrcweir sal_uInt16 GetToken() const { return nToken; }
296cdf0e10cSrcweir
GetTxtFmtColl() const297cdf0e10cSrcweir sal_uInt16 GetTxtFmtColl() const { return bDfltTxtFmtColl ? 0 : nTxtFmtColl; }
GetDfltTxtFmtColl() const298cdf0e10cSrcweir sal_uInt16 GetDfltTxtFmtColl() const { return bDfltTxtFmtColl ? nTxtFmtColl : 0; }
299cdf0e10cSrcweir
GetClass() const300cdf0e10cSrcweir const String& GetClass() const { return aClass; }
301cdf0e10cSrcweir
302cdf0e10cSrcweir inline void SetMargins( sal_uInt16 nLeft, sal_uInt16 nRight, short nIndent );
303cdf0e10cSrcweir
IsLRSpaceChanged() const304cdf0e10cSrcweir inline sal_Bool IsLRSpaceChanged() const { return bLRSpaceChanged; }
305cdf0e10cSrcweir inline void GetMargins( sal_uInt16& nLeft, sal_uInt16& nRight,
306cdf0e10cSrcweir short &nIndent ) const;
307cdf0e10cSrcweir
308cdf0e10cSrcweir inline void SetULSpace( sal_uInt16 nUpper, sal_uInt16 nLower );
IsULSpaceChanged() const309cdf0e10cSrcweir inline sal_Bool IsULSpaceChanged() const { return bULSpaceChanged; }
310cdf0e10cSrcweir inline void GetULSpace( sal_uInt16& rUpper, sal_uInt16& rLower ) const;
311cdf0e10cSrcweir
HasAttrs() const312cdf0e10cSrcweir sal_Bool HasAttrs() const { return aAttrs.Count() != 0; }
GetAttrs() const313cdf0e10cSrcweir const _HTMLAttrs& GetAttrs() const { return aAttrs; }
GetAttrs()314cdf0e10cSrcweir _HTMLAttrs& GetAttrs() { return aAttrs; }
315cdf0e10cSrcweir
SetSpansSection(sal_Bool bSet)316cdf0e10cSrcweir void SetSpansSection( sal_Bool bSet ) { bSpansSection = bSet; }
GetSpansSection() const317cdf0e10cSrcweir sal_Bool GetSpansSection() const { return bSpansSection; }
318cdf0e10cSrcweir
SetPopStack(sal_Bool bSet)319cdf0e10cSrcweir void SetPopStack( sal_Bool bSet ) { bPopStack = bSet; }
GetPopStack() const320cdf0e10cSrcweir sal_Bool GetPopStack() const { return bPopStack; }
321cdf0e10cSrcweir
HasSaveDocContext() const322cdf0e10cSrcweir sal_Bool HasSaveDocContext() const { return pSaveDocContext!=0; }
323cdf0e10cSrcweir _HTMLAttrContext_SaveDoc *GetSaveDocContext( sal_Bool bCreate=sal_False );
324cdf0e10cSrcweir
GetFrmItemSet() const325cdf0e10cSrcweir const SfxItemSet *GetFrmItemSet() const { return pFrmItemSet; }
326cdf0e10cSrcweir SfxItemSet *GetFrmItemSet( SwDoc *pCreateDoc );
327cdf0e10cSrcweir
SetFinishPREListingXMP(sal_Bool bSet)328cdf0e10cSrcweir void SetFinishPREListingXMP( sal_Bool bSet ) { bFinishPREListingXMP = bSet; }
IsFinishPREListingXMP() const329cdf0e10cSrcweir sal_Bool IsFinishPREListingXMP() const { return bFinishPREListingXMP; }
330cdf0e10cSrcweir
SetRestartPRE(sal_Bool bSet)331cdf0e10cSrcweir void SetRestartPRE( sal_Bool bSet ) { bRestartPRE = bSet; }
IsRestartPRE() const332cdf0e10cSrcweir sal_Bool IsRestartPRE() const { return bRestartPRE; }
333cdf0e10cSrcweir
SetRestartXMP(sal_Bool bSet)334cdf0e10cSrcweir void SetRestartXMP( sal_Bool bSet ) { bRestartXMP = bSet; }
IsRestartXMP() const335cdf0e10cSrcweir sal_Bool IsRestartXMP() const { return bRestartXMP; }
336cdf0e10cSrcweir
SetRestartListing(sal_Bool bSet)337cdf0e10cSrcweir void SetRestartListing( sal_Bool bSet ) { bRestartListing = bSet; }
IsRestartListing() const338cdf0e10cSrcweir sal_Bool IsRestartListing() const { return bRestartListing; }
339cdf0e10cSrcweir
SetAppendMode(SwHTMLAppendMode eMode=AM_NORMAL)340cdf0e10cSrcweir void SetAppendMode( SwHTMLAppendMode eMode=AM_NORMAL ) { eAppend = eMode; }
GetAppendMode() const341cdf0e10cSrcweir SwHTMLAppendMode GetAppendMode() const { return eAppend; }
342cdf0e10cSrcweir };
343cdf0e10cSrcweir
344cdf0e10cSrcweir typedef _HTMLAttrContext *_HTMLAttrContextPtr;
345cdf0e10cSrcweir SV_DECL_PTRARR( _HTMLAttrContexts, _HTMLAttrContextPtr, 5, 5 )
346cdf0e10cSrcweir
347cdf0e10cSrcweir class HTMLTable;
348cdf0e10cSrcweir class SwCSS1Parser;
349cdf0e10cSrcweir class SwHTMLNumRuleInfo;
350cdf0e10cSrcweir
351cdf0e10cSrcweir typedef ImageMap *ImageMapPtr;
352cdf0e10cSrcweir SV_DECL_PTRARR_DEL( ImageMaps, ImageMapPtr, 1, 1 )
353cdf0e10cSrcweir typedef SwFrmFmt *SwFrmFmtPtr;
354cdf0e10cSrcweir SV_DECL_PTRARR( SwHTMLFrmFmts, SwFrmFmtPtr, 2, 2 )
355cdf0e10cSrcweir
356cdf0e10cSrcweir #define HTML_CNTXT_PROTECT_STACK 0x0001
357cdf0e10cSrcweir #define HTML_CNTXT_STRIP_PARA 0x0002
358cdf0e10cSrcweir #define HTML_CNTXT_KEEP_NUMRULE 0x0004
359cdf0e10cSrcweir #define HTML_CNTXT_HEADER_DIST 0x0008
360cdf0e10cSrcweir #define HTML_CNTXT_FOOTER_DIST 0x0010
361cdf0e10cSrcweir #define HTML_CNTXT_KEEP_ATTRS 0x0020
362cdf0e10cSrcweir
363cdf0e10cSrcweir #define CONTEXT_FLAGS_ABSPOS \
364cdf0e10cSrcweir (HTML_CNTXT_PROTECT_STACK | \
365cdf0e10cSrcweir HTML_CNTXT_STRIP_PARA)
366cdf0e10cSrcweir
3676494b7d7SPeter #define HTML_FF_BOX 0x0001
368cdf0e10cSrcweir #define HTML_FF_BACKGROUND 0x0002
369cdf0e10cSrcweir #define HTML_FF_PADDING 0x0004
370cdf0e10cSrcweir #define HTML_FF_DIRECTION 0x0008
371cdf0e10cSrcweir
372cdf0e10cSrcweir class SwHTMLParser : public SfxHTMLParser, public SwClient
373cdf0e10cSrcweir {
374cdf0e10cSrcweir friend class _SectionSaveStruct;
375cdf0e10cSrcweir friend class _CellSaveStruct;
376cdf0e10cSrcweir friend class _CaptionSaveStruct;
377cdf0e10cSrcweir
378cdf0e10cSrcweir String aPathToFile;
379cdf0e10cSrcweir String sBaseURL;
380cdf0e10cSrcweir String sSaveBaseURL;
381cdf0e10cSrcweir String aBasicLib;
382cdf0e10cSrcweir String aBasicModule;
3836494b7d7SPeter String aScriptSource;// Content of the current script block
3846494b7d7SPeter String aScriptType;// Type of the loaded script (StarBasic/VB/JAVA)
3856494b7d7SPeter String aScriptURL;// URL of a script
3866494b7d7SPeter String aStyleSource;// Contents of the current style sheet
3876494b7d7SPeter String aContents;// Text of the actual marquee, field, etc.
388cdf0e10cSrcweir String sTitle;
3896494b7d7SPeter String aUnknownToken;// a started unknown token
390cdf0e10cSrcweir String aBulletGrfs[MAXLEVEL];
391cdf0e10cSrcweir String sJmpMark;
392cdf0e10cSrcweir
3936494b7d7SPeter SvUShorts aBaseFontStack;// Stack for <BASEFONT>
3946494b7d7SPeter // Bit 0-2: Font size (1-7)
3956494b7d7SPeter SvUShorts aFontStack;// Stack for <FONT>, <BIG>, <SMALL>
3966494b7d7SPeter // Bit 0-2: Font size (1-7)
3976494b7d7SPeter // Bit 15: Font color was set
3986494b7d7SPeter
3996494b7d7SPeter _HTMLAttrs aSetAttrTab;// "closed" attribute, not set yet
4006494b7d7SPeter _HTMLAttrs aParaAttrs;// leading paragraph attributes
4016494b7d7SPeter _HTMLAttrTable aAttrTab;// "open" attributes
4026494b7d7SPeter _HTMLAttrContexts aContexts;// the current attribute/token context
4036494b7d7SPeter SwHTMLFrmFmts aMoveFlyFrms;// Fly-Frames, der Anker wird verschoben
404cdf0e10cSrcweir SvXub_StrLens aMoveFlyCnts;// and the Content-Positions
405cdf0e10cSrcweir
4066494b7d7SPeter SwApplet_Impl *pAppletImpl;// the current applet
407cdf0e10cSrcweir
4086494b7d7SPeter SwCSS1Parser *pCSS1Parser;// the style sheet parser
409cdf0e10cSrcweir SwHTMLNumRuleInfo *pNumRuleInfo;
410cdf0e10cSrcweir SwPendingStack *pPendStack;
411cdf0e10cSrcweir
412cdf0e10cSrcweir SwDoc *pDoc;
4136494b7d7SPeter SwPaM *pPam;// SwPosition should be enough, right?
4146494b7d7SPeter ViewShell *pActionViewShell;// ViewShell, at which the StartAction
4156494b7d7SPeter // was called.
416cdf0e10cSrcweir SwNodeIndex *pSttNdIdx;
417cdf0e10cSrcweir
4186494b7d7SPeter HTMLTable *pTable;// the current "outermost" table
4196494b7d7SPeter SwHTMLForm_Impl *pFormImpl;// the current form
4206494b7d7SPeter SdrObject *pMarquee;// current marquee
4216494b7d7SPeter SwField *pField;// current field
4226494b7d7SPeter ImageMap *pImageMap;// current image map
4236494b7d7SPeter ImageMaps *pImageMaps;// all image maps read so far
424cdf0e10cSrcweir SwHTMLFootEndNote_Impl *pFootEndNoteImpl;
425cdf0e10cSrcweir
4266494b7d7SPeter Size aHTMLPageSize;// the page size of the HTML template
427cdf0e10cSrcweir
4286494b7d7SPeter sal_uInt32 aFontHeights[7];// the font heights 1-7
4296494b7d7SPeter sal_uInt32 nScriptStartLineNr;// Line number of a script block
430cdf0e10cSrcweir sal_uLong nEventId;
431cdf0e10cSrcweir
4326494b7d7SPeter sal_uInt16 nBaseFontStMin;
433*81caa1bcSmseidel sal_uInt16 nFontStMin;
4346494b7d7SPeter sal_uInt16 nDefListDeep;
4356494b7d7SPeter sal_uInt16 nFontStHeadStart;// Elements in the font stack at <Hn>.
4366494b7d7SPeter sal_uInt16 nSBModuleCnt;// Counter for Basic modules
4376494b7d7SPeter sal_uInt16 nMissingImgMaps;// How many image maps are missing?
438cdf0e10cSrcweir sal_uInt16 nParaCnt;
4396494b7d7SPeter sal_uInt16 nContextStMin;// Lower limit for PopContext
4406494b7d7SPeter sal_uInt16 nContextStAttrMin;// Lower limit for attribution
4416494b7d7SPeter sal_uInt16 nSelectEntryCnt;// Number of entries in the current list box
4426494b7d7SPeter sal_uInt16 nOpenParaToken;// an opened paragraph element
443cdf0e10cSrcweir
444cdf0e10cSrcweir enum JumpToMarks { JUMPTO_NONE, JUMPTO_MARK, JUMPTO_TABLE, JUMPTO_FRAME,
445cdf0e10cSrcweir JUMPTO_REGION, JUMPTO_GRAPHIC } eJumpTo;
446cdf0e10cSrcweir
447cdf0e10cSrcweir #ifdef DBG_UTIL
4486494b7d7SPeter sal_uInt16 nContinue;// Depth of Continue calls
449cdf0e10cSrcweir #endif
450cdf0e10cSrcweir
4516494b7d7SPeter SvxAdjust eParaAdjust;// Alignment of the current paragraph
4526494b7d7SPeter HTMLScriptLanguage eScriptLang;// the current script language
453cdf0e10cSrcweir
4546494b7d7SPeter sal_Bool bOldIsHTMLMode : 1;// Was it once an HTML document?
455cdf0e10cSrcweir
4566494b7d7SPeter sal_Bool bDocInitialized : 1;// Document or shell were initialized
4576494b7d7SPeter // Flag used to avoid double initialization due to recursion
4586494b7d7SPeter sal_Bool bViewCreated : 1;// the view was already created (asynchronous)
4596494b7d7SPeter sal_Bool bSetCrsr : 1;// Set Crsr back to the beginning
460cdf0e10cSrcweir sal_Bool bSetModEnabled : 1;
461cdf0e10cSrcweir
4626494b7d7SPeter sal_Bool bInFloatingFrame : 1;// We are in a floating ::com::sun::star::frame::Frame
463cdf0e10cSrcweir sal_Bool bInField : 1;
4646494b7d7SPeter sal_Bool bKeepUnknown : 1;// unknown/unsupported tokens treatment
465cdf0e10cSrcweir // 8
4666494b7d7SPeter sal_Bool bCallNextToken : 1;// In tables: Call NextToken in any case
4676494b7d7SPeter sal_Bool bIgnoreRawData : 1;// Ignore content of a script/style.
4686494b7d7SPeter sal_Bool bLBEntrySelected : 1;// Is the current listbox entry selected.
4696494b7d7SPeter sal_Bool bTAIgnoreNewPara : 1;// ignore next LF in TextArea?
4706494b7d7SPeter sal_Bool bFixMarqueeWidth : 1;// Adjust the size of a ticker?
471cdf0e10cSrcweir sal_Bool bFixMarqueeHeight : 1;
472cdf0e10cSrcweir
4736494b7d7SPeter sal_Bool bUpperSpace : 1;// upper paragraph spacing is required
474cdf0e10cSrcweir sal_Bool bNoParSpace : 1;
475cdf0e10cSrcweir // 16
476cdf0e10cSrcweir
4776494b7d7SPeter sal_Bool bAnyStarBasic : 1;// there is a StarBasic module at all
4786494b7d7SPeter sal_Bool bInNoEmbed : 1;// We are in a NOEMBED area
479cdf0e10cSrcweir
4806494b7d7SPeter sal_Bool bInTitle : 1;// We are in the title
481cdf0e10cSrcweir
4826494b7d7SPeter sal_Bool bChkJumpMark : 1;// jump to a given marker if necessary
483cdf0e10cSrcweir sal_Bool bUpdateDocStat : 1;
4846494b7d7SPeter sal_Bool bFixSelectWidth : 1;// Reset the width of a select?
4856494b7d7SPeter sal_Bool bFixSelectHeight : 1;// Reset the height of a select?
486cdf0e10cSrcweir sal_Bool bTextArea : 1;
487cdf0e10cSrcweir // 24
488cdf0e10cSrcweir sal_Bool bSelect : 1;
489cdf0e10cSrcweir sal_Bool bInFootEndNoteAnchor : 1;
490cdf0e10cSrcweir sal_Bool bInFootEndNoteSymbol : 1;
4916494b7d7SPeter sal_Bool bIgnoreHTMLComments : 1;
4926494b7d7SPeter sal_Bool bRemoveHidden : 1;// the filter implementation might set the hidden flag
493cdf0e10cSrcweir
4946494b7d7SPeter // the names corresponding to the DOCINFO field subtypes INFO[1-4]
4956494b7d7SPeter ::rtl::OUString m_InfoNames[4];
496cdf0e10cSrcweir
497cdf0e10cSrcweir SfxViewFrame* pTempViewFrame;
498cdf0e10cSrcweir
499cdf0e10cSrcweir void DeleteFormImpl();
500cdf0e10cSrcweir
501cdf0e10cSrcweir void DocumentDetected();
502cdf0e10cSrcweir void Show();
503cdf0e10cSrcweir void ShowStatline();
504cdf0e10cSrcweir ViewShell *CallStartAction( ViewShell *pVSh = 0, sal_Bool bChkPtr = sal_True );
505cdf0e10cSrcweir ViewShell *CallEndAction( sal_Bool bChkAction = sal_False, sal_Bool bChkPtr = sal_True );
506cdf0e10cSrcweir ViewShell *CheckActionViewShell();
507cdf0e10cSrcweir
508cdf0e10cSrcweir DECL_LINK( AsyncCallback, void* );
509cdf0e10cSrcweir
510cdf0e10cSrcweir // Attribute am Dok setzen
511cdf0e10cSrcweir void _SetAttr( sal_Bool bChkEnd, sal_Bool bBeforeTable, _HTMLAttrs *pPostIts );
SetAttr(sal_Bool bChkEnd=sal_True,sal_Bool bBeforeTable=sal_False,_HTMLAttrs * pPostIts=0)512cdf0e10cSrcweir inline void SetAttr( sal_Bool bChkEnd = sal_True, sal_Bool bBeforeTable = sal_False,
513cdf0e10cSrcweir _HTMLAttrs *pPostIts = 0 )
514cdf0e10cSrcweir {
515cdf0e10cSrcweir if( aSetAttrTab.Count() || aMoveFlyFrms.Count() )
516cdf0e10cSrcweir _SetAttr( bChkEnd, bBeforeTable, pPostIts );
517cdf0e10cSrcweir }
518cdf0e10cSrcweir
519cdf0e10cSrcweir _HTMLAttr **GetAttrTabEntry( sal_uInt16 nWhich );
520cdf0e10cSrcweir
5216494b7d7SPeter // Create a new text node at PaM position
522cdf0e10cSrcweir sal_Bool AppendTxtNode( SwHTMLAppendMode eMode=AM_NORMAL, sal_Bool bUpdateNum=sal_True );
523cdf0e10cSrcweir void AddParSpace();
524cdf0e10cSrcweir
5256494b7d7SPeter // Start/end an attribute
526*81caa1bcSmseidel // ppDepAttr specifies an attribute table entry whose attributes
5276494b7d7SPeter // must be set before the attribute can be terminated.
528cdf0e10cSrcweir void NewAttr( _HTMLAttr **ppAttr, const SfxPoolItem& rItem );
529cdf0e10cSrcweir void EndAttr( _HTMLAttr *pAttr, _HTMLAttr **ppDepAttr=0,
530cdf0e10cSrcweir sal_Bool bChkEmpty=sal_True );
531cdf0e10cSrcweir void DeleteAttr( _HTMLAttr* pAttr );
532cdf0e10cSrcweir
533cdf0e10cSrcweir void EndContextAttrs( _HTMLAttrContext *pContext, sal_Bool bRemove=sal_False );
534cdf0e10cSrcweir void SaveAttrTab( _HTMLAttrTable& rNewAttrTab );
535cdf0e10cSrcweir void SplitAttrTab( const SwPosition& rNewPos );
536cdf0e10cSrcweir void SplitAttrTab( _HTMLAttrTable& rNewAttrTab, sal_Bool bMoveEndBack = sal_True );
537cdf0e10cSrcweir void RestoreAttrTab( const _HTMLAttrTable& rNewAttrTab,
538cdf0e10cSrcweir sal_Bool bSetNewStart = sal_False );
539cdf0e10cSrcweir void InsertAttr( const SfxPoolItem& rItem, sal_Bool bLikePara = sal_False,
540cdf0e10cSrcweir sal_Bool bInsAtStart=sal_False );
541cdf0e10cSrcweir void InsertAttrs( _HTMLAttrs& rAttrs );
542cdf0e10cSrcweir
543cdf0e10cSrcweir sal_Bool DoPositioning( SfxItemSet &rItemSet,
544cdf0e10cSrcweir SvxCSS1PropertyInfo &rPropInfo,
545cdf0e10cSrcweir _HTMLAttrContext *pContext );
546cdf0e10cSrcweir sal_Bool CreateContainer( const String& rClass, SfxItemSet &rItemSet,
547cdf0e10cSrcweir SvxCSS1PropertyInfo &rPropInfo,
548cdf0e10cSrcweir _HTMLAttrContext *pContext );
549cdf0e10cSrcweir sal_Bool EndSection( sal_Bool bLFStripped=sal_False );
550cdf0e10cSrcweir
551cdf0e10cSrcweir void InsertAttrs( SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo,
552cdf0e10cSrcweir _HTMLAttrContext *pContext, sal_Bool bCharLvl=sal_False );
553cdf0e10cSrcweir void InsertAttr( _HTMLAttr **ppAttr, const SfxPoolItem & rItem,
554cdf0e10cSrcweir _HTMLAttrContext *pCntxt );
555cdf0e10cSrcweir void SplitPREListingXMP( _HTMLAttrContext *pCntxt );
556cdf0e10cSrcweir void FixHeaderFooterDistance( sal_Bool bHeader, const SwPosition *pOldPos );
557cdf0e10cSrcweir
558cdf0e10cSrcweir void EndContext( _HTMLAttrContext *pContext );
559cdf0e10cSrcweir void ClearContext( _HTMLAttrContext *pContext );
560cdf0e10cSrcweir
561cdf0e10cSrcweir const SwFmtColl *GetCurrFmtColl() const;
562cdf0e10cSrcweir
563cdf0e10cSrcweir SwTwips GetCurrentBrowseWidth();
564cdf0e10cSrcweir
GetNumInfo()565cdf0e10cSrcweir SwHTMLNumRuleInfo& GetNumInfo() { return *pNumRuleInfo; }
5666494b7d7SPeter // --> OD 2008-04-02 #refactorlists#
5676494b7d7SPeter // add parameter <bCountedInList>
5686494b7d7SPeter void SetNodeNum( sal_uInt8 nLevel, bool bCountedInList );
5696494b7d7SPeter // <--
570cdf0e10cSrcweir
5716494b7d7SPeter // Manage paragraph templates
572cdf0e10cSrcweir
5736494b7d7SPeter // set the templates on the stack or their attributes.
574cdf0e10cSrcweir void SetTxtCollAttrs( _HTMLAttrContext *pContext = 0 );
575cdf0e10cSrcweir
576cdf0e10cSrcweir void InsertParaAttrs( const SfxItemSet& rItemSet );
577cdf0e10cSrcweir
5786494b7d7SPeter // Manage the attribute context
579cdf0e10cSrcweir
5806494b7d7SPeter // remember current context
581cdf0e10cSrcweir inline void PushContext( _HTMLAttrContext *pCntxt );
582cdf0e10cSrcweir
5836494b7d7SPeter // get the topmost/specified context, but do not search outside
5846494b7d7SPeter // of the context with token nLimit. If bRemove is set,
5856494b7d7SPeter // it is removed
586cdf0e10cSrcweir _HTMLAttrContext *PopContext( sal_uInt16 nToken=0, sal_uInt16 nLimit=0,
587cdf0e10cSrcweir sal_Bool bRemove=sal_True );
588cdf0e10cSrcweir inline const _HTMLAttrContext *GetTopContext() const;
589cdf0e10cSrcweir
590cdf0e10cSrcweir sal_Bool GetMarginsFromContext( sal_uInt16 &nLeft, sal_uInt16 &nRight, short& nIndent,
591cdf0e10cSrcweir sal_Bool bIgnoreCurrent=sal_False ) const;
592cdf0e10cSrcweir sal_Bool GetMarginsFromContextWithNumBul( sal_uInt16 &nLeft, sal_uInt16 &nRight,
593cdf0e10cSrcweir short& nIndent ) const;
594cdf0e10cSrcweir void GetULSpaceFromContext( sal_uInt16 &rUpper, sal_uInt16 &rLower ) const;
595cdf0e10cSrcweir
596cdf0e10cSrcweir
597cdf0e10cSrcweir void MovePageDescAttrs( SwNode *pSrcNd, sal_uLong nDestIdx, sal_Bool bFmtBreak );
598cdf0e10cSrcweir
5996494b7d7SPeter // Handling tags at paragraph level
600cdf0e10cSrcweir
6016494b7d7SPeter // <P> and <H1> to <H6>
602cdf0e10cSrcweir void NewPara();
603cdf0e10cSrcweir void EndPara( sal_Bool bReal = sal_False );
604cdf0e10cSrcweir void NewHeading( int nToken );
605cdf0e10cSrcweir void EndHeading();
606cdf0e10cSrcweir
6076494b7d7SPeter // <ADDRESS>, <BLOCKQUOTE> and <PRE>
608cdf0e10cSrcweir void NewTxtFmtColl( int nToken, sal_uInt16 nPoolId );
609cdf0e10cSrcweir void EndTxtFmtColl( int nToken );
610cdf0e10cSrcweir
6116494b7d7SPeter // <DIV> and <CENTER>
612cdf0e10cSrcweir void NewDivision( int nToken );
613cdf0e10cSrcweir void EndDivision( int nToken );
614cdf0e10cSrcweir
6156494b7d7SPeter // Insert/exit fly frames
616cdf0e10cSrcweir void InsertFlyFrame( const SfxItemSet& rItemSet, _HTMLAttrContext *pCntxt,
617cdf0e10cSrcweir const String& rId, sal_uInt16 nFlags );
618cdf0e10cSrcweir
619cdf0e10cSrcweir void SaveDocContext( _HTMLAttrContext *pCntxt, sal_uInt16 nFlags,
620cdf0e10cSrcweir const SwPosition *pNewPos );
621cdf0e10cSrcweir void RestoreDocContext( _HTMLAttrContext *pCntxt );
622cdf0e10cSrcweir
6236494b7d7SPeter // leave all areas spanned by <DIV>.
624cdf0e10cSrcweir sal_Bool EndSections( sal_Bool bLFStripped );
625cdf0e10cSrcweir
626cdf0e10cSrcweir // <MULTICOL>
627cdf0e10cSrcweir void NewMultiCol();
628cdf0e10cSrcweir void EndMultiCol();
629cdf0e10cSrcweir
630cdf0e10cSrcweir // <MARQUEE>
631cdf0e10cSrcweir void NewMarquee( HTMLTable *pCurTable=0 );
632cdf0e10cSrcweir void EndMarquee();
633cdf0e10cSrcweir void InsertMarqueeText();
634cdf0e10cSrcweir
6356494b7d7SPeter // List handling
636cdf0e10cSrcweir
6376494b7d7SPeter // Numbering <OL> and Enumeration Lists <UL> with <LI>
638cdf0e10cSrcweir void NewNumBulList( int nToken );
639cdf0e10cSrcweir void EndNumBulList( int nToken=0 );
640cdf0e10cSrcweir void NewNumBulListItem( int nToken );
641cdf0e10cSrcweir void EndNumBulListItem( int nToken=0, sal_Bool bSetColl=sal_True,
642cdf0e10cSrcweir sal_Bool bLastPara=sal_False );
643cdf0e10cSrcweir
6446494b7d7SPeter // Definition lists <DL> with <DD>, <DT>
645cdf0e10cSrcweir void NewDefList();
646cdf0e10cSrcweir void EndDefList();
647cdf0e10cSrcweir void NewDefListItem( int nToken );
648cdf0e10cSrcweir void EndDefListItem( int nToken=0, sal_Bool bSetColl=sal_True,
649cdf0e10cSrcweir sal_Bool bLastPara=sal_False );
650cdf0e10cSrcweir
651cdf0e10cSrcweir
6526494b7d7SPeter // Handling tags at character level
653cdf0e10cSrcweir
6546494b7d7SPeter // handle tags like <B>, <I> etc that turn a specific attribute
6556494b7d7SPeter // on and off, or which like SPAN only fetch attributes from styles.
656cdf0e10cSrcweir void NewStdAttr( int nToken );
657cdf0e10cSrcweir void NewStdAttr( int nToken,
658cdf0e10cSrcweir _HTMLAttr **ppAttr, const SfxPoolItem & rItem,
659cdf0e10cSrcweir _HTMLAttr **ppAttr2=0, const SfxPoolItem *pItem2=0,
660cdf0e10cSrcweir _HTMLAttr **ppAttr3=0, const SfxPoolItem *pItem3=0 );
661cdf0e10cSrcweir void EndTag( int nToken );
662cdf0e10cSrcweir
6636494b7d7SPeter // Handle font attributes
6646494b7d7SPeter void NewBasefontAttr(); // for <BASEFONT>
665cdf0e10cSrcweir void EndBasefontAttr();
6666494b7d7SPeter void NewFontAttr( int nToken ); // for <FONT>, <BIG> and <SMALL>
667cdf0e10cSrcweir void EndFontAttr( int nToken );
668cdf0e10cSrcweir
6696494b7d7SPeter // Tags realized by character templates
670cdf0e10cSrcweir void NewCharFmt( int nToken );
671cdf0e10cSrcweir
672cdf0e10cSrcweir // <SDFIELD>
673cdf0e10cSrcweir public:
674cdf0e10cSrcweir static sal_uInt16 GetNumType( const String& rStr, sal_uInt16 eDfltType );
675*81caa1bcSmseidel private:
6766494b7d7SPeter void NewField();
677cdf0e10cSrcweir void EndField();
678cdf0e10cSrcweir void InsertFieldText();
679cdf0e10cSrcweir
680cdf0e10cSrcweir // <SPACER>
681cdf0e10cSrcweir void InsertSpacer();
682cdf0e10cSrcweir
6836494b7d7SPeter // Inserting graphics, plugins and applets
684cdf0e10cSrcweir
6856494b7d7SPeter // Search image maps and connect them with graphic nodes
686cdf0e10cSrcweir ImageMap *FindImageMap( const String& rURL ) const;
687cdf0e10cSrcweir void ConnectImageMaps();
688cdf0e10cSrcweir
689*81caa1bcSmseidel // Determine anchoring of a fly frame and set corresponding attributes
6906494b7d7SPeter // set in the attrset (htmlgrin.cxx)
6916494b7d7SPeter void SetAnchorAndAdjustment( sal_Int16 eVertOri,
6926494b7d7SPeter sal_Int16 eHoriOri,
6936494b7d7SPeter const SfxItemSet &rItemSet,
6946494b7d7SPeter const SvxCSS1PropertyInfo &rPropInfo,
6956494b7d7SPeter SfxItemSet& rFrmSet );
6966494b7d7SPeter void SetAnchorAndAdjustment( sal_Int16 eVertOri,
6976494b7d7SPeter sal_Int16 eHoriOri,
6986494b7d7SPeter SfxItemSet& rFrmSet,
6996494b7d7SPeter sal_Bool bDontAppend=sal_False );
700cdf0e10cSrcweir void SetAnchorAndAdjustment( const SfxItemSet &rItemSet,
7016494b7d7SPeter const SvxCSS1PropertyInfo &rPropInfo,
7026494b7d7SPeter SfxItemSet &rFrmItemSet );
703cdf0e10cSrcweir
704cdf0e10cSrcweir void SetFrmFmtAttrs( SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo,
705cdf0e10cSrcweir sal_uInt16 nFlags, SfxItemSet &rFrmItemSet );
706cdf0e10cSrcweir
7076494b7d7SPeter // Create frames and register auto-bound frames
708cdf0e10cSrcweir void RegisterFlyFrm( SwFrmFmt *pFlyFrm );
709cdf0e10cSrcweir
7106494b7d7SPeter // Adapt the size of the fly-frame to the specifications and conditions.
7116494b7d7SPeter // (not for graphics, therefore htmlplug.cxx)
712cdf0e10cSrcweir void SetFixSize( const Size& rPixSize, const Size& rTwipDfltSize,
713cdf0e10cSrcweir sal_Bool bPrcWidth, sal_Bool bPrcHeight,
714cdf0e10cSrcweir SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo,
715cdf0e10cSrcweir SfxItemSet& rFlyItemSet );
716cdf0e10cSrcweir void SetVarSize( SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo,
717cdf0e10cSrcweir SfxItemSet& rFlyItemSet, SwTwips nDfltWidth=MINLAY,
718cdf0e10cSrcweir sal_uInt8 nDltPrcWidth=0 );
719cdf0e10cSrcweir void SetSpace( const Size& rPixSpace, SfxItemSet &rItemSet,
720cdf0e10cSrcweir SvxCSS1PropertyInfo &rPropInfo, SfxItemSet& rFlyItemSet );
721cdf0e10cSrcweir
722cdf0e10cSrcweir sal_uInt16 IncGrfsThatResizeTable();
723cdf0e10cSrcweir
724cdf0e10cSrcweir void GetDefaultScriptType( ScriptType& rType,
725cdf0e10cSrcweir String& rTypeStr ) const;
726cdf0e10cSrcweir
7276494b7d7SPeter // the actual insert methods for <IMG>, <EMBED>, and <APPLET>
7286494b7d7SPeter // and <PARAM>
7296494b7d7SPeter void InsertImage();// htmlgrin.cxx
7306494b7d7SPeter void InsertEmbed();// htmlplug.cxx
731cdf0e10cSrcweir
732cdf0e10cSrcweir #ifdef SOLAR_JAVA
7336494b7d7SPeter void NewObject();// htmlplug.cxx
734cdf0e10cSrcweir #endif
7356494b7d7SPeter void EndObject();// CommandLine with Applet link. (htmlplug.cxx)
736cdf0e10cSrcweir #ifdef SOLAR_JAVA
7376494b7d7SPeter void InsertApplet();// htmlplug.cxx
738cdf0e10cSrcweir #endif
7396494b7d7SPeter void EndApplet();// CommandLine with Applet link. (htmlplug.cxx)
7406494b7d7SPeter void InsertParam();// htmlplug.cxx
741cdf0e10cSrcweir
742cdf0e10cSrcweir void InsertFloatingFrame();
EndFloatingFrame()743cdf0e10cSrcweir void EndFloatingFrame() { bInFloatingFrame = sal_False; }
744cdf0e10cSrcweir
7456494b7d7SPeter // <BODY> tag evaluate: set background graphics and colors (htmlgrin.cxx)
746cdf0e10cSrcweir void InsertBodyOptions();
747cdf0e10cSrcweir
748cdf0e10cSrcweir
7496494b7d7SPeter // Inserting links and ::com::sun::star::text::Bookmarks (htmlgrin.cxx)
750cdf0e10cSrcweir
7516494b7d7SPeter // Evaluate <A> tag: insert a link or ::com::sun::star::text::bookmark.
752cdf0e10cSrcweir void NewAnchor();
753cdf0e10cSrcweir void EndAnchor();
754cdf0e10cSrcweir
7556494b7d7SPeter // insert a ::com::sun::star::text::bookmark
756cdf0e10cSrcweir void InsertBookmark( const String& rName );
757cdf0e10cSrcweir
758cdf0e10cSrcweir
759cdf0e10cSrcweir void InsertCommentText( const sal_Char *pTag = 0 );
760cdf0e10cSrcweir void InsertComment( const String& rName, const sal_Char *pTag = 0 );
761cdf0e10cSrcweir
7626494b7d7SPeter // are there any ::com::sun::star::text::bookmarks in the current paragraph?
763cdf0e10cSrcweir sal_Bool HasCurrentParaBookmarks( sal_Bool bIgnoreStack=sal_False ) const;
764cdf0e10cSrcweir
765cdf0e10cSrcweir
7666494b7d7SPeter // Inserting Script/Basic elements
767cdf0e10cSrcweir
7686494b7d7SPeter // parse the last Basic module (htmlbas.cxx) that was loaded
769cdf0e10cSrcweir void NewScript();
770cdf0e10cSrcweir void EndScript();
771cdf0e10cSrcweir
772cdf0e10cSrcweir void AddScriptSource();
773cdf0e10cSrcweir
7746494b7d7SPeter // add an event to the SFX configuration (htmlbas.cxx)
775cdf0e10cSrcweir void InsertBasicDocEvent( rtl::OUString aEventName, const String& rName,
776cdf0e10cSrcweir ScriptType eScrType, const String& rScrType );
777cdf0e10cSrcweir
7786494b7d7SPeter // attach an event to a VC control (htmlform.cxx)
779cdf0e10cSrcweir void InsertBasicCtrlEvent( sal_uInt16 nEvent, const String& rName );
780cdf0e10cSrcweir
7816494b7d7SPeter // Inserting styles
782cdf0e10cSrcweir
783cdf0e10cSrcweir // <STYLE>
784cdf0e10cSrcweir void NewStyle();
785cdf0e10cSrcweir void EndStyle();
786cdf0e10cSrcweir
7876494b7d7SPeter inline sal_Bool HasStyleOptions( const String &rStyle, const String &rId,const String &rClass, const String *pLang=0,const String *pDir=0 );
788cdf0e10cSrcweir sal_Bool ParseStyleOptions( const String &rStyle, const String &rId,
789cdf0e10cSrcweir const String &rClass, SfxItemSet &rItemSet,
790cdf0e10cSrcweir SvxCSS1PropertyInfo &rPropInfo,
791cdf0e10cSrcweir const String *pLang=0, const String *pDir=0 );
792cdf0e10cSrcweir
793cdf0e10cSrcweir
7946494b7d7SPeter // Inserting controls and ::com::sun::star::form::Forms (htmlform.cxx)
795cdf0e10cSrcweir
796*81caa1bcSmseidel // Add a Draw object to the document
797cdf0e10cSrcweir void InsertDrawObject( SdrObject* pNewDrawObj, const Size& rSpace,
7986494b7d7SPeter sal_Int16 eVertOri,
7996494b7d7SPeter sal_Int16 eHoriOri,
8006494b7d7SPeter SfxItemSet& rCSS1ItemSet,
8016494b7d7SPeter SvxCSS1PropertyInfo& rCSS1PropInfo,
8026494b7d7SPeter sal_Bool bHidden=sal_False );
8036494b7d7SPeter ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > InsertControl( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & rFormComp,
8046494b7d7SPeter const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rFCompPropSet,
8056494b7d7SPeter const Size& rSize,
8066494b7d7SPeter sal_Int16 eVertOri,
8076494b7d7SPeter sal_Int16 eHoriOri,
8086494b7d7SPeter SfxItemSet& rCSS1ItemSet,
8096494b7d7SPeter SvxCSS1PropertyInfo& rCSS1PropInfo,
8106494b7d7SPeter const SvxMacroTableDtor& rMacroTbl,
8116494b7d7SPeter const SvStringsDtor& rUnoMacroTbl,
8126494b7d7SPeter const SvStringsDtor& rUnoMacroParamTbl,
8136494b7d7SPeter sal_Bool bSetPropSet = sal_True,
8146494b7d7SPeter sal_Bool bHidden = sal_False );
815*81caa1bcSmseidel
8166494b7d7SPeter void SetControlSize( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape, const Size& rTextSz,sal_Bool bMinWidth, sal_Bool bMinHeight, int nToken );
817cdf0e10cSrcweir void SetPendingControlSize( int nToken );
818cdf0e10cSrcweir
819cdf0e10cSrcweir public:
820cdf0e10cSrcweir void ResizeDrawObject( SdrObject* pObj, SwTwips nWidth );
821cdf0e10cSrcweir private:
8226494b7d7SPeter void RegisterDrawObjectToTable( HTMLTable *pCurTable, SdrObject* pObj, sal_uInt8 nWidth );
823cdf0e10cSrcweir
824cdf0e10cSrcweir
8256494b7d7SPeter // start a new form
826cdf0e10cSrcweir void NewForm( sal_Bool bAppend=sal_True );
827cdf0e10cSrcweir void EndForm( sal_Bool bAppend=sal_True );
828cdf0e10cSrcweir
8296494b7d7SPeter // the insertion methods for <INPUT>, <TEXTAREA> and <SELECT>
830cdf0e10cSrcweir void InsertInput();
831cdf0e10cSrcweir
832cdf0e10cSrcweir void NewTextArea();
833cdf0e10cSrcweir void InsertTextAreaText( sal_uInt16 nToken );
834cdf0e10cSrcweir void EndTextArea();
835cdf0e10cSrcweir
836cdf0e10cSrcweir void NewSelect();
837cdf0e10cSrcweir void InsertSelectOption();
838cdf0e10cSrcweir void InsertSelectText();
839cdf0e10cSrcweir void EndSelect();
840cdf0e10cSrcweir
8416494b7d7SPeter // Insert tables (htmltab.cxx)
842cdf0e10cSrcweir
8436494b7d7SPeter public:// is needed in tables
844cdf0e10cSrcweir
8456494b7d7SPeter // insert a box content after the specified node
846cdf0e10cSrcweir const SwStartNode *InsertTableSection( const SwStartNode *pPrevStNd );
847cdf0e10cSrcweir
8486494b7d7SPeter // Insert a box content at the end of the table containing the PaM
8496494b7d7SPeter // and move the PaM into the cell
850cdf0e10cSrcweir const SwStartNode *InsertTableSection( sal_uInt16 nPoolId );
851cdf0e10cSrcweir
8526494b7d7SPeter // Insert methods for the various table tags
853cdf0e10cSrcweir HTMLTableCnts *InsertTableContents( sal_Bool bHead );
854cdf0e10cSrcweir
855cdf0e10cSrcweir private:
8566494b7d7SPeter // Create a section for the temporary setting of the table heading
857cdf0e10cSrcweir SwStartNode *InsertTempTableCaptionSection();
858cdf0e10cSrcweir
859cdf0e10cSrcweir void BuildTableCell( HTMLTable *pTable, sal_Bool bReadOptions, sal_Bool bHead );
8606494b7d7SPeter void BuildTableRow( HTMLTable *pTable, sal_Bool bReadOptions,SvxAdjust eGrpAdjust, sal_Int16 eVertOri );
861cdf0e10cSrcweir void BuildTableSection( HTMLTable *pTable, sal_Bool bReadOptions, sal_Bool bHead );
862cdf0e10cSrcweir void BuildTableColGroup( HTMLTable *pTable, sal_Bool bReadOptions );
863cdf0e10cSrcweir void BuildTableCaption( HTMLTable *pTable );
8646494b7d7SPeter HTMLTable *BuildTable( SvxAdjust eCellAdjust, sal_Bool bIsParentHead = sal_False, sal_Bool bHasParentSection=sal_True, sal_Bool bIsInMulticol = sal_False, sal_Bool bHasToFlow = sal_False );
865cdf0e10cSrcweir
866cdf0e10cSrcweir
8676494b7d7SPeter // miscellaneous ...
868cdf0e10cSrcweir void ParseMoreMetaOptions();
869cdf0e10cSrcweir
870cdf0e10cSrcweir sal_Bool FileDownload( const String& rURL, String& rStr );
871cdf0e10cSrcweir void InsertLink();
872cdf0e10cSrcweir
873cdf0e10cSrcweir void InsertIDOption();
874cdf0e10cSrcweir void InsertLineBreak();
875cdf0e10cSrcweir void InsertHorzRule();
876cdf0e10cSrcweir
877cdf0e10cSrcweir void FillEndNoteInfo( const String& rContent );
878cdf0e10cSrcweir void FillFootNoteInfo( const String& rContent );
879cdf0e10cSrcweir void InsertFootEndNote( const String& rName, sal_Bool bEndNote, sal_Bool bFixed );
880cdf0e10cSrcweir void FinishFootEndNote();
881cdf0e10cSrcweir void InsertFootEndNoteText();
882cdf0e10cSrcweir SwNodeIndex *GetFootEndNoteSection( const String& rName );
883cdf0e10cSrcweir void DeleteFootEndNoteImpl();
884cdf0e10cSrcweir
8856494b7d7SPeter // Remove line break at the end of a paragraph
886cdf0e10cSrcweir xub_StrLen StripTrailingLF();
887cdf0e10cSrcweir
888cdf0e10cSrcweir
8896494b7d7SPeter // Remove an empty paragraph at the PaM position.
8906494b7d7SPeter void StripTrailingPara();
891*81caa1bcSmseidel
8926494b7d7SPeter // Are there any visible Fly-Frames in the current paragraph?
8936494b7d7SPeter sal_Bool HasCurrentParaFlys( sal_Bool bNoSurroundOnly = sal_False, sal_Bool bSurroundOnly = sal_False ) const;
894cdf0e10cSrcweir
8956494b7d7SPeter public:// is needed in tables
896cdf0e10cSrcweir
8976494b7d7SPeter // generate a BrushItem (with new) or 0
898cdf0e10cSrcweir SvxBrushItem* CreateBrushItem( const Color *pColor,
8996494b7d7SPeter const String &rImageURL,
9006494b7d7SPeter const String &rStyle,
9016494b7d7SPeter const String &rId,
9026494b7d7SPeter const String &rClass );
903cdf0e10cSrcweir
904cdf0e10cSrcweir protected:
9056494b7d7SPeter // is called for every token that is recognized in CallParser
906cdf0e10cSrcweir virtual void NextToken( int nToken );
907cdf0e10cSrcweir virtual ~SwHTMLParser();
908cdf0e10cSrcweir
9096494b7d7SPeter // if the doc is deleted, the parser has to be deleted as well
910cdf0e10cSrcweir virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
911cdf0e10cSrcweir
912cdf0e10cSrcweir virtual void AddMetaUserDefined( ::rtl::OUString const & i_rMetaName );
913cdf0e10cSrcweir
914cdf0e10cSrcweir public:
915cdf0e10cSrcweir
916cdf0e10cSrcweir SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
917cdf0e10cSrcweir const String& rFileName,
918cdf0e10cSrcweir const String& rBaseURL,
919cdf0e10cSrcweir int bReadNewDoc = sal_True,
9206494b7d7SPeter SfxMedium* pMed = 0, sal_Bool bReadUTF8 = sal_False,
921cdf0e10cSrcweir sal_Bool bIgnoreHTMLComments = sal_False );
922cdf0e10cSrcweir
9236494b7d7SPeter virtual SvParserState CallParser();// Call the parser
924cdf0e10cSrcweir
925cdf0e10cSrcweir
926cdf0e10cSrcweir sal_uInt16 ToTwips( sal_uInt16 nPixel ) const;
927cdf0e10cSrcweir
9286494b7d7SPeter // for asynchronous reading from the SvStream
929cdf0e10cSrcweir virtual void Continue( int nToken );
930cdf0e10cSrcweir
93160c185deSPeter Kovacs virtual bool ParseMetaOptions( const ::com::sun::star::uno::Reference < ::com::sun::star::document::XDocumentProperties>&, SvKeyValueIterator* );
932cdf0e10cSrcweir };
933cdf0e10cSrcweir
934cdf0e10cSrcweir
935cdf0e10cSrcweir struct SwPendingStackData
936cdf0e10cSrcweir {
~SwPendingStackDataSwPendingStackData937cdf0e10cSrcweir virtual ~SwPendingStackData() {}
938cdf0e10cSrcweir };
939cdf0e10cSrcweir
940cdf0e10cSrcweir struct SwPendingStack
941cdf0e10cSrcweir {
942cdf0e10cSrcweir int nToken;
943cdf0e10cSrcweir SwPendingStackData* pData;
944cdf0e10cSrcweir SwPendingStack* pNext;
945cdf0e10cSrcweir
SwPendingStackSwPendingStack946cdf0e10cSrcweir SwPendingStack( int nTkn, SwPendingStack* pNxt )
947cdf0e10cSrcweir : nToken( nTkn ), pData( 0 ), pNext( pNxt )
948cdf0e10cSrcweir {}
949cdf0e10cSrcweir };
950cdf0e10cSrcweir
SetStart(const SwPosition & rPos)951cdf0e10cSrcweir inline void _HTMLAttr::SetStart( const SwPosition& rPos )
952cdf0e10cSrcweir {
953cdf0e10cSrcweir nSttPara = rPos.nNode;
954cdf0e10cSrcweir nSttCntnt = rPos.nContent.GetIndex();
955cdf0e10cSrcweir nEndPara = nSttPara;
956cdf0e10cSrcweir nEndCntnt = nSttCntnt;
957cdf0e10cSrcweir }
958cdf0e10cSrcweir
SetMargins(sal_uInt16 nLeft,sal_uInt16 nRight,short nIndent)9596494b7d7SPeter inline void _HTMLAttrContext::SetMargins( sal_uInt16 nLeft, sal_uInt16 nRight, short nIndent )
960cdf0e10cSrcweir {
961cdf0e10cSrcweir nLeftMargin = nLeft;
962cdf0e10cSrcweir nRightMargin = nRight;
963cdf0e10cSrcweir nFirstLineIndent = nIndent;
964cdf0e10cSrcweir bLRSpaceChanged = sal_True;
965cdf0e10cSrcweir }
966cdf0e10cSrcweir
GetMargins(sal_uInt16 & nLeft,sal_uInt16 & nRight,short & nIndent) const967cdf0e10cSrcweir inline void _HTMLAttrContext::GetMargins( sal_uInt16& nLeft,
9686494b7d7SPeter sal_uInt16& nRight,
9696494b7d7SPeter short& nIndent ) const
970cdf0e10cSrcweir {
971cdf0e10cSrcweir if( bLRSpaceChanged )
972cdf0e10cSrcweir {
973cdf0e10cSrcweir nLeft = nLeftMargin;
974cdf0e10cSrcweir nRight = nRightMargin;
975cdf0e10cSrcweir nIndent = nFirstLineIndent;
976cdf0e10cSrcweir }
977cdf0e10cSrcweir }
978cdf0e10cSrcweir
SetULSpace(sal_uInt16 nUpper,sal_uInt16 nLower)979cdf0e10cSrcweir inline void _HTMLAttrContext::SetULSpace( sal_uInt16 nUpper, sal_uInt16 nLower )
980cdf0e10cSrcweir {
981cdf0e10cSrcweir nUpperSpace = nUpper;
982cdf0e10cSrcweir nLowerSpace = nLower;
983cdf0e10cSrcweir bULSpaceChanged = sal_True;
984cdf0e10cSrcweir }
985cdf0e10cSrcweir
GetULSpace(sal_uInt16 & rUpper,sal_uInt16 & rLower) const986cdf0e10cSrcweir inline void _HTMLAttrContext::GetULSpace( sal_uInt16& rUpper,
987cdf0e10cSrcweir sal_uInt16& rLower ) const
988cdf0e10cSrcweir {
989cdf0e10cSrcweir if( bULSpaceChanged )
990cdf0e10cSrcweir {
991cdf0e10cSrcweir rUpper = nUpperSpace;
992cdf0e10cSrcweir rLower = nLowerSpace;
993cdf0e10cSrcweir }
994cdf0e10cSrcweir }
995cdf0e10cSrcweir
HasStyleOptions(const String & rStyle,const String & rId,const String & rClass,const String * pLang,const String * pDir)996cdf0e10cSrcweir inline sal_Bool SwHTMLParser::HasStyleOptions( const String &rStyle,
9976494b7d7SPeter const String &rId,
9986494b7d7SPeter const String &rClass,
9996494b7d7SPeter const String *pLang,
10006494b7d7SPeter const String *pDir )
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir return rStyle.Len() || rId.Len() || rClass.Len() ||
1003cdf0e10cSrcweir (pLang && pLang->Len()) || (pDir && pDir->Len());
1004cdf0e10cSrcweir }
1005cdf0e10cSrcweir
GetTopContext() const1006cdf0e10cSrcweir inline const _HTMLAttrContext *SwHTMLParser::GetTopContext() const
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir return aContexts.Count() > nContextStMin
1009cdf0e10cSrcweir ? aContexts[aContexts.Count()-1] : 0;
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir
PushContext(_HTMLAttrContext * pCntxt)1012cdf0e10cSrcweir inline void SwHTMLParser::PushContext( _HTMLAttrContext *pCntxt )
1013cdf0e10cSrcweir {
1014cdf0e10cSrcweir aContexts.Insert( pCntxt, aContexts.Count() );
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir
1017cdf0e10cSrcweir
1018cdf0e10cSrcweir #endif
1019cdf0e10cSrcweir
1020cdf0e10cSrcweir
1021