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/XBreakIterator.hpp>
21 #include <comphelper/string.hxx>
22 #include <svtools/htmlkywd.hxx>
23 #include <svtools/htmlout.hxx>
24 #include <osl/diagnose.h>
25 #include <fmtfld.hxx>
26 #include <doc.hxx>
27 #include <breakit.hxx>
28 #include <ndtxt.hxx>
29 #include <txtfld.hxx>
30 #include <fldbas.hxx>
31 #include <docufld.hxx>
32 #include <flddat.hxx>
33 #include <viewopt.hxx>
34 #include "htmlfld.hxx"
35 #include "wrthtml.hxx"
36 #include <rtl/strbuf.hxx>
37 #include "css1atr.hxx"
38 #include "css1kywd.hxx"
39 
40 using namespace nsSwDocInfoSubType;
41 
42 const char *SwHTMLWriter::GetNumFormat( sal_uInt16 nFormat )
43 {
44  const char *pFormatStr = nullptr;
45 
46  switch( static_cast<SvxNumType>(nFormat) )
47  {
50  case SVX_NUM_ROMAN_UPPER: pFormatStr = OOO_STRING_SW_HTML_FF_uroman; break;
51  case SVX_NUM_ROMAN_LOWER: pFormatStr = OOO_STRING_SW_HTML_FF_lroman; break;
52  case SVX_NUM_ARABIC: pFormatStr = OOO_STRING_SW_HTML_FF_arabic; break;
53  case SVX_NUM_NUMBER_NONE: pFormatStr = OOO_STRING_SW_HTML_FF_none; break;
54  case SVX_NUM_CHAR_SPECIAL: pFormatStr = OOO_STRING_SW_HTML_FF_char; break;
55  case SVX_NUM_PAGEDESC: pFormatStr = OOO_STRING_SW_HTML_FF_page; break;
58  default:
59  ;
60  }
61 
62  return pFormatStr;
63 }
64 
65 static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField,
66  const SwTextNode& rTextNd, sal_Int32 nFieldPos )
67 {
68  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
69 
70  const SwFieldType* pFieldTyp = pField->GetTyp();
71  SwFieldIds nField = pFieldTyp->Which();
72  sal_uLong nFormat = pField->GetFormat();
73 
74  const char *pTypeStr=nullptr, // TYPE
75  *pSubStr=nullptr, // SUBTYPE
76  *pFormatStr=nullptr; // FORMAT (SW)
77  OUString aValue; // VALUE (SW)
78  bool bNumFormat=false; // SDNUM (Number-Formatter-Format)
79  bool bNumValue=false; // SDVAL (Number-Formatter-Value)
80  double dNumValue = 0.0; // SDVAL (Number-Formatter-Value)
81  bool bFixed=false; // SDFIXED
82  OUString aName; // NAME (CUSTOM)
83 
84  switch( nField )
85  {
88  switch( static_cast<SwExtUserSubType>(pField->GetSubType()) )
89  {
90  case EU_COMPANY: pSubStr = OOO_STRING_SW_HTML_FS_company; break;
91  case EU_FIRSTNAME: pSubStr = OOO_STRING_SW_HTML_FS_firstname; break;
92  case EU_NAME: pSubStr = OOO_STRING_SW_HTML_FS_name; break;
93  case EU_SHORTCUT: pSubStr = OOO_STRING_SW_HTML_FS_shortcut; break;
94  case EU_STREET: pSubStr = OOO_STRING_SW_HTML_FS_street; break;
95  case EU_COUNTRY: pSubStr = OOO_STRING_SW_HTML_FS_country; break;
96  case EU_ZIP: pSubStr = OOO_STRING_SW_HTML_FS_zip; break;
97  case EU_CITY: pSubStr = OOO_STRING_SW_HTML_FS_city; break;
98  case EU_TITLE: pSubStr = OOO_STRING_SW_HTML_FS_title; break;
99  case EU_POSITION: pSubStr = OOO_STRING_SW_HTML_FS_position; break;
100  case EU_PHONE_PRIVATE: pSubStr = OOO_STRING_SW_HTML_FS_pphone; break;
101  case EU_PHONE_COMPANY: pSubStr = OOO_STRING_SW_HTML_FS_cphone; break;
102  case EU_FAX: pSubStr = OOO_STRING_SW_HTML_FS_fax; break;
103  case EU_EMAIL: pSubStr = OOO_STRING_SW_HTML_FS_email; break;
104  case EU_STATE: pSubStr = OOO_STRING_SW_HTML_FS_state; break;
105  default:
106  ;
107  }
108  OSL_ENSURE( pSubStr, "unknown sub type for SwExtUserField" );
109  bFixed = static_cast<const SwExtUserField*>(pField)->IsFixed();
110  break;
111 
112  case SwFieldIds::Author:
113  pTypeStr = OOO_STRING_SW_HTML_FT_author;
114  switch( static_cast<SwAuthorFormat>(nFormat) & 0xff)
115  {
116  case AF_NAME: pFormatStr = OOO_STRING_SW_HTML_FF_name; break;
117  case AF_SHORTCUT: pFormatStr = OOO_STRING_SW_HTML_FF_shortcut; break;
118  }
119  OSL_ENSURE( pFormatStr, "unknown format for SwAuthorField" );
120  bFixed = static_cast<const SwAuthorField*>(pField)->IsFixed();
121  break;
122 
125  bNumFormat = true;
126  if( static_cast<const SwDateTimeField*>(pField)->IsFixed() )
127  {
128  bNumValue = true;
129  dNumValue = static_cast<const SwDateTimeField*>(pField)->GetValue();
130  }
131  break;
132 
134  {
135  pTypeStr = OOO_STRING_SW_HTML_FT_page;
136  SwPageNumSubType eSubType = static_cast<SwPageNumSubType>(pField->GetSubType());
137  switch( eSubType )
138  {
139  case PG_RANDOM: pSubStr = OOO_STRING_SW_HTML_FS_random; break;
140  case PG_NEXT: pSubStr = OOO_STRING_SW_HTML_FS_next; break;
141  case PG_PREV: pSubStr = OOO_STRING_SW_HTML_FS_prev; break;
142  }
143  OSL_ENSURE( pSubStr, "unknown sub type for SwPageNumberField" );
144  pFormatStr = SwHTMLWriter::GetNumFormat( static_cast< sal_uInt16 >(nFormat) );
145 
146  if( static_cast<SvxNumType>(nFormat)==SVX_NUM_CHAR_SPECIAL )
147  {
148  aValue = static_cast<const SwPageNumberField *>(pField)->GetUserString();
149  }
150  else
151  {
152  const OUString& rValue = pField->GetPar2();
153  short nValue = static_cast<short>(rValue.toInt32());
154  if( (eSubType == PG_NEXT && nValue!=1) ||
155  (eSubType == PG_PREV && nValue!=-1) ||
156  (eSubType == PG_RANDOM && nValue!=0) )
157  {
158  aValue = rValue;
159  }
160  }
161  }
162  break;
163  case SwFieldIds::DocInfo:
164  {
165  sal_uInt16 nSubType = pField->GetSubType();
167  sal_uInt16 nExtSubType = nSubType & 0x0f00;
168  nSubType &= 0x00ff;
169 
170  switch( nSubType )
171  {
172  case DI_TITLE: pSubStr = OOO_STRING_SW_HTML_FS_title; break;
173  case DI_SUBJECT: pSubStr = OOO_STRING_SW_HTML_FS_theme; break;
174  case DI_KEYS: pSubStr = OOO_STRING_SW_HTML_FS_keys; break;
175  case DI_COMMENT: pSubStr = OOO_STRING_SW_HTML_FS_comment; break;
176  case DI_CREATE: pSubStr = OOO_STRING_SW_HTML_FS_create; break;
177  case DI_CHANGE: pSubStr = OOO_STRING_SW_HTML_FS_change; break;
178  case DI_CUSTOM: pSubStr = OOO_STRING_SW_HTML_FS_custom; break;
179  default: pTypeStr = nullptr; break;
180  }
181 
182  if( DI_CUSTOM == nSubType ) {
183  aName = static_cast<const SwDocInfoField*>(pField)->GetName();
184  }
185 
186  if( DI_CREATE == nSubType || DI_CHANGE == nSubType )
187  {
188  switch( nExtSubType )
189  {
190  case DI_SUB_AUTHOR:
191  pFormatStr = OOO_STRING_SW_HTML_FF_author;
192  break;
193  case DI_SUB_TIME:
194  pFormatStr = OOO_STRING_SW_HTML_FF_time;
195  bNumFormat = true;
196  break;
197  case DI_SUB_DATE:
198  pFormatStr = OOO_STRING_SW_HTML_FF_date;
199  bNumFormat = true;
200  break;
201  }
202  }
203  bFixed = static_cast<const SwDocInfoField*>(pField)->IsFixed();
204  if( bNumFormat )
205  {
206  if( bFixed )
207  {
208  // For a fixed field output the num value too.
209  // Fixed fields without number format shouldn't
210  // exist. See below for OSL_ENSURE().
211  dNumValue = static_cast<const SwDocInfoField*>(pField)->GetValue();
212  bNumValue = true;
213  }
214  else if( !nFormat )
215  {
216  // Non-fixed fields may not have a number format, when
217  // they come from a 4.0-document.
218  bNumFormat = false;
219  }
220  }
221  }
222  break;
223 
224  case SwFieldIds::DocStat:
225  {
227  sal_uInt16 nSubType = pField->GetSubType();
228  switch( nSubType )
229  {
230  case DS_PAGE: pSubStr = OOO_STRING_SW_HTML_FS_page; break;
231  case DS_PARA: pSubStr = OOO_STRING_SW_HTML_FS_para; break;
232  case DS_WORD: pSubStr = OOO_STRING_SW_HTML_FS_word; break;
233  case DS_CHAR: pSubStr = OOO_STRING_SW_HTML_FS_char; break;
234  case DS_TBL: pSubStr = OOO_STRING_SW_HTML_FS_tbl; break;
235  case DS_GRF: pSubStr = OOO_STRING_SW_HTML_FS_grf; break;
236  case DS_OLE: pSubStr = OOO_STRING_SW_HTML_FS_ole; break;
237  default: pTypeStr = nullptr; break;
238  }
239  pFormatStr = SwHTMLWriter::GetNumFormat( static_cast< sal_uInt16 >(nFormat) );
240  }
241  break;
242 
245  switch( static_cast<SwFileNameFormat>(nFormat & ~FF_FIXED) )
246  {
247  case FF_NAME: pFormatStr = OOO_STRING_SW_HTML_FF_name; break;
248  case FF_PATHNAME: pFormatStr = OOO_STRING_SW_HTML_FF_pathname; break;
249  case FF_PATH: pFormatStr = OOO_STRING_SW_HTML_FF_path; break;
250  case FF_NAME_NOEXT: pFormatStr = OOO_STRING_SW_HTML_FF_name_noext; break;
251  default:
252  ;
253  }
254  bFixed = static_cast<const SwFileNameField*>(pField)->IsFixed();
255  OSL_ENSURE( pFormatStr, "unknown format for SwFileNameField" );
256  break;
257  default: break;
258  }
259 
260  // ReqIF-XHTML doesn't allow <sdfield>.
261  if (rHTMLWrt.mbReqIF && pTypeStr)
262  {
263  pTypeStr = nullptr;
264  }
265 
266  // Output the <sdfield> tag.
267  if( pTypeStr )
268  {
269  OStringBuffer sOut;
270  sOut.append('<');
271  sOut.append(rHTMLWrt.GetNamespace());
272  sOut.append(OOO_STRING_SVTOOLS_HTML_sdfield).append(' ').
273  append(OOO_STRING_SVTOOLS_HTML_O_type).append('=').
274  append(pTypeStr);
275  if( pSubStr )
276  {
277  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_subtype).
278  append('=').append(pSubStr);
279  }
280  if( pFormatStr )
281  {
282  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_format).
283  append('=').append(pFormatStr);
284  }
285  if( !aName.isEmpty() )
286  {
287  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name).
288  append("=\"");
289  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
290  HTMLOutFuncs::Out_String( rWrt.Strm(), aName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
291  sOut.append('\"');
292  }
293  if( !aValue.isEmpty() )
294  {
295  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_value).
296  append("=\"");
297  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
298  HTMLOutFuncs::Out_String( rWrt.Strm(), aValue, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
299  sOut.append('\"');
300  }
301  if( bNumFormat )
302  {
303  OSL_ENSURE( nFormat, "number format is 0" );
305  bNumValue, dNumValue, nFormat,
306  *rHTMLWrt.m_pDoc->GetNumberFormatter(), rHTMLWrt.m_eDestEnc,
307  &rHTMLWrt.m_aNonConvertableCharacters));
308  }
309  if( bFixed )
310  {
311  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdfixed);
312  }
313  sOut.append('>');
314  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
315  }
316 
317  // output content of the field
318  OUString const sExpand( pField->ExpandField(true, nullptr) );
319  bool bNeedsCJKProcessing = false;
320  if( !sExpand.isEmpty() )
321  {
322  sal_uInt16 nScriptType = g_pBreakIt->GetBreakIter()->getScriptType( sExpand, 0 );
323  sal_Int32 nPos = g_pBreakIt->GetBreakIter()->endOfScript( sExpand, 0,
324  nScriptType );
325 
326  sal_uInt16 nScript =
328  if( (nPos < sExpand.getLength() && nPos >= 0) || nScript != rHTMLWrt.m_nCSS1Script )
329  {
330  bNeedsCJKProcessing = true;
331  }
332  }
333 
334  if( bNeedsCJKProcessing )
335  {
336  //sequence of (start, end) property ranges we want to
337  //query
338  SfxItemSet aScriptItemSet( rWrt.m_pDoc->GetAttrPool(),
343  rTextNd.GetParaAttr(aScriptItemSet, nFieldPos, nFieldPos+1);
344 
345  sal_uInt16 aWesternWhichIds[4] =
347  RES_CHRATR_POSTURE, RES_CHRATR_WEIGHT };
348  sal_uInt16 aCJKWhichIds[4] =
351  sal_uInt16 aCTLWhichIds[4] =
354 
355  sal_uInt16 *pRefWhichIds = nullptr;
356  switch( rHTMLWrt.m_nCSS1Script )
357  {
359  pRefWhichIds = aWesternWhichIds;
360  break;
361  case CSS1_OUTMODE_CJK:
362  pRefWhichIds = aCJKWhichIds;
363  break;
364  case CSS1_OUTMODE_CTL:
365  pRefWhichIds = aCTLWhichIds;
366  break;
367  }
368 
369  sal_Int32 nPos = 0;
370  do
371  {
372  sal_uInt16 nScriptType = g_pBreakIt->GetBreakIter()->getScriptType( sExpand, nPos );
373  sal_uInt16 nScript =
375  sal_Int32 nEndPos = g_pBreakIt->GetBreakIter()->endOfScript(
376  sExpand, nPos, nScriptType );
377  sal_Int32 nChunkLen = nEndPos - nPos;
378  if( nScript != CSS1_OUTMODE_ANY_SCRIPT &&
379  /* #108791# */ nScript != rHTMLWrt.m_nCSS1Script )
380  {
381  sal_uInt16 *pWhichIds = nullptr;
382  switch( nScript )
383  {
384  case CSS1_OUTMODE_WESTERN: pWhichIds = aWesternWhichIds; break;
385  case CSS1_OUTMODE_CJK: pWhichIds = aCJKWhichIds; break;
386  case CSS1_OUTMODE_CTL: pWhichIds = aCTLWhichIds; break;
387  }
388 
389  rHTMLWrt.m_bTagOn = true;
390 
391  const SfxPoolItem *aItems[5];
392  int nItems = 0;
393 
394  assert(pWhichIds && pRefWhichIds);
395  if (pWhichIds && pRefWhichIds)
396  {
397  for( int i=0; i<4; i++ )
398  {
399  const SfxPoolItem *pRefItem =
400  aScriptItemSet.GetItem( pRefWhichIds[i] );
401  const SfxPoolItem *pItem =
402  aScriptItemSet.GetItem( pWhichIds[i] );
403  if( pRefItem && pItem &&
404  !(0==i ? swhtml_css1atr_equalFontItems( *pRefItem, *pItem )
405  : *pRefItem == *pItem) )
406  {
407  Out( aHTMLAttrFnTab, *pItem, rHTMLWrt );
408  aItems[nItems++] = pItem;
409  }
410  }
411  }
412 
413  HTMLOutFuncs::Out_String( rWrt.Strm(), sExpand.copy( nPos, nChunkLen ),
414  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
415 
416  rHTMLWrt.m_bTagOn = false;
417  while( nItems )
418  Out( aHTMLAttrFnTab, *aItems[--nItems], rHTMLWrt );
419 
420  }
421  else
422  {
423  HTMLOutFuncs::Out_String( rWrt.Strm(), sExpand.copy( nPos, nChunkLen ),
424  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
425  }
426  nPos = nEndPos;
427  }
428  while( nPos < sExpand.getLength() );
429  }
430  else
431  {
432  HTMLOutFuncs::Out_String( rWrt.Strm(), sExpand,
433  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
434  }
435 
436  // Output the closing tag.
437  if( pTypeStr )
439 
440  return rWrt;
441 }
442 
444 {
445  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
446  const SwFormatField & rField = static_cast<const SwFormatField&>(rHt);
447  const SwField* pField = rField.GetField();
448  const SwFieldType* pFieldTyp = pField->GetTyp();
449 
450  if( SwFieldIds::SetExp == pFieldTyp->Which() &&
452  {
453  const bool bOn = pFieldTyp->GetName() == "HTML_ON";
454  if (!bOn && pFieldTyp->GetName() != "HTML_OFF")
455  return rWrt;
456 
457  OUString rText(comphelper::string::strip(pField->GetPar2(), ' '));
458  rWrt.Strm().WriteChar( '<' );
459  if( !bOn )
460  rWrt.Strm().WriteChar( '/' );
461  // TODO: HTML-Tags are written without entities, that for, characters
462  // not contained in the destination encoding are lost!
463  OString sTmp(OUStringToOString(rText,
464  static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc));
465  rWrt.Strm().WriteOString( sTmp ).WriteChar( '>' );
466  }
467  else if( SwFieldIds::Postit == pFieldTyp->Which() )
468  {
469  // Comments will be written in ANSI character set, but with system
470  // line breaks.
471  const OUString& rComment = pField->GetPar2();
472  bool bWritten = false;
473 
474  if( (rComment.getLength() >= 6 && rComment.startsWith("<") && rComment.endsWith(">") &&
475  rComment.copy( 1, 4 ).equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_meta) ) ||
476  (rComment.getLength() >= 7 &&
477  rComment.startsWith( "<!--" ) &&
478  rComment.endsWith( "-->" )) )
479  {
480  // directly output META tags
481  OUString sComment(convertLineEnd(rComment, GetSystemLineEnd()));
482  // TODO: HTML-Tags are written without entities, that for,
483  // characters not contained in the destination encoding are lost!
484  OString sTmp(OUStringToOString(sComment,
485  static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc));
486  rWrt.Strm().WriteOString( sTmp );
487  bWritten = true;
488  }
489  else if( rComment.getLength() >= 7 &&
490  rComment.endsWith(">") &&
491  rComment.startsWithIgnoreAsciiCase( "HTML:" ) )
492  {
493  OUString sComment(comphelper::string::stripStart(rComment.copy(5), ' '));
494  if( '<' == sComment[0] )
495  {
496  sComment = convertLineEnd(sComment, GetSystemLineEnd());
497  // TODO: HTML-Tags are written without entities, that for,
498  // characters not contained in the destination encoding are
499  // lost!
500  OString sTmp(OUStringToOString(sComment,
501  static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc));
502  rWrt.Strm().WriteOString( sTmp );
503  bWritten = true;
504  }
505 
506  }
507 
508  if( !bWritten )
509  {
510  OUString sComment(convertLineEnd(rComment, GetSystemLineEnd()));
511  // TODO: ???
512  OString sOut =
514  " " +
515  OUStringToOString(sComment, static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc) +
516  " -->";
517  rWrt.Strm().WriteOString( sOut );
518  }
519  }
520  else if( SwFieldIds::Script == pFieldTyp->Which() )
521  {
522  if( rHTMLWrt.m_bLFPossible )
523  rHTMLWrt.OutNewLine( true );
524 
525  bool bURL = static_cast<const SwScriptField *>(pField)->IsCodeURL();
526  const OUString& rType = pField->GetPar1();
527  OUString aContents, aURL;
528  if(bURL)
529  aURL = pField->GetPar2();
530  else
531  aContents = pField->GetPar2();
532 
533  // otherwise is the script content itself. Since only JavaScript
534  // is in fields, it must be JavaScript ...:)
535  HTMLOutFuncs::OutScript( rWrt.Strm(), rWrt.GetBaseURL(), aContents, rType, JAVASCRIPT,
536  aURL, nullptr, nullptr, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
537 
538  if( rHTMLWrt.m_bLFPossible )
539  rHTMLWrt.OutNewLine( true );
540  }
541  else
542  {
543  const SwTextField *pTextField = rField.GetTextField();
544  OSL_ENSURE( pTextField, "Where is the txt fld?" );
545  if( pTextField )
546  {
547  // ReqIF-XHTML doesn't allow specifying a background color.
548  bool bFieldShadings = SwViewOption::IsFieldShadings() && !rHTMLWrt.mbReqIF;
549  if (bFieldShadings)
550  {
551  // If there is a text portion background started already, that should have priority.
552  auto it = rHTMLWrt.maStartedAttributes.find(RES_CHRATR_BACKGROUND);
553  if (it != rHTMLWrt.maStartedAttributes.end())
554  bFieldShadings = it->second <= 0;
555  }
556 
557  if (bFieldShadings)
558  {
559  OStringBuffer sOut;
560  sOut.append("<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span);
561  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_style "=\"");
562  sOut.append(sCSS1_P_background);
563  sOut.append(": ");
564 
566  sOut.append(GetCSS1_Color(rColor));
567  sOut.append("\">");
568  rWrt.Strm().WriteOString(sOut.makeStringAndClear());
569  }
570 
571  OutHTML_SwField( rWrt, pField, pTextField->GetTextNode(),
572  pTextField->GetStart() );
573 
574  if (bFieldShadings)
576  rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span, false);
577  }
578  }
579  return rWrt;
580 }
581 
582 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:240
static Writer & OutHTML_SwField(Writer &rWrt, const SwField *pField, const SwTextNode &rTextNd, sal_Int32 nFieldPos)
Definition: htmlfldw.cxx:65
const SwDocInfoSubType DI_SUB_TIME
Definition: docufld.hxx:79
#define OOO_STRING_SW_HTML_FS_title
Definition: htmlfld.hxx:39
static Color & GetFieldShadingsColor()
Definition: viewopt.cxx:430
SVX_NUM_CHARS_UPPER_LETTER_N
URL aURL
const OUString & GetBaseURL() const
Definition: shellio.hxx:445
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
#define OOO_STRING_SW_HTML_FS_email
Definition: htmlfld.hxx:44
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
const SwField * GetField() const
Definition: fmtfld.hxx:111
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars=nullptr)
#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:401
std::string GetValue
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1409
#define OOO_STRING_SW_HTML_FF_shortcut
Definition: htmlfld.hxx:63
#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
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
Base class of all fields.
Definition: fldbas.hxx:293
SVX_NUM_CHARS_UPPER_LETTER
#define OOO_STRING_SW_HTML_FF_lroman
Definition: htmlfld.hxx:67
OUString m_aNonConvertableCharacters
Definition: wrthtml.hxx:293
#define OOO_STRING_SW_HTML_FS_next
Definition: htmlfld.hxx:47
#define OOO_STRING_SW_HTML_FF_llettern
Definition: htmlfld.hxx:73
const SwDocInfoSubType DI_COMMENT
Definition: docufld.hxx:69
SvStream & WriteOString(const OString &rStr)
#define OOO_STRING_SVTOOLS_HTML_O_subtype
#define OOO_STRING_SW_HTML_FS_page
Definition: htmlfld.hxx:55
#define OOO_STRING_SW_HTML_FS_name
Definition: htmlfld.hxx:33
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
#define OOO_STRING_SW_HTML_FT_author
Definition: htmlfld.hxx:24
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
#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:1432
virtual OUString GetPar1() const
Definition: fldbas.cxx:302
#define OOO_STRING_SW_HTML_FS_shortcut
Definition: htmlfld.hxx:34
css::uno::Any const & rValue
#define OOO_STRING_SW_HTML_FS_char
Definition: htmlfld.hxx:58
bool m_bLFPossible
Definition: wrthtml.hxx:379
static SVT_DLLPUBLIC SvStream & Out_AsciiTag(SvStream &, const OString &rStr, bool bOn=true)
bool mbReqIF
If the ReqIF subset of XHTML should be written.
Definition: wrthtml.hxx:398
#define OOO_STRING_SW_HTML_FS_custom
Definition: htmlfld.hxx:52
SwAttrFnTab aHTMLAttrFnTab
Definition: htmlatr.cxx:3216
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:129
#define CSS1_OUTMODE_ANY_SCRIPT
Definition: wrthtml.hxx:176
static const char * GetNumFormat(sal_uInt16 nFormat)
Definition: htmlfldw.cxx:42
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
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
const SwDocInfoSubType DI_SUBJECT
Definition: docufld.hxx:67
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
#define OOO_STRING_SW_HTML_FS_word
Definition: htmlfld.hxx:57
SVX_NUM_ROMAN_UPPER
SVX_NUM_ROMAN_LOWER
const char *const sCSS1_P_background
Definition: css1kywd.cxx:109
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
static sal_uInt16 GetCSS1ScriptForScriptType(sal_uInt16 nScriptType)
Definition: htmlatr.cxx:167
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:334
int i
#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:2095
const SwDocInfoSubType DI_CREATE
Definition: docufld.hxx:70
SwFieldIds
Definition: fldbas.hxx:44
#define OOO_STRING_SW_HTML_FS_cphone
Definition: htmlfld.hxx:42
#define OOO_STRING_SW_HTML_FF_page
Definition: htmlfld.hxx:71
#define OOO_STRING_SW_HTML_FT_datetime
Definition: htmlfld.hxx:26
Writer & Out(const SwAttrFnTab, const SfxPoolItem &, Writer &)
Definition: wrt_fn.cxx:31
#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:307
static bool IsFieldShadings()
Definition: viewopt.hxx:644
#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:323
#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:396
#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:348
const SwDocInfoSubType DI_SUB_AUTHOR
Definition: docufld.hxx:78
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:62
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
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
SVX_NUM_PAGEDESC
Writer & OutHTML_SwFormatField(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlfldw.cxx:443
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
Definition: fldbas.cxx:443
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
#define OOO_STRING_SW_HTML_FF_uletter
Definition: htmlfld.hxx:64
virtual OUString GetName() const
Only in derived classes.
Definition: fldbas.cxx:135
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
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
#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
OUString aName
OString strip(const OString &rIn, char c)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
#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:1481
OString stripStart(const OString &rIn, char c)
#define OOO_STRING_SW_HTML_FS_position
Definition: htmlfld.hxx:40
bool swhtml_css1atr_equalFontItems(const SfxPoolItem &r1, const SfxPoolItem &r2)
Definition: css1atr.cxx:1003
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
SvStream & Strm()
Definition: writer.cxx:215
#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:202
const SwDocInfoSubType DI_CHANGE
Definition: docufld.hxx:71
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
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
#define OOO_STRING_SVTOOLS_HTML_span
#define CSS1_OUTMODE_CTL
Definition: wrthtml.hxx:182
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
SwFieldIds Which() const
Definition: fldbas.hxx:272
#define OOO_STRING_SW_HTML_FS_pphone
Definition: htmlfld.hxx:41
#define OOO_STRING_SW_HTML_FS_para
Definition: htmlfld.hxx:56
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
sal_uInt16 m_nCSS1Script
Definition: wrthtml.hxx:330
SwDoc * m_pDoc
Definition: shellio.hxx:409
sal_uInt16 nPos
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1317
sal_Int16 nValue
#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:406
#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