LibreOffice Module sw (master)  1
htmlfldw.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <com/sun/star/i18n/ScriptType.hpp>
21 #include <com/sun/star/i18n/XBreakIterator.hpp>
22 #include <comphelper/string.hxx>
23 #include <svtools/htmlkywd.hxx>
24 #include <svtools/htmlout.hxx>
25 #include <svtools/htmltokn.h>
26 #include <osl/diagnose.h>
27 #include <fmtfld.hxx>
28 #include <doc.hxx>
29 #include <breakit.hxx>
30 #include <ndtxt.hxx>
31 #include <txtfld.hxx>
32 #include <fldbas.hxx>
33 #include <docufld.hxx>
34 #include <flddat.hxx>
35 #include <viewopt.hxx>
36 #include "htmlfld.hxx"
37 #include "wrthtml.hxx"
38 #include <rtl/strbuf.hxx>
39 #include "css1atr.hxx"
40 #include "css1kywd.hxx"
41 
42 using namespace nsSwDocInfoSubType;
43 
44 const sal_Char *SwHTMLWriter::GetNumFormat( sal_uInt16 nFormat )
45 {
46  const sal_Char *pFormatStr = nullptr;
47 
48  switch( static_cast<SvxNumType>(nFormat) )
49  {
52  case SVX_NUM_ROMAN_UPPER: pFormatStr = OOO_STRING_SW_HTML_FF_uroman; break;
53  case SVX_NUM_ROMAN_LOWER: pFormatStr = OOO_STRING_SW_HTML_FF_lroman; break;
54  case SVX_NUM_ARABIC: pFormatStr = OOO_STRING_SW_HTML_FF_arabic; break;
55  case SVX_NUM_NUMBER_NONE: pFormatStr = OOO_STRING_SW_HTML_FF_none; break;
56  case SVX_NUM_CHAR_SPECIAL: pFormatStr = OOO_STRING_SW_HTML_FF_char; break;
57  case SVX_NUM_PAGEDESC: pFormatStr = OOO_STRING_SW_HTML_FF_page; break;
60  default:
61  ;
62  }
63 
64  return pFormatStr;
65 }
66 
67 static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField,
68  const SwTextNode& rTextNd, sal_Int32 nFieldPos )
69 {
70  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
71 
72  const SwFieldType* pFieldTyp = pField->GetTyp();
73  SwFieldIds nField = pFieldTyp->Which();
74  sal_uLong nFormat = pField->GetFormat();
75 
76  const sal_Char *pTypeStr=nullptr, // TYPE
77  *pSubStr=nullptr, // SUBTYPE
78  *pFormatStr=nullptr; // FORMAT (SW)
79  OUString aValue; // VALUE (SW)
80  bool bNumFormat=false; // SDNUM (Number-Formatter-Format)
81  bool bNumValue=false; // SDVAL (Number-Formatter-Value)
82  double dNumValue = 0.0; // SDVAL (Number-Formatter-Value)
83  bool bFixed=false; // SDFIXED
84  OUString aName; // NAME (CUSTOM)
85 
86  switch( nField )
87  {
90  switch( static_cast<SwExtUserSubType>(pField->GetSubType()) )
91  {
92  case EU_COMPANY: pSubStr = OOO_STRING_SW_HTML_FS_company; break;
93  case EU_FIRSTNAME: pSubStr = OOO_STRING_SW_HTML_FS_firstname; break;
94  case EU_NAME: pSubStr = OOO_STRING_SW_HTML_FS_name; break;
95  case EU_SHORTCUT: pSubStr = OOO_STRING_SW_HTML_FS_shortcut; break;
96  case EU_STREET: pSubStr = OOO_STRING_SW_HTML_FS_street; break;
97  case EU_COUNTRY: pSubStr = OOO_STRING_SW_HTML_FS_country; break;
98  case EU_ZIP: pSubStr = OOO_STRING_SW_HTML_FS_zip; break;
99  case EU_CITY: pSubStr = OOO_STRING_SW_HTML_FS_city; break;
100  case EU_TITLE: pSubStr = OOO_STRING_SW_HTML_FS_title; break;
101  case EU_POSITION: pSubStr = OOO_STRING_SW_HTML_FS_position; break;
102  case EU_PHONE_PRIVATE: pSubStr = OOO_STRING_SW_HTML_FS_pphone; break;
103  case EU_PHONE_COMPANY: pSubStr = OOO_STRING_SW_HTML_FS_cphone; break;
104  case EU_FAX: pSubStr = OOO_STRING_SW_HTML_FS_fax; break;
105  case EU_EMAIL: pSubStr = OOO_STRING_SW_HTML_FS_email; break;
106  case EU_STATE: pSubStr = OOO_STRING_SW_HTML_FS_state; break;
107  default:
108  ;
109  }
110  OSL_ENSURE( pSubStr, "unknown sub type for SwExtUserField" );
111  bFixed = static_cast<const SwExtUserField*>(pField)->IsFixed();
112  break;
113 
114  case SwFieldIds::Author:
115  pTypeStr = OOO_STRING_SW_HTML_FT_author;
116  switch( static_cast<SwAuthorFormat>(nFormat) & 0xff)
117  {
118  case AF_NAME: pFormatStr = OOO_STRING_SW_HTML_FF_name; break;
119  case AF_SHORTCUT: pFormatStr = OOO_STRING_SW_HTML_FF_shortcut; break;
120  }
121  OSL_ENSURE( pFormatStr, "unknown format for SwAuthorField" );
122  bFixed = static_cast<const SwAuthorField*>(pField)->IsFixed();
123  break;
124 
127  bNumFormat = true;
128  if( static_cast<const SwDateTimeField*>(pField)->IsFixed() )
129  {
130  bNumValue = true;
131  dNumValue = static_cast<const SwDateTimeField*>(pField)->GetValue();
132  }
133  break;
134 
136  {
137  pTypeStr = OOO_STRING_SW_HTML_FT_page;
138  SwPageNumSubType eSubType = static_cast<SwPageNumSubType>(pField->GetSubType());
139  switch( eSubType )
140  {
141  case PG_RANDOM: pSubStr = OOO_STRING_SW_HTML_FS_random; break;
142  case PG_NEXT: pSubStr = OOO_STRING_SW_HTML_FS_next; break;
143  case PG_PREV: pSubStr = OOO_STRING_SW_HTML_FS_prev; break;
144  }
145  OSL_ENSURE( pSubStr, "unknown sub type for SwPageNumberField" );
146  pFormatStr = SwHTMLWriter::GetNumFormat( static_cast< sal_uInt16 >(nFormat) );
147 
148  if( static_cast<SvxNumType>(nFormat)==SVX_NUM_CHAR_SPECIAL )
149  {
150  aValue = static_cast<const SwPageNumberField *>(pField)->GetUserString();
151  }
152  else
153  {
154  const OUString& rValue = pField->GetPar2();
155  short nValue = static_cast<short>(rValue.toInt32());
156  if( (eSubType == PG_NEXT && nValue!=1) ||
157  (eSubType == PG_PREV && nValue!=-1) ||
158  (eSubType == PG_RANDOM && nValue!=0) )
159  {
160  aValue = rValue;
161  }
162  }
163  }
164  break;
165  case SwFieldIds::DocInfo:
166  {
167  sal_uInt16 nSubType = pField->GetSubType();
169  sal_uInt16 nExtSubType = nSubType & 0x0f00;
170  nSubType &= 0x00ff;
171 
172  switch( nSubType )
173  {
174  case DI_TITLE: pSubStr = OOO_STRING_SW_HTML_FS_title; break;
175  case DI_THEMA: pSubStr = OOO_STRING_SW_HTML_FS_theme; break;
176  case DI_KEYS: pSubStr = OOO_STRING_SW_HTML_FS_keys; break;
177  case DI_COMMENT: pSubStr = OOO_STRING_SW_HTML_FS_comment; break;
178  case DI_CREATE: pSubStr = OOO_STRING_SW_HTML_FS_create; break;
179  case DI_CHANGE: pSubStr = OOO_STRING_SW_HTML_FS_change; break;
180  case DI_CUSTOM: pSubStr = OOO_STRING_SW_HTML_FS_custom; break;
181  default: pTypeStr = nullptr; break;
182  }
183 
184  if( DI_CUSTOM == nSubType ) {
185  aName = static_cast<const SwDocInfoField*>(pField)->GetName();
186  }
187 
188  if( DI_CREATE == nSubType || DI_CHANGE == nSubType )
189  {
190  switch( nExtSubType )
191  {
192  case DI_SUB_AUTHOR:
193  pFormatStr = OOO_STRING_SW_HTML_FF_author;
194  break;
195  case DI_SUB_TIME:
196  pFormatStr = OOO_STRING_SW_HTML_FF_time;
197  bNumFormat = true;
198  break;
199  case DI_SUB_DATE:
200  pFormatStr = OOO_STRING_SW_HTML_FF_date;
201  bNumFormat = true;
202  break;
203  }
204  }
205  bFixed = static_cast<const SwDocInfoField*>(pField)->IsFixed();
206  if( bNumFormat )
207  {
208  if( bFixed )
209  {
210  // For a fixed field output the num value too.
211  // Fixed fields without number format shouldn't
212  // exist. See below for OSL_ENSURE().
213  dNumValue = static_cast<const SwDocInfoField*>(pField)->GetValue();
214  bNumValue = true;
215  }
216  else if( !nFormat )
217  {
218  // Non-fixed fields may not have a number format, when
219  // they come from a 4.0-document.
220  bNumFormat = false;
221  }
222  }
223  }
224  break;
225 
226  case SwFieldIds::DocStat:
227  {
229  sal_uInt16 nSubType = pField->GetSubType();
230  switch( nSubType )
231  {
232  case DS_PAGE: pSubStr = OOO_STRING_SW_HTML_FS_page; break;
233  case DS_PARA: pSubStr = OOO_STRING_SW_HTML_FS_para; break;
234  case DS_WORD: pSubStr = OOO_STRING_SW_HTML_FS_word; break;
235  case DS_CHAR: pSubStr = OOO_STRING_SW_HTML_FS_char; break;
236  case DS_TBL: pSubStr = OOO_STRING_SW_HTML_FS_tbl; break;
237  case DS_GRF: pSubStr = OOO_STRING_SW_HTML_FS_grf; break;
238  case DS_OLE: pSubStr = OOO_STRING_SW_HTML_FS_ole; break;
239  default: pTypeStr = nullptr; break;
240  }
241  pFormatStr = SwHTMLWriter::GetNumFormat( static_cast< sal_uInt16 >(nFormat) );
242  }
243  break;
244 
247  switch( static_cast<SwFileNameFormat>(nFormat & ~FF_FIXED) )
248  {
249  case FF_NAME: pFormatStr = OOO_STRING_SW_HTML_FF_name; break;
250  case FF_PATHNAME: pFormatStr = OOO_STRING_SW_HTML_FF_pathname; break;
251  case FF_PATH: pFormatStr = OOO_STRING_SW_HTML_FF_path; break;
252  case FF_NAME_NOEXT: pFormatStr = OOO_STRING_SW_HTML_FF_name_noext; break;
253  default:
254  ;
255  }
256  bFixed = static_cast<const SwFileNameField*>(pField)->IsFixed();
257  OSL_ENSURE( pFormatStr, "unknown format for SwFileNameField" );
258  break;
259  default: break;
260  }
261 
262  // <SDFIELD>-Tag ausgeben
263  if( pTypeStr )
264  {
265  OStringBuffer sOut;
266  sOut.append('<');
267  sOut.append(OOO_STRING_SVTOOLS_HTML_sdfield).append(' ').
268  append(OOO_STRING_SVTOOLS_HTML_O_type).append('=').
269  append(pTypeStr);
270  if( pSubStr )
271  {
272  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_subtype).
273  append('=').append(pSubStr);
274  }
275  if( pFormatStr )
276  {
277  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_format).
278  append('=').append(pFormatStr);
279  }
280  if( !aName.isEmpty() )
281  {
282  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name).
283  append("=\"");
284  rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
285  HTMLOutFuncs::Out_String( rWrt.Strm(), aName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
286  sOut.append('\"');
287  }
288  if( !aValue.isEmpty() )
289  {
290  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_value).
291  append("=\"");
292  rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
293  HTMLOutFuncs::Out_String( rWrt.Strm(), aValue, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
294  sOut.append('\"');
295  }
296  if( bNumFormat )
297  {
298  OSL_ENSURE( nFormat, "number format is 0" );
300  bNumValue, dNumValue, nFormat,
301  *rHTMLWrt.m_pDoc->GetNumberFormatter(), rHTMLWrt.m_eDestEnc,
302  &rHTMLWrt.m_aNonConvertableCharacters));
303  }
304  if( bFixed )
305  {
306  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdfixed);
307  }
308  sOut.append('>');
309  rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
310  }
311 
312  // output content of the field
313  OUString const sExpand( pField->ExpandField(true, nullptr) );
314  bool bNeedsCJKProcessing = false;
315  if( !sExpand.isEmpty() )
316  {
317  sal_uInt16 nScriptType = g_pBreakIt->GetBreakIter()->getScriptType( sExpand, 0 );
318  sal_Int32 nPos = g_pBreakIt->GetBreakIter()->endOfScript( sExpand, 0,
319  nScriptType );
320 
321  sal_uInt16 nScript =
323  if( (nPos < sExpand.getLength() && nPos >= 0) || nScript != rHTMLWrt.m_nCSS1Script )
324  {
325  bNeedsCJKProcessing = true;
326  }
327  }
328 
329  if( bNeedsCJKProcessing )
330  {
331  //sequence of (start, end) property ranges we want to
332  //query
333  SfxItemSet aScriptItemSet( rWrt.m_pDoc->GetAttrPool(),
338  rTextNd.GetParaAttr(aScriptItemSet, nFieldPos, nFieldPos+1);
339 
340  sal_uInt16 aWesternWhichIds[4] =
342  RES_CHRATR_POSTURE, RES_CHRATR_WEIGHT };
343  sal_uInt16 aCJKWhichIds[4] =
346  sal_uInt16 aCTLWhichIds[4] =
349 
350  sal_uInt16 *pRefWhichIds = nullptr;
351  switch( rHTMLWrt.m_nCSS1Script )
352  {
354  pRefWhichIds = aWesternWhichIds;
355  break;
356  case CSS1_OUTMODE_CJK:
357  pRefWhichIds = aCJKWhichIds;
358  break;
359  case CSS1_OUTMODE_CTL:
360  pRefWhichIds = aCTLWhichIds;
361  break;
362  }
363 
364  sal_Int32 nPos = 0;
365  do
366  {
367  sal_uInt16 nScriptType = g_pBreakIt->GetBreakIter()->getScriptType( sExpand, nPos );
368  sal_uInt16 nScript =
370  sal_Int32 nEndPos = g_pBreakIt->GetBreakIter()->endOfScript(
371  sExpand, nPos, nScriptType );
372  sal_Int32 nChunkLen = nEndPos - nPos;
373  if( nScript != CSS1_OUTMODE_ANY_SCRIPT &&
374  /* #108791# */ nScript != rHTMLWrt.m_nCSS1Script )
375  {
376  sal_uInt16 *pWhichIds = nullptr;
377  switch( nScript )
378  {
379  case CSS1_OUTMODE_WESTERN: pWhichIds = aWesternWhichIds; break;
380  case CSS1_OUTMODE_CJK: pWhichIds = aCJKWhichIds; break;
381  case CSS1_OUTMODE_CTL: pWhichIds = aCTLWhichIds; break;
382  }
383 
384  rHTMLWrt.m_bTagOn = true;
385 
386  const SfxPoolItem *aItems[5];
387  int nItems = 0;
388 
389  assert(pWhichIds && pRefWhichIds);
390  if (pWhichIds && pRefWhichIds)
391  {
392  for( int i=0; i<4; i++ )
393  {
394  const SfxPoolItem *pRefItem =
395  aScriptItemSet.GetItem( pRefWhichIds[i] );
396  const SfxPoolItem *pItem =
397  aScriptItemSet.GetItem( pWhichIds[i] );
398  if( pRefItem && pItem &&
399  !(0==i ? swhtml_css1atr_equalFontItems( *pRefItem, *pItem )
400  : *pRefItem == *pItem) )
401  {
402  Out( aHTMLAttrFnTab, *pItem, rHTMLWrt );
403  aItems[nItems++] = pItem;
404  }
405  }
406  }
407 
408  HTMLOutFuncs::Out_String( rWrt.Strm(), sExpand.copy( nPos, nChunkLen ),
409  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
410 
411  rHTMLWrt.m_bTagOn = false;
412  while( nItems )
413  Out( aHTMLAttrFnTab, *aItems[--nItems], rHTMLWrt );
414 
415  }
416  else
417  {
418  HTMLOutFuncs::Out_String( rWrt.Strm(), sExpand.copy( nPos, nChunkLen ),
419  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
420  }
421  nPos = nEndPos;
422  }
423  while( nPos < sExpand.getLength() );
424  }
425  else
426  {
427  HTMLOutFuncs::Out_String( rWrt.Strm(), sExpand,
428  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
429  }
430 
431  // Off-Tag ausgeben
432  if( pTypeStr )
434 
435  return rWrt;
436 }
437 
439 {
440  const SwFormatField & rField = static_cast<const SwFormatField&>(rHt);
441  const SwField* pField = rField.GetField();
442  const SwFieldType* pFieldTyp = pField->GetTyp();
443 
444  if( SwFieldIds::SetExp == pFieldTyp->Which() &&
446  {
447  const bool bOn = pFieldTyp->GetName() == "HTML_ON";
448  if (!bOn && pFieldTyp->GetName() != "HTML_OFF")
449  return rWrt;
450 
451  OUString rText(comphelper::string::strip(pField->GetPar2(), ' '));
452  rWrt.Strm().WriteChar( '<' );
453  if( !bOn )
454  rWrt.Strm().WriteChar( '/' );
455  // TODO: HTML-Tags are written without entities, that for, characters
456  // not contained in the destination encoding are lost!
457  OString sTmp(OUStringToOString(rText,
458  static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc));
459  rWrt.Strm().WriteCharPtr( sTmp.getStr() ).WriteChar( '>' );
460  }
461  else if( SwFieldIds::Postit == pFieldTyp->Which() )
462  {
463  // Comments will be written in ANSI character set, but with system
464  // line breaks.
465  const OUString& rComment = pField->GetPar2();
466  bool bWritten = false;
467 
468  if( (rComment.getLength() >= 6 && rComment.startsWith("<") && rComment.endsWith(">") &&
469  rComment.copy( 1, 4 ).equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_meta) ) ||
470  (rComment.getLength() >= 7 &&
471  rComment.startsWith( "<!--" ) &&
472  rComment.endsWith( "-->" )) )
473  {
474  // directly output META tags
475  OUString sComment(convertLineEnd(rComment, GetSystemLineEnd()));
476  // TODO: HTML-Tags are written without entities, that for,
477  // characters not contained in the destination encoding are lost!
478  OString sTmp(OUStringToOString(sComment,
479  static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc));
480  rWrt.Strm().WriteCharPtr( sTmp.getStr() );
481  bWritten = true;
482  }
483  else if( rComment.getLength() >= 7 &&
484  rComment.endsWith(">") &&
485  rComment.startsWithIgnoreAsciiCase( "HTML:" ) )
486  {
487  OUString sComment(comphelper::string::stripStart(rComment.copy(5), ' '));
488  if( '<' == sComment[0] )
489  {
490  sComment = convertLineEnd(sComment, GetSystemLineEnd());
491  // TODO: HTML-Tags are written without entities, that for,
492  // characters not contained in the destination encoding are
493  // lost!
494  OString sTmp(OUStringToOString(sComment,
495  static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc));
496  rWrt.Strm().WriteCharPtr( sTmp.getStr() );
497  bWritten = true;
498  }
499 
500  }
501 
502  if( !bWritten )
503  {
504  OUString sComment(convertLineEnd(rComment, GetSystemLineEnd()));
505  OStringBuffer sOut;
506  // TODO: ???
507  sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_comment)
508  .append(' ').append(OUStringToOString(sComment,
509  static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc)).append(" -->");
510  rWrt.Strm().WriteCharPtr( sOut.getStr() );
511  }
512  }
513  else if( SwFieldIds::Script == pFieldTyp->Which() )
514  {
515  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
516  if( rHTMLWrt.m_bLFPossible )
517  rHTMLWrt.OutNewLine( true );
518 
519  bool bURL = static_cast<const SwScriptField *>(pField)->IsCodeURL();
520  const OUString& rType = pField->GetPar1();
521  OUString aContents, aURL;
522  if(bURL)
523  aURL = pField->GetPar2();
524  else
525  aContents = pField->GetPar2();
526 
527  // otherwise is the script content itself. Since only JavaScript
528  // is in fields, it must be JavaScript ...:)
529  HTMLOutFuncs::OutScript( rWrt.Strm(), rWrt.GetBaseURL(), aContents, rType, JAVASCRIPT,
530  aURL, nullptr, nullptr, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
531 
532  if( rHTMLWrt.m_bLFPossible )
533  rHTMLWrt.OutNewLine( true );
534  }
535  else
536  {
537  const SwTextField *pTextField = rField.GetTextField();
538  OSL_ENSURE( pTextField, "Where is the txt fld?" );
539  if( pTextField )
540  {
541  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
542  bool bFieldShadings = SwViewOption::IsFieldShadings();
543  if (bFieldShadings)
544  {
545  // If there is a text portion background started already, that should have priority.
546  auto it = rHTMLWrt.maStartedAttributes.find(RES_CHRATR_BACKGROUND);
547  if (it != rHTMLWrt.maStartedAttributes.end())
548  bFieldShadings = it->second <= 0;
549  }
550 
551  if (bFieldShadings)
552  {
553  OStringBuffer sOut;
554  sOut.append("<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span);
555  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_style "=\"");
556  sOut.append(sCSS1_P_background);
557  sOut.append(": ");
558 
560  sOut.append(GetCSS1_Color(rColor));
561  sOut.append("\">");
562  rWrt.Strm().WriteCharPtr(sOut.getStr());
563  }
564 
565  OutHTML_SwField( rWrt, pField, pTextField->GetTextNode(),
566  pTextField->GetStart() );
567 
568  if (bFieldShadings)
570  rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span, false);
571  }
572  }
573  return rWrt;
574 }
575 
576 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:233
static Writer & OutHTML_SwField(Writer &rWrt, const SwField *pField, const SwTextNode &rTextNd, sal_Int32 nFieldPos)
Definition: htmlfldw.cxx:67
const SwDocInfoSubType DI_SUB_TIME
Definition: docufld.hxx:79
#define OOO_STRING_SW_HTML_FS_title
Definition: htmlfld.hxx:39
sal_Int32 & GetStart()
start position
Definition: txatbase.hxx:77
#define RES_CHRATR_WEIGHT
Definition: hintids.hxx:83
static Color & GetFieldShadingsColor()
Definition: viewopt.cxx:432
SVX_NUM_CHARS_UPPER_LETTER_N
const OUString & GetBaseURL() const
Definition: shellio.hxx:440
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
#define OOO_STRING_SW_HTML_FS_email
Definition: htmlfld.hxx:44
const SwField * GetField() const
Definition: fmtfld.hxx:71
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars=nullptr)
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:76
#define OOO_STRING_SVTOOLS_HTML_comment
#define OOO_STRING_SW_HTML_FT_filename
Definition: htmlfld.hxx:30
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:387
std::string GetValue
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1399
#define OOO_STRING_SW_HTML_FF_shortcut
Definition: htmlfld.hxx:63
#define RES_CHRATR_CJK_POSTURE
Definition: hintids.hxx:93
#define OOO_STRING_SW_HTML_FS_firstname
Definition: htmlfld.hxx:32
#define OOO_STRING_SVTOOLS_HTML_meta
SVX_NUM_NUMBER_NONE
sal_uIntPtr sal_uLong
Base class of all fields.
Definition: fldbas.hxx:279
SVX_NUM_CHARS_UPPER_LETTER
#define OOO_STRING_SW_HTML_FF_lroman
Definition: htmlfld.hxx:67
OUString m_aNonConvertableCharacters
Definition: wrthtml.hxx:291
#define OOO_STRING_SW_HTML_FS_next
Definition: htmlfld.hxx:47
#define RES_CHRATR_CJK_WEIGHT
Definition: hintids.hxx:94
#define OOO_STRING_SW_HTML_FF_llettern
Definition: htmlfld.hxx:73
#define RES_CHRATR_FONT
Definition: hintids.hxx:75
const SwDocInfoSubType DI_COMMENT
Definition: docufld.hxx:69
#define OOO_STRING_SVTOOLS_HTML_O_subtype
#define RES_CHRATR_CJK_FONT
Definition: hintids.hxx:90
#define RES_CHRATR_CJK_FONTSIZE
Definition: hintids.hxx:91
#define OOO_STRING_SW_HTML_FS_page
Definition: htmlfld.hxx:55
#define OOO_STRING_SW_HTML_FS_name
Definition: htmlfld.hxx:33
SvStream & WriteCharPtr(const char *pBuf)
#define OOO_STRING_SW_HTML_FT_author
Definition: htmlfld.hxx:24
#define CSS1_OUTMODE_CJK
Definition: wrthtml.hxx:180
#define OOO_STRING_SW_HTML_FS_city
Definition: htmlfld.hxx:38
void OutNewLine(bool bCheck=false)
Definition: wrthtml.cxx:1412
virtual OUString GetPar1() const
Definition: fldbas.cxx:271
#define OOO_STRING_SW_HTML_FS_shortcut
Definition: htmlfld.hxx:34
#define OOO_STRING_SW_HTML_FS_char
Definition: htmlfld.hxx:58
bool m_bLFPossible
Definition: wrthtml.hxx:377
static SVT_DLLPUBLIC SvStream & Out_AsciiTag(SvStream &, const OString &rStr, bool bOn=true)
#define OOO_STRING_SW_HTML_FS_custom
Definition: htmlfld.hxx:52
SwAttrFnTab aHTMLAttrFnTab
Definition: htmlatr.cxx:3194
#define RES_CHRATR_CTL_FONTSIZE
Definition: hintids.hxx:96
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:89
#define CSS1_OUTMODE_ANY_SCRIPT
Definition: wrthtml.hxx:176
char sal_Char
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
static SVT_DLLPUBLIC OString CreateTableDataOptionsValNum(bool bValue, double fVal, sal_uLong nFormat, SvNumberFormatter &rFormatter, rtl_TextEncoding eDestEnc=RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars=nullptr)
LineEnd GetSystemLineEnd()
#define OOO_STRING_SW_HTML_FF_name
Definition: htmlfld.hxx:62
SVX_NUM_ARABIC
#define OOO_STRING_SW_HTML_FS_word
Definition: htmlfld.hxx:57
SVX_NUM_ROMAN_UPPER
SVX_NUM_ROMAN_LOWER
OString strip(const OString &rIn, sal_Char c)
static sal_uInt16 GetCSS1ScriptForScriptType(sal_uInt16 nScriptType)
Definition: htmlatr.cxx:174
const SwDocInfoSubType DI_CUSTOM
Definition: docufld.hxx:75
SVX_NUM_CHAR_SPECIAL
#define OOO_STRING_SW_HTML_FT_sender
Definition: htmlfld.hxx:25
#define OOO_STRING_SW_HTML_FS_state
Definition: htmlfld.hxx:45
#define OOO_STRING_SW_HTML_FF_arabic
Definition: htmlfld.hxx:68
SVX_NUM_CHARS_LOWER_LETTER
rtl_TextEncoding m_eDestEnc
Definition: wrthtml.hxx:332
#define RES_CHRATR_BACKGROUND
Definition: hintids.hxx:89
#define RES_CHRATR_CTL_FONT
Definition: hintids.hxx:95
#define OOO_STRING_SW_HTML_FF_path
Definition: htmlfld.hxx:78
const SwDocInfoSubType DI_KEYS
Definition: docufld.hxx:68
bool GetParaAttr(SfxItemSet &rSet, sal_Int32 nStt, sal_Int32 nEnd, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true, const bool bMergeIndentValuesOfNumRule=false, SwRootFrame const *pLayout=nullptr) const
Query the attributes of textnode over the range.
Definition: thints.cxx:2053
int i
const SwDocInfoSubType DI_CREATE
Definition: docufld.hxx:70
SwFieldIds
Definition: fldbas.hxx:38
#define OOO_STRING_SW_HTML_FS_cphone
Definition: htmlfld.hxx:42
SW_DLLPUBLIC Writer & Out(const SwAttrFnTab, const SfxPoolItem &, Writer &)
Definition: wrt_fn.cxx:32
OString stripStart(const OString &rIn, sal_Char c)
#define OOO_STRING_SW_HTML_FF_page
Definition: htmlfld.hxx:71
#define OOO_STRING_SW_HTML_FT_datetime
Definition: htmlfld.hxx:26
#define OOO_STRING_SVTOOLS_HTML_O_name
#define OOO_STRING_SW_HTML_FF_uroman
Definition: htmlfld.hxx:66
#define OOO_STRING_SVTOOLS_HTML_sdfield
#define OOO_STRING_SW_HTML_FS_theme
Definition: htmlfld.hxx:49
#define OOO_STRING_SW_HTML_FT_docstat
Definition: htmlfld.hxx:29
const SwDocInfoSubType DI_SUB_DATE
Definition: docufld.hxx:80
#define OOO_STRING_SW_HTML_FS_random
Definition: htmlfld.hxx:46
virtual OUString GetPar2() const
Definition: fldbas.cxx:276
static bool IsFieldShadings()
Definition: viewopt.hxx:625
#define OOO_STRING_SW_HTML_FS_country
Definition: htmlfld.hxx:36
SVX_NUM_CHARS_LOWER_LETTER_N
JAVASCRIPT
virtual sal_uInt16 GetSubType() const
Definition: fldbas.cxx:292
#define OOO_STRING_SW_HTML_FS_keys
Definition: htmlfld.hxx:50
#define OOO_STRING_SW_HTML_FF_char
Definition: htmlfld.hxx:70
#define OOO_STRING_SW_HTML_FS_company
Definition: htmlfld.hxx:31
#define OOO_STRING_SW_HTML_FS_fax
Definition: htmlfld.hxx:43
SwFieldType * GetTyp() const
Definition: fldbas.hxx:382
#define OOO_STRING_SW_HTML_FS_comment
Definition: htmlfld.hxx:51
#define OOO_STRING_SVTOOLS_HTML_O_format
#define OOO_STRING_SW_HTML_FF_ulettern
Definition: htmlfld.hxx:72
bool m_bTagOn
Definition: wrthtml.hxx:346
const SwDocInfoSubType DI_SUB_AUTHOR
Definition: docufld.hxx:78
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
#define OOO_STRING_SW_HTML_FT_docinfo
Definition: htmlfld.hxx:28
#define OOO_STRING_SW_HTML_FF_name_noext
Definition: htmlfld.hxx:79
#define OOO_STRING_SW_HTML_FF_time
Definition: htmlfld.hxx:75
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
SVX_NUM_PAGEDESC
Writer & OutHTML_SwFormatField(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlfldw.cxx:438
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
Definition: fldbas.cxx:412
#define OOO_STRING_SW_HTML_FF_uletter
Definition: htmlfld.hxx:64
virtual OUString GetName() const
Only in derived classes.
Definition: fldbas.cxx:145
static SVT_DLLPUBLIC SvStream & OutScript(SvStream &rStrm, const OUString &rBaseURL, const OUString &rSource, const OUString &rLanguage, ScriptType eScriptType, const OUString &rSrc, const OUString *pSBLibrary, const OUString *pSBModule, rtl_TextEncoding eDestEnc=RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars=nullptr)
SwPageNumSubType
Definition: docufld.hxx:85
#define OOO_STRING_SVTOOLS_HTML_O_style
#define RES_CHRATR_POSTURE
Definition: hintids.hxx:79
#define RES_CHRATR_CTL_WEIGHT
Definition: hintids.hxx:99
#define RES_CHRATR_CTL_POSTURE
Definition: hintids.hxx:98
#define OOO_STRING_SW_HTML_FF_author
Definition: htmlfld.hxx:74
OString GetCSS1_Color(const Color &rColor)
Definition: css1atr.cxx:204
#define CSS1_OUTMODE_WESTERN
Definition: wrthtml.hxx:178
#define OOO_STRING_SW_HTML_FS_ole
Definition: htmlfld.hxx:61
#define OOO_STRING_SW_HTML_FF_date
Definition: htmlfld.hxx:76
#define OOO_STRING_SW_HTML_FF_pathname
Definition: htmlfld.hxx:77
OString GetNamespace() const
Determines the prefix string needed to respect the requested namespace alias.
Definition: wrthtml.cxx:1461
#define OOO_STRING_SW_HTML_FS_position
Definition: htmlfld.hxx:40
bool swhtml_css1atr_equalFontItems(const SfxPoolItem &r1, const SfxPoolItem &r2)
Definition: css1atr.cxx:999
SvStream & WriteChar(char nChar)
#define OOO_STRING_SW_HTML_FF_lletter
Definition: htmlfld.hxx:65
#define OOO_STRING_SW_HTML_FS_zip
Definition: htmlfld.hxx:37
#define OOO_STRING_SVTOOLS_HTML_O_value
#define OOO_STRING_SW_HTML_FS_prev
Definition: htmlfld.hxx:48
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter()
Definition: breakit.hxx:62
OString const aName
SvStream & Strm()
Definition: writer.cxx:221
#define OOO_STRING_SVTOOLS_HTML_O_type
#define OOO_STRING_SW_HTML_FS_tbl
Definition: htmlfld.hxx:59
#define OOO_STRING_SW_HTML_FT_page
Definition: htmlfld.hxx:27
#define OOO_STRING_SVTOOLS_HTML_O_sdfixed
const SwGetSetExpType GSE_STRING
String.
Definition: fldbas.hxx:195
const SwDocInfoSubType DI_CHANGE
Definition: docufld.hxx:71
const sal_Char * sCSS1_P_background
Definition: css1kywd.cxx:109
static const sal_Char * GetNumFormat(sal_uInt16 nFormat)
Definition: htmlfldw.cxx:44
const SwDocInfoSubType DI_THEMA
Definition: docufld.hxx:67
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
#define OOO_STRING_SW_HTML_FS_change
Definition: htmlfld.hxx:54
const SwDocInfoSubType DI_TITLE
Definition: docufld.hxx:66
sal_Int32 nPos
#define OOO_STRING_SVTOOLS_HTML_span
#define CSS1_OUTMODE_CTL
Definition: wrthtml.hxx:182
SwFieldIds Which() const
Definition: fldbas.hxx:265
#define OOO_STRING_SW_HTML_FS_pphone
Definition: htmlfld.hxx:41
#define OOO_STRING_SW_HTML_FS_para
Definition: htmlfld.hxx:56
sal_uInt16 m_nCSS1Script
Definition: wrthtml.hxx:328
SwDoc * m_pDoc
Definition: shellio.hxx:404
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1307
#define OOO_STRING_SW_HTML_FS_create
Definition: htmlfld.hxx:53
std::map< sal_uInt16, int > maStartedAttributes
Tracks which text portion attributes are currently open: a which id -> open count map...
Definition: wrthtml.hxx:404
#define OOO_STRING_SW_HTML_FS_street
Definition: htmlfld.hxx:35
#define OOO_STRING_SW_HTML_FF_none
Definition: htmlfld.hxx:69
#define OOO_STRING_SW_HTML_FS_grf
Definition: htmlfld.hxx:60