xref: /AOO41X/main/sw/source/filter/html/wrthtml.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
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 _WRTHTML_HXX
24 #define _WRTHTML_HXX
25 
26 
27 #include <com/sun/star/container/XIndexContainer.hpp>
28 #include <com/sun/star/form/XForm.hpp>
29 #include <vcl/field.hxx>
30 #define _SVSTDARR_STRINGSDTOR
31 #define _SVSTDARR_STRINGSSORTDTOR
32 #define _SVSTDARR_ULONGS
33 #include <svl/svstdarr.hxx>
34 #include <i18npool/lang.h>
35 #include <tools/stream.hxx>
36 
37 #include "shellio.hxx"
38 #include "wrt_fn.hxx"
39 
40 // einige Forward Deklarationen
41 class Color;
42 class SwFrmFmt;
43 class SwFlyFrmFmt;
44 class SwDrawFrmFmt;
45 class SwFmtINetFmt;
46 class SwFmtVertOrient;
47 class SwFmtFtn;
48 class SwStartNode;
49 class SwTableNode;
50 class SwPageDesc;
51 class SwNodeIndex;
52 class ImageMap;
53 class SwNumRule;
54 class SdrObject;
55 class SvxBrushItem;
56 class SvxFontItem;
57 class SwHTMLNumRuleInfo;
58 class SwHTMLPosFlyFrms;
59 class SwHTMLTxtFtns;
60 
61 extern SwAttrFnTab aHTMLAttrFnTab;
62 
63 //#define HTML_PARSPACE ((MM50 * 7) / 10)
64 #define HTML_PARSPACE (MM50)
65 
66 // Flags fuer die Ausgabe von Rahmen aller Art
67 // BORDER geht nur bei OutHTML_Image
68 // ANYSIZE gibt an, ob auch VAR_SIZE und MIN_SIZE angaben exportiert werden
69 // ABSSIZE gibt an, ob Abstand und Umrandung ignoriert werden sollen
70 const sal_uInt32 HTML_FRMOPT_ALIGN      = 1<<0;
71 const sal_uInt32 HTML_FRMOPT_S_ALIGN    = 1<<1;
72 
73 const sal_uInt32 HTML_FRMOPT_WIDTH      = 1<<2;
74 const sal_uInt32 HTML_FRMOPT_HEIGHT         = 1<<3;
75 const sal_uInt32 HTML_FRMOPT_SIZE       = HTML_FRMOPT_WIDTH|HTML_FRMOPT_HEIGHT;
76 const sal_uInt32 HTML_FRMOPT_S_WIDTH    = 1<<4;
77 const sal_uInt32 HTML_FRMOPT_S_HEIGHT   = 1<<5;
78 const sal_uInt32 HTML_FRMOPT_S_SIZE     = HTML_FRMOPT_S_WIDTH|HTML_FRMOPT_S_HEIGHT;
79 const sal_uInt32 HTML_FRMOPT_ANYSIZE    = 1<<6;
80 const sal_uInt32 HTML_FRMOPT_ABSSIZE    = 1<<7;
81 const sal_uInt32 HTML_FRMOPT_MARGINSIZE     = 1<<8;
82 
83 const sal_uInt32 HTML_FRMOPT_SPACE      = 1<<9;
84 const sal_uInt32 HTML_FRMOPT_S_SPACE    = 1<<10;
85 
86 const sal_uInt32 HTML_FRMOPT_BORDER     = 1<<11;
87 const sal_uInt32 HTML_FRMOPT_S_BORDER   = 1<<12;
88 const sal_uInt32 HTML_FRMOPT_S_NOBORDER     = 1<<13;
89 
90 const sal_uInt32 HTML_FRMOPT_S_BACKGROUND = 1<<14;
91 
92 const sal_uInt32 HTML_FRMOPT_NAME           = 1<<15;
93 const sal_uInt32 HTML_FRMOPT_ALT        = 1<<16;
94 const sal_uInt32 HTML_FRMOPT_BRCLEAR    = 1<<17;
95 const sal_uInt32 HTML_FRMOPT_S_PIXSIZE  = 1<<18;
96 const sal_uInt32 HTML_FRMOPT_ID             = 1<<19;
97 const sal_uInt32 HTML_FRMOPT_DIR            = 1<<20;
98 
99 
100 const sal_uInt32 HTML_FRMOPTS_GENIMG_ALL    =
101     HTML_FRMOPT_ALT     |
102     HTML_FRMOPT_SIZE    |
103     HTML_FRMOPT_ABSSIZE |
104     HTML_FRMOPT_NAME;
105 const sal_uInt32 HTML_FRMOPTS_GENIMG_CNTNR = HTML_FRMOPTS_GENIMG_ALL;
106 const sal_uInt32 HTML_FRMOPTS_GENIMG    =
107     HTML_FRMOPTS_GENIMG_ALL |
108     HTML_FRMOPT_ALIGN       |
109     HTML_FRMOPT_SPACE       |
110     HTML_FRMOPT_BRCLEAR;
111 
112 #define HTMLMODE_BLOCK_SPACER       0x00010000
113 #define HTMLMODE_FLOAT_FRAME        0x00020000
114 #define HTMLMODE_VERT_SPACER        0x00040000
115 #define HTMLMODE_NBSP_IN_TABLES     0x00080000
116 #define HTMLMODE_LSPACE_IN_NUMBUL   0x00100000
117 #define HTMLMODE_NO_BR_AT_PAREND    0x00200000
118 #define HTMLMODE_PRINT_EXT          0x00400000
119 #define HTMLMODE_ABS_POS_FLY        0x00800000
120 #define HTMLMODE_ABS_POS_DRAW       0x01000000
121 #define HTMLMODE_FLY_MARGINS        0x02000000
122 #define HTMLMODE_BORDER_NONE        0x04000000
123 #define HTMLMODE_FONT_GENERIC       0x08000000
124 #define HTMLMODE_FRSTLINE_IN_NUMBUL 0x10000000
125 #define HTMLMODE_NO_CONTROL_CENTERING 0x20000000
126 
127 #define HTML_DLCOLL_DD 0x4000
128 #define HTML_DLCOLL_DT 0x8000
129 
130 #define CSS1_FMT_ISTAG (USHRT_MAX)
131 #define CSS1_FMT_CMPREF (USHRT_MAX-1)
132 #define CSS1_FMT_SPECIAL (USHRT_MAX-1)
133 
134 // Die folgenden Flags bestimmen nur, welche Descriptoren, Tags, Optionen etc.
135 // ausgegeben werden ...
136 // bit 0,1,2
137 #define CSS1_OUTMODE_SPAN_NO_ON     0x0000U
138 #define CSS1_OUTMODE_SPAN_TAG_ON    0x0001U
139 #define CSS1_OUTMODE_STYLE_OPT_ON   0x0002U
140 #define CSS1_OUTMODE_RULE_ON        0x0003U
141 #define CSS1_OUTMODE_SPAN_TAG1_ON   0x0004U
142 #define CSS1_OUTMODE_ANY_ON         0x0007U
143 
144 // bit 3,4,5
145 #define CSS1_OUTMODE_SPAN_NO_OFF    0x0000U
146 #define CSS1_OUTMODE_SPAN_TAG_OFF   ((sal_uInt16)(0x0001U << 3))
147 #define CSS1_OUTMODE_STYLE_OPT_OFF  ((sal_uInt16)(0x0002U << 3))
148 #define CSS1_OUTMODE_RULE_OFF       ((sal_uInt16)(0x0003U << 3))
149 #define CSS1_OUTMODE_SPAN_TAG1_OFF  ((sal_uInt16)(0x0004U << 3))
150 #define CSS1_OUTMODE_ANY_OFF        ((sal_uInt16)(0x0007U << 3))
151 
152 #define CSS1_OUTMODE_ONOFF(a) (CSS1_OUTMODE_##a##_ON|CSS1_OUTMODE_##a##_OFF)
153 #define CSS1_OUTMODE_SPAN_TAG       CSS1_OUTMODE_ONOFF(SPAN_TAG)
154 #define CSS1_OUTMODE_STYLE_OPT      CSS1_OUTMODE_ONOFF(STYLE_OPT)
155 #define CSS1_OUTMODE_RULE           CSS1_OUTMODE_ONOFF(RULE)
156 #define CSS1_OUTMODE_SPAN_TAG1      CSS1_OUTMODE_ONOFF(TAG1)
157 
158 // Die folgenden Flags legen fest, was ausgegeben wird
159 // bit 6,7,8,9
160 #define CSS1_OUTMODE_TEMPLATE       0x0000U
161 #define CSS1_OUTMODE_BODY           ((sal_uInt16)(0x0001U << 6))
162 #define CSS1_OUTMODE_PARA           ((sal_uInt16)(0x0002U << 6))
163 #define CSS1_OUTMODE_HINT           ((sal_uInt16)(0x0003U << 6))
164 #define CSS1_OUTMODE_FRAME          ((sal_uInt16)(0x0004U << 6))
165 #define CSS1_OUTMODE_TABLE          ((sal_uInt16)(0x0005U << 6))
166 #define CSS1_OUTMODE_TABLEBOX       ((sal_uInt16)(0x0006U << 6))
167 #define CSS1_OUTMODE_DROPCAP        ((sal_uInt16)(0x0007U << 6))
168 #define CSS1_OUTMODE_SECTION        ((sal_uInt16)(0x0008U << 6))
169 #define CSS1_OUTMODE_SOURCE         ((sal_uInt16)(0x000fU << 6))
170 
171 // bit 10
172 #define CSS1_OUTMODE_ENCODE         ((sal_uInt16)(0x0001U << 10))
173 
174 // bit 11,12,13
175 // don't care about script
176 #define CSS1_OUTMODE_ANY_SCRIPT     0x0000U
177 // no cjk or ctl items
178 #define CSS1_OUTMODE_WESTERN        ((sal_uInt16)(0x0001U << 11))
179 // no western or ctl items
180 #define CSS1_OUTMODE_CJK            ((sal_uInt16)(0x0002U << 11))
181 // no western or cjk items
182 #define CSS1_OUTMODE_CTL            ((sal_uInt16)(0x0003U << 11))
183 // no western, cjk or ctl items
184 #define CSS1_OUTMODE_NO_SCRIPT      ((sal_uInt16)(0x0004U << 11))
185 #define CSS1_OUTMODE_SCRIPT         ((sal_uInt16)(0x0007U << 11))
186 
187 // der HTML-Writer
188 struct HTMLControl;
189 SV_DECL_PTRARR_SORT_DEL( HTMLControls, HTMLControl*, 1, 1 )
190 SV_DECL_PTRARR( INetFmts, SwFmtINetFmt*, 1, 1 )
191 
192 struct SwHTMLFmtInfo;
193 SV_DECL_PTRARR_SORT_DEL( SwHTMLFmtInfos, SwHTMLFmtInfo*, 1, 1 )
194 
195 class IDocumentStylePoolAccess;
196 
197 class SwHTMLWriter : public Writer
198 {
199     SwHTMLPosFlyFrms *pHTMLPosFlyFrms;
200     SwHTMLNumRuleInfo *pNumRuleInfo;// aktuelle Numerierung
201     SwHTMLNumRuleInfo *pNextNumRuleInfo;
202     sal_uInt32 nHTMLMode;               // Beschreibung der Export-Konfiguration
203 
204     FieldUnit eCSS1Unit;
205 
206     sal_uInt16 OutHeaderAttrs();
207     const SwPageDesc *MakeHeader( sal_uInt16& rHeaderAtrs );
208     void GetControls();
209 
210     void AddLinkTarget( const String& rURL );
211     void CollectLinkTargets();
212 
213 protected:
214     sal_uLong WriteStream();
215 
216 public:
217 #if defined(UNX)
218     static const sal_Char sNewLine;     // nur \012 oder \015
219 #else
220     static const sal_Char __FAR_DATA sNewLine[];    // \015\012
221 #endif
222 
223     SvStringsDtor aImgMapNames;     // geschriebene Image Maps
224     SvStringsSortDtor aImplicitMarks;// implizite Stprungmarken
225     SvStringsDtor aOutlineMarks;        // geschriebene Image Maps
226     SvStringsSortDtor aNumRuleNames;// Names of exported num rules
227     SvStringsSortDtor aScriptParaStyles;// script dependent para styles
228     SvStringsSortDtor aScriptTextStyles;// script dependent text styles
229     SvULongs aOutlineMarkPoss;
230     HTMLControls aHTMLControls;     // die zu schreibenden ::com::sun::star::form::Forms
231     SwHTMLFmtInfos aChrFmtInfos;
232     SwHTMLFmtInfos aTxtCollInfos;
233     INetFmts aINetFmts;             // die "offenen" INet-Attribute
234     SwHTMLTxtFtns *pFootEndNotes;
235 
236     String aCSS1Selector;           // der Selektor eines Styles
237     String aNonConvertableCharacters;
238     String aBulletGrfs[MAXLEVEL];   // die Grafiken fuer Listen
239 
240     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >  *pxFormComps; // die aktuelle Form
241 
242     SwDoc *pTemplate;               // die HTML-Vorlage
243     Color *pDfltColor;              // default Farbe
244     SwNodeIndex *pStartNdIdx;       // Index des ersten Absatz
245     const SwPageDesc *pCurrPageDesc;// Die aktuelle Seiten-Vorlage
246     const SwFmtFtn *pFmtFtn;
247 
248     sal_uInt32 aFontHeights[7];         // die Font-Hoehen 1-7
249 
250     sal_uInt32 nWarn;                   // Result-Code fuer Warnungen
251     sal_uInt32 nLastLFPos;              // letzte Position eines LF
252 
253     sal_uInt16 nLastParaToken;          // fuers Absaetze zusammenhalten
254     sal_Int32 nBkmkTabPos;              // akt. Position in der Bookmark-Tabelle
255     sal_uInt16 nImgMapCnt;              // zum eindeutig
256     sal_uInt16 nFormCntrlCnt;
257     sal_uInt16 nEndNote;
258     sal_uInt16 nFootNote;
259     sal_Int32 nLeftMargin;              // linker Einzug (z.B. aus Listen)
260     sal_Int32 nDfltLeftMargin;          // die dafaults, der nicht geschrieben
261     sal_Int32 nDfltRightMargin;     // werden muessen (aus der Vorlage)
262     short  nFirstLineIndent;        // Erstzeilen-Einzug (aus Listen)
263     short  nDfltFirstLineIndent;    // nicht zu schreibender default
264     sal_uInt16 nDfltTopMargin;          // die defaults, der nicht geschrieben
265     sal_uInt16 nDfltBottomMargin;       // werden muessen (aus der Vorlage)
266     sal_uInt16 nIndentLvl;              // wie weit ist eingerueckt?
267     xub_StrLen nWhishLineLen;           // wie lang darf eine Zeile werden?
268     sal_uInt16 nDefListLvl;             // welcher DL-Level existiert gerade
269     sal_Int32  nDefListMargin;          // Wie weit wird in DL eingerueckt
270     sal_uInt16 nHeaderFooterSpace;
271     sal_uInt16 nTxtAttrsToIgnore;
272     sal_uInt16 nExportMode;
273     sal_uInt16 nCSS1OutMode;
274     sal_uInt16 nCSS1Script;         // contains default script (that's the one
275                                     // that is not contained in class names)
276     sal_uInt16 nDirection;          // the current direction
277 
278     rtl_TextEncoding    eDestEnc;
279     LanguageType        eLang;
280 
281     // Beschreibung der Export-Konfiguration
282     // 0
283     sal_Bool bCfgOutStyles : 1;         // Styles exportieren
284     sal_Bool bCfgPreferStyles : 1;      // Styles herkoemmlichen Tags vorziehen
285     sal_Bool bCfgFormFeed : 1;          // Form-Feeds exportieren
286     sal_Bool bCfgStarBasic : 1;         // StarBasic exportieren
287     sal_Bool bCfgCpyLinkedGrfs : 1;
288 
289     // Beschreibung dessen, was exportiert wird
290 
291     sal_Bool bFirstLine : 1;            // wird die 1. Zeile ausgegeben ?
292     sal_Bool bTagOn : 1;                // Tag an oder aus/Attr-Start oder -Ende
293 
294     // Die folgenden beiden Flags geben an, wir Attribute exportiert werden:
295     // bTxtAttr bOutOpts
296     // 0        0           Style-Sheets
297     // 1        0           Hints: Jedes Attribut wird als eignes Tag
298     //                          geschrieben und es gibt ein End-Tag
299     // 0        1           (Absatz-)Attribute: Das Attribut wird als Option
300     //                          eines bereits geschrieben Tags exportiert. Es
301     //                          gibt kein End-Tag.
302     sal_Bool bTxtAttr : 1;
303     // 8
304     sal_Bool bOutOpts : 1;
305 
306     sal_Bool bOutTable : 1;             // wird der Tabelleninhalt geschrieben?
307     sal_Bool bOutHeader : 1;
308     sal_Bool bOutFooter : 1;
309     sal_Bool bOutFlyFrame : 1;
310 
311     // Flags fuer Style-Export
312 
313     sal_Bool bFirstCSS1Rule : 1;        // wurde schon eine Property ausgegeben
314     sal_Bool bFirstCSS1Property : 1;    // wurde schon eine Property ausgegeben
315     sal_Bool bPoolCollTextModified : 1; // die Textkoerper-Vorlage wurde
316                                     // modifiziert.
317     // 16
318     sal_Bool bCSS1IgnoreFirstPageDesc : 1;
319 
320     // was muss/kann/darf nicht ausgegeben werden?
321 
322     sal_Bool bNoAlign : 1;              // HTML-Tag erlaubt kein ALIGN=...
323     sal_Bool bClearLeft : 1;            // <BR CLEAR=LEFT> am Absatz-Ende ausg.
324     sal_Bool bClearRight : 1;           // <BR CLEAR=RIGHT> am Absatz-Ende ausg.
325     sal_Bool bLFPossible : 1;           // ein Zeilenumbruch darf eingef. werden
326 
327     // sonstiges
328 
329     sal_Bool bPreserveForm : 1;         // die aktuelle Form beibehalten
330 
331     sal_Bool bCfgNetscape4 : 1;         // Netscape4 Hacks
332     // 23
333 
334     SwHTMLWriter( const String& rBaseURL );
335     virtual ~SwHTMLWriter();
336 
337     void Out_SwDoc( SwPaM* );       // schreibe den makierten Bereich
338 
339     // gebe alle an in aktuellen Ansatz stehenden ::com::sun::star::text::Bookmarks aus
340     void OutAnchor( const String& rName );
341     void OutBookmarks();
342     void OutImplicitMark( const String& rMark, const sal_Char *pMarkType );
343     void OutHyperlinkHRefValue( const String& rURL );
344 
345     // gebe die evt. an der akt. Position stehenden FlyFrame aus.
346     sal_Bool OutFlyFrm( sal_uLong nNdIdx, xub_StrLen nCntntIdx,
347                         sal_uInt8 nPos, HTMLOutContext *pContext = 0 );
348     void OutFrmFmt( sal_uInt8 nType, const SwFrmFmt& rFmt,
349                     const SdrObject *pSdrObj );
350 
351     void OutForm( sal_Bool bTagOn=sal_True, const SwStartNode *pStNd=0 );
352     void OutHiddenForms();
353     void OutHiddenForm( const ::com::sun::star::uno::Reference<
354                                 ::com::sun::star::form::XForm > & rForm );
355 
356     void OutForm( sal_Bool bOn, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > & rFormComps );
357     void OutHiddenControls( const ::com::sun::star::uno::Reference<
358                 ::com::sun::star::container::XIndexContainer > & rFormComps,
359             const ::com::sun::star::uno::Reference<
360                 ::com::sun::star::beans::XPropertySet > & rPropSet );
361     sal_Bool HasControls() const;
362 
363     void OutFootEndNoteInfo();
364     void OutFootEndNotes();
365     String GetFootEndNoteSym( const SwFmtFtn& rFmtFtn );
366     void OutFootEndNoteSym( const SwFmtFtn& rFmtFtn, const String& rNum,
367                             sal_uInt16 nScript );
368 
369 #ifdef JAVA_BASIC_IDE
370     void OutBasicModule( const String& rName, const String& rLanguage );
371 #endif
372     void OutBasic();
373 
374     void OutAndSetDefList( sal_uInt16 nNewLvl );
375 
376     void OutStyleSheet( const SwPageDesc& rPageDesc, sal_Bool bUsed=sal_True );
377 
378     inline void OutCSS1_PropertyAscii( const sal_Char *pProp,
379                                        const sal_Char *pVal );
380     inline void OutCSS1_PropertyAscii( const sal_Char *pProp,
381                                        const ByteString& rVal );
382     inline void OutCSS1_Property( const sal_Char *pProp, const String& rVal );
383     void OutCSS1_Property( const sal_Char *pProp, const sal_Char *pVal,
384                            const String *pSVal );
385     void OutCSS1_UnitProperty( const sal_Char *pProp, long nVal );
386     void OutCSS1_PixelProperty( const sal_Char *pProp, long nVal, sal_Bool bVert );
387     void OutCSS1_SfxItemSet( const SfxItemSet& rItemSet, sal_Bool bDeep=sal_True );
388 
389     // BODY-Tag-Events aus der SFX-Konfigaurion
390     void OutBasicBodyEvents();
391 
392     // BACKGROUND/BGCOLOR-Option
393     void OutBackground( const SvxBrushItem *pBrushItem, String& rEmbGrfNm,
394                         sal_Bool bGraphic );
395     void OutBackground( const SfxItemSet& rItemSet, String &rEmbGrfName,
396                         sal_Bool bGraphic );
397 
398     void OutLanguage( LanguageType eLang );
399     sal_uInt16 GetHTMLDirection( sal_uInt16 nDir ) const;
400     sal_uInt16 GetHTMLDirection( const SfxItemSet& rItemSet ) const;
401     void OutDirection( sal_uInt16 nDir );
402 
403     // ALT/ALIGN/WIDTH/HEIGHT/HSPACE/VSPACE-Optionen des aktuellen
404     // Frame-Formats ausgeben und ggf. ein <BR CLEAR=...> vorne an
405     // rEndTags anhaengen
406     void OutFrmFmtOptions( const SwFrmFmt& rFrmFmt, const String& rAltTxt,
407                             ByteString &rEndTags, sal_uInt32 nFrmOpts );
408     void OutCSS1_TableFrmFmtOptions( const SwFrmFmt& rFrmFmt );
409     void OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt );
410     void OutCSS1_FrmFmtOptions( const SwFrmFmt& rFrmFmt, sal_uInt32 nFrmOpts,
411                                 const SdrObject *pSdrObj=0,
412                                 const SfxItemSet *pItemSet=0 );
413     void OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt );
414 
415     void ChangeParaToken( sal_uInt16 nNew );
416 
IncIndentLevel()417     void IncIndentLevel() { nIndentLvl++; }
DecIndentLevel()418     void DecIndentLevel() { if ( nIndentLvl ) nIndentLvl--; }
419     void GetIndentString( ByteString& rStr, sal_uInt16 nIncLvl=0 );
420 
GetLineLen()421     xub_StrLen GetLineLen() { return (xub_StrLen)(Strm().Tell()-nLastLFPos); }
422     void OutNewLine( sal_Bool bCheck=sal_False );
423 
424     // fuer HTMLSaveData
GetEndPaM()425     SwPaM* GetEndPaM() { return pOrigPam; }
SetEndPaM(SwPaM * pPam)426     void SetEndPaM( SwPaM* pPam ) { pOrigPam = pPam; }
427 
428     sal_uInt32 ToPixel( sal_uInt32 nVal ) const;
429 
430     sal_uInt16 GuessFrmType( const SwFrmFmt& rFrmFmt,
431                          const SdrObject*& rpStrObj );
432     sal_uInt16 GuessOLENodeFrmType( const SwNode& rNd );
433 
434     void CollectFlyFrms();
435 
436     sal_uInt16 GetHTMLFontSize( sal_uInt32 nFontHeight ) const;
437 
438     // Die aktuelle Numerierungs-Information holen.
GetNumInfo()439     SwHTMLNumRuleInfo& GetNumInfo() { return *pNumRuleInfo; }
440 
441     // Die Numerierungs-Information des naechsten Absatz holen. Sie
442     // muss noch nicht vorhanden sein!
GetNextNumInfo()443     SwHTMLNumRuleInfo *GetNextNumInfo() { return pNextNumRuleInfo; }
444 
445     // Die Numerierungs-Information des naechsten Absatz setzen.
SetNextNumInfo(SwHTMLNumRuleInfo * pNxt)446     void SetNextNumInfo( SwHTMLNumRuleInfo *pNxt ) { pNextNumRuleInfo=pNxt; }
447 
448     // Die Numerierungs-Information des naeschten Absatz fuellen.
449     void FillNextNumInfo();
450 
451     // Die Numerierungs-Information des naeschten Absatz loeschen.
452     void ClearNextNumInfo();
453 
454     static const SdrObject *GetHTMLControl( const SwDrawFrmFmt& rFmt );
455     static const SdrObject *GetMarqueeTextObj( const SwDrawFrmFmt& rFmt );
456     static sal_uInt16 GetCSS1Selector( const SwFmt *pFmt, ByteString& rToken,
457                                    String& rClass, sal_uInt16& rRefPoolId,
458                                    String *pPseudo=0 );
459 
460     static const SwFmt *GetTemplateFmt( sal_uInt16 nPoolId, IDocumentStylePoolAccess* /*SwDoc*/ pTemplate );
461     static const SwFmt *GetParentFmt( const SwFmt& rFmt, sal_uInt16 nDeep );
462 
463     static void SubtractItemSet( SfxItemSet& rItemSet,
464                                  const SfxItemSet& rRefItemSet,
465                                  sal_Bool bSetDefaults,
466                                  sal_Bool bClearSame = sal_True,
467                                  const SfxItemSet *pRefScriptItemSet=0 );
468     static sal_Bool HasScriptDependentItems( const SfxItemSet& rItemSet,
469                                              sal_Bool bCheckDropCap );
470 
471     static void GetEEAttrsFromDrwObj( SfxItemSet& rItemSet,
472                                       const SdrObject *pObj,
473                                       sal_Bool bSetDefaults );
474 
475     static sal_uInt16 GetDefListLvl( const String& rNm, sal_uInt16 nPoolId );
476 
GetHTMLMode() const477     sal_uInt32 GetHTMLMode() const { return nHTMLMode; }
IsHTMLMode(sal_uInt32 nMode) const478     sal_Bool IsHTMLMode( sal_uInt32 nMode ) const { return (nHTMLMode & nMode) != 0; }
479 
480     inline sal_Bool IsCSS1Source( sal_uInt16 n ) const;
481     inline sal_Bool IsCSS1Script( sal_uInt16 n ) const;
482 
483     static const sal_Char *GetNumFormat( sal_uInt16 nFmt );
484     static void PrepareFontList( const SvxFontItem& rFontItem, String& rNames,
485                                  sal_Unicode cQuote, sal_Bool bGeneric );
486     static sal_uInt16 GetCSS1ScriptForScriptType( sal_uInt16 nScriptType );
487     static sal_uInt16 GetLangWhichIdFromScript( sal_uInt16 nScript );
488 
GetCSS1Unit() const489     FieldUnit GetCSS1Unit() const { return eCSS1Unit; }
490 };
491 
IsCSS1Source(sal_uInt16 n) const492 inline sal_Bool SwHTMLWriter::IsCSS1Source( sal_uInt16 n ) const
493 {
494     return n == (nCSS1OutMode & CSS1_OUTMODE_SOURCE);
495 }
496 
IsCSS1Script(sal_uInt16 n) const497 inline sal_Bool SwHTMLWriter::IsCSS1Script( sal_uInt16 n ) const
498 {
499     sal_uInt16 nScript = (nCSS1OutMode & CSS1_OUTMODE_SCRIPT);
500     return CSS1_OUTMODE_ANY_SCRIPT == nScript || n == nScript;
501 }
502 
OutCSS1_PropertyAscii(const sal_Char * pProp,const sal_Char * pVal)503 inline void SwHTMLWriter::OutCSS1_PropertyAscii( const sal_Char *pProp,
504                                                  const sal_Char *pVal )
505 {
506     OutCSS1_Property( pProp, pVal, 0 );
507 }
508 
OutCSS1_PropertyAscii(const sal_Char * pProp,const ByteString & rVal)509 inline void SwHTMLWriter::OutCSS1_PropertyAscii( const sal_Char *pProp,
510                                                  const ByteString& rVal )
511 {
512     OutCSS1_Property( pProp, rVal.GetBuffer(), 0 );
513 }
514 
OutCSS1_Property(const sal_Char * pProp,const String & rVal)515 inline void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp,
516                                             const String& rVal )
517 {
518     OutCSS1_Property( pProp, 0, &rVal );
519 }
520 
521 // Struktur speichert die aktuellen Daten des Writers zwischen, um
522 // einen anderen Dokument-Teil auszugeben, wie z.B. Header/Footer
523 // Mit den beiden USHORTs im CTOR wird ein neuer PaM erzeugt und auf
524 // die Position im Dokument gesetzt.
525 // Im Destructor werden alle Daten wieder restauriert und der angelegte
526 // Pam wieder geloescht.
527 
528 struct HTMLSaveData
529 {
530     SwHTMLWriter& rWrt;
531     SwPaM* pOldPam, *pOldEnd;
532     SwHTMLNumRuleInfo *pOldNumRuleInfo;     // Owner = this
533     SwHTMLNumRuleInfo *pOldNextNumRuleInfo; // Owner = HTML-Writer
534     sal_uInt16 nOldDefListLvl;
535     sal_uInt16 nOldDirection;
536     sal_Bool bOldWriteAll : 1;
537     sal_Bool bOldOutHeader : 1;
538     sal_Bool bOldOutFooter : 1;
539     sal_Bool bOldOutFlyFrame : 1;
540     const SwFlyFrmFmt* pOldFlyFmt;
541 
542     HTMLSaveData( SwHTMLWriter&, sal_uLong nStt, sal_uLong nEnd,
543                   sal_Bool bSaveNum=sal_True,
544                   const SwFrmFmt *pFrmFmt=0 );
545     ~HTMLSaveData();
546 };
547 
548 
549 // einige Funktions-Deklarationen
550 Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFmt,
551                                sal_Bool bInCntnr );
552 Writer& OutHTML_FrmFmtOLENodeGrf( Writer& rWrt, const SwFrmFmt& rFmt,
553                                   sal_Bool bInCntnr );
554 
555 Writer& OutHTML_SwTxtNode( Writer&, const SwCntntNode& );
556 Writer& OutHTML_SwTblNode( Writer& , SwTableNode &, const SwFrmFmt *,
557                            const String* pCaption=0, sal_Bool bTopCaption=sal_False );
558 
559 Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, const SwDrawFrmFmt& rFmt,
560                                      const SdrObject& rSdrObj, sal_Bool bInCntnr );
561 Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, const SwDrawFrmFmt& rFmt,
562                                      const SdrObject& rSdrObj );
563 
564 Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrmFmt& rFrmFmt,
565                               sal_Bool bHeader );
566 
567 Writer& OutHTML_Image( Writer&, const SwFrmFmt& rFmt,
568                        const String& rGrfName, const String& rAlternateTxt,
569                        const Size& rRealSize, sal_uInt32 nFrmOpts,
570                        const sal_Char *pMarkType = 0,
571                        const ImageMap *pGenImgMap = 0 );
572 Writer& OutHTML_BulletImage( Writer& rWrt, const sal_Char *pTag,
573                              const SvxBrushItem* pBrush, String &rGrfName,
574                              const Size &rSize,
575                              const SwFmtVertOrient* pVertOrient );
576 
577 Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt );
578 Writer& OutHTML_SwFmtFtn( Writer& rWrt, const SfxPoolItem& rHt );
579 Writer& OutHTML_INetFmt( Writer&, const SwFmtINetFmt& rINetFmt, sal_Bool bOn );
580 
581 Writer& OutCSS1_BodyTagStyleOpt( Writer& rWrt, const SfxItemSet& rItemSet,
582                                  String aEmbBGGrfName );
583 Writer& OutCSS1_ParaTagStyleOpt( Writer& rWrt, const SfxItemSet& rItemSet );
584 
585 Writer& OutCSS1_HintSpanTag( Writer& rWrt, const SfxPoolItem& rHt );
586 Writer& OutCSS1_HintStyleOpt( Writer& rWrt, const SfxPoolItem& rHt );
587 
588 Writer& OutCSS1_TableBGStyleOpt( Writer& rWrt, const SfxPoolItem& rHt );
589 Writer& OutCSS1_NumBulListStyleOpt( Writer& rWrt, const SwNumRule& rNumRule,
590                                     sal_uInt8 nLevel );
591 
592 Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt,
593                                  const SwHTMLNumRuleInfo& rInfo );
594 Writer& OutHTML_NumBulListEnd( SwHTMLWriter& rWrt,
595                                const SwHTMLNumRuleInfo& rNextInfo );
596 
597 
598 #endif  //  _WRTHTML_HXX
599 
600