LibreOffice Module sw (master)  1
htmlatr.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 <hintids.hxx>
21 #include <com/sun/star/i18n/ScriptType.hpp>
22 #include <com/sun/star/i18n/XBreakIterator.hpp>
23 #include <comphelper/string.hxx>
24 #include <utility>
25 #include <vcl/svapp.hxx>
26 #include <vcl/wrkwin.hxx>
27 #include <svtools/htmlout.hxx>
28 #include <svtools/htmlkywd.hxx>
29 #include <svtools/htmltokn.h>
30 #include <svl/whiter.hxx>
31 #include <sfx2/event.hxx>
32 #include <sfx2/htmlmode.hxx>
35 #include <editeng/boxitem.hxx>
36 #include <editeng/ulspitem.hxx>
37 #include <editeng/udlnitem.hxx>
39 #include <editeng/blinkitem.hxx>
40 #include <editeng/cmapitem.hxx>
41 #include <editeng/colritem.hxx>
42 #include <editeng/fontitem.hxx>
43 #include <editeng/fhgtitem.hxx>
44 #include <editeng/postitem.hxx>
45 #include <editeng/kernitem.hxx>
46 #include <editeng/wghtitem.hxx>
47 #include <editeng/lspcitem.hxx>
48 #include <editeng/adjustitem.hxx>
49 #include <editeng/lrspitem.hxx>
50 #include <editeng/brushitem.hxx>
51 #include <editeng/langitem.hxx>
52 #include <editeng/frmdiritem.hxx>
53 #include <fchrfmt.hxx>
54 #include <fmtautofmt.hxx>
55 #include <fmtfsize.hxx>
56 #include <fmtclds.hxx>
57 #include <fmtpdsc.hxx>
58 #include <fmtflcnt.hxx>
59 #include <fmtinfmt.hxx>
60 #include <txatbase.hxx>
61 #include <frmatr.hxx>
62 #include <charfmt.hxx>
63 #include <fmtfld.hxx>
64 #include <doc.hxx>
66 #include <pam.hxx>
67 #include <ndtxt.hxx>
68 #include <paratr.hxx>
69 #include <poolfmt.hxx>
70 #include <pagedesc.hxx>
71 #include <swtable.hxx>
72 #include <fldbas.hxx>
73 #include <breakit.hxx>
74 #include "htmlatr.hxx"
75 #include "htmlnum.hxx"
76 #include "wrthtml.hxx"
77 #include "htmlfly.hxx"
78 #include <numrule.hxx>
79 #include <rtl/strbuf.hxx>
80 #include <rtl/character.hxx>
81 #include <osl/diagnose.h>
82 #include <deque>
83 
84 #include <svtools/HtmlWriter.hxx>
85 
86 #include <memory>
87 #include <algorithm>
88 
89 using namespace css;
90 
92 {
96  { nullptr, nullptr, SvMacroItemId::NONE }
97 };
98 
99 static Writer& OutHTML_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt );
100 
101 sal_uInt16 SwHTMLWriter::GetDefListLvl( const OUString& rNm, sal_uInt16 nPoolId )
102 {
103  if( nPoolId == RES_POOLCOLL_HTML_DD )
104  {
105  return 1 | HTML_DLCOLL_DD;
106  }
107  else if( nPoolId == RES_POOLCOLL_HTML_DT )
108  {
109  return 1 | HTML_DLCOLL_DT;
110  }
111 
112  OUString sDTDD( OOO_STRING_SVTOOLS_HTML_dt );
113  sDTDD += " ";
114  if( rNm.startsWith(sDTDD) )
115  // DefinitionList - term
116  return static_cast<sal_uInt16>(rNm.copy( sDTDD.getLength() ).toInt32()) | HTML_DLCOLL_DT;
117 
118  sDTDD = OOO_STRING_SVTOOLS_HTML_dd " ";
119  if( rNm.startsWith(sDTDD) )
120  // DefinitionList - definition
121  return static_cast<sal_uInt16>(rNm.copy( sDTDD.getLength() ).toInt32()) | HTML_DLCOLL_DD;
122 
123  return 0;
124 }
125 
126 void SwHTMLWriter::OutAndSetDefList( sal_uInt16 nNewLvl )
127 {
128  // possibly, we first need to start a new list
129  if( m_nDefListLvl < nNewLvl )
130  {
131  // output </pre> for the previous(!) paragraph, if required.
132  // Preferable, the <pre> is exported by OutHTML_SwFormatOff for the
133  // previous paragraph already, but that's not possible, because a very
134  // deep look at the next paragraph (this one) is required to figure
135  // out that a def list starts here.
136 
137  ChangeParaToken( HtmlTokenId::NONE );
138 
139  // write according to the level difference
140  for( sal_uInt16 i=m_nDefListLvl; i<nNewLvl; i++ )
141  {
142  if( m_bLFPossible )
143  OutNewLine();
145  IncIndentLevel();
146  m_bLFPossible = true;
147  }
148  }
149  else if( m_nDefListLvl > nNewLvl )
150  {
151  for( sal_uInt16 i=nNewLvl ; i < m_nDefListLvl; i++ )
152  {
153  DecIndentLevel();
154  if( m_bLFPossible )
155  OutNewLine();
156  HTMLOutFuncs::Out_AsciiTag( Strm(), GetNamespace() + OOO_STRING_SVTOOLS_HTML_deflist, false );
157  m_bLFPossible = true;
158  }
159  }
160 
161  m_nDefListLvl = nNewLvl;
162 }
163 
165 {
166  if( nNew != m_nLastParaToken && HtmlTokenId::PREFORMTXT_ON == m_nLastParaToken )
167  {
168  HTMLOutFuncs::Out_AsciiTag( Strm(), GetNamespace() + OOO_STRING_SVTOOLS_HTML_preformtxt, false );
169  m_bLFPossible = true;
170  }
171  m_nLastParaToken = nNew;
172 }
173 
174 sal_uInt16 SwHTMLWriter::GetCSS1ScriptForScriptType( sal_uInt16 nScriptType )
175 {
176  sal_uInt16 nRet = CSS1_OUTMODE_ANY_SCRIPT;
177 
178  switch( nScriptType )
179  {
180  case i18n::ScriptType::LATIN:
181  nRet = CSS1_OUTMODE_WESTERN;
182  break;
183  case i18n::ScriptType::ASIAN:
184  nRet = CSS1_OUTMODE_CJK;
185  break;
186  case i18n::ScriptType::COMPLEX:
187  nRet = CSS1_OUTMODE_CTL;
188  break;
189  }
190 
191  return nRet;
192 }
193 
194 // a single output function should be enough for all formats
195 /*
196  * Output the formats as follows
197  * - output the tag for formats for which a corresponding HTML tag exist
198  * - for all the other formats, output a paragraph tag <P> and set bUserFormat
199  * - if a paragraph alignment is set for the supplied ItemSet of the node or
200  * for the ItemSet of the format, output an ALIGN=xxx if HTML allows it
201  * - In all cases, hard attribute is written as STYLE option.
202  * If bUserFormat is not set, only the supplied ItemSet is considered.
203  * Otherwise, attributes of the format are output as well.
204  */
205 
207 {
208  OString aToken; // End token to be output
209  std::unique_ptr<SfxItemSet> pItemSet; // hard attribute
210 
211  bool bInNumBulList; // in an enumerated list;
212  bool bParaPossible; // a </P> may be output additionally
213  bool bOutPara; // a </P> is supposed to be output
214  bool bOutDiv; // write a </DIV>
215  bool bOutLi = false; // write a </li>
216 
218  bInNumBulList( false ),
219  bParaPossible( false ),
220  bOutPara( false ),
221  bOutDiv( false )
222  {}
223 
224  bool HasParaToken() const { return aToken.getLength()==1 && aToken[0]=='P'; }
225  bool ShouldOutputToken() const { return bOutPara || !HasParaToken(); }
226 };
227 
229  bool bOutStyles,
230  LanguageType eDfltLang,
231  sal_uInt16 nCSS1Script )
232  : pFormat(pF)
233  , nLeftMargin(0)
234  , nRightMargin(0)
235  , nFirstLineIndent(0)
236  , nTopMargin(0)
237  , nBottomMargin(0)
238  , bScriptDependent( false )
239 {
240  sal_uInt16 nRefPoolId = 0;
241  // Get the selector of the format
242  sal_uInt16 nDeep = SwHTMLWriter::GetCSS1Selector( pFormat, aToken, aClass,
243  nRefPoolId );
244  OSL_ENSURE( nDeep ? !aToken.isEmpty() : aToken.isEmpty(),
245  "Something seems to be wrong with this token!" );
246  OSL_ENSURE( nDeep ? nRefPoolId != 0 : nRefPoolId == 0,
247  "Something seems to be wrong with the comparison style!" );
248 
249  bool bTextColl = pFormat->Which() == RES_TXTFMTCOLL ||
251 
252  const SwFormat *pReferenceFormat = nullptr; // Comparison format
253  if( nDeep != 0 )
254  {
255  // It's an HTML-tag style or this style is derived from such
256  // a style.
257  if( !bOutStyles )
258  {
259  // if no styles are exported, it may be necessary to additionally
260  // write hard attribute
261  switch( nDeep )
262  {
263  case CSS1_FMT_ISTAG:
264  case CSS1_FMT_CMPREF:
265  // for HTML-tag styles the differences to the original
266  // (if available)
267  pReferenceFormat = SwHTMLWriter::GetTemplateFormat( nRefPoolId,
268  &pTemplate->getIDocumentStylePoolAccess() );
269  break;
270 
271  default:
272  // otherwise, the differences to the HTML-tag style of the
273  // original or the ones to the current document, if it the
274  // HTML-tag style is not available
275  if( pTemplate )
276  pReferenceFormat = SwHTMLWriter::GetTemplateFormat( nRefPoolId,
277  &pTemplate->getIDocumentStylePoolAccess() );
278  else
279  pReferenceFormat = SwHTMLWriter::GetParentFormat( *pFormat, nDeep );
280  break;
281  }
282  }
283  }
284  else if( bTextColl )
285  {
286  // HTML-tag styles that are not derived from a paragraph style
287  // must be exported as hard attribute relative to the text-body
288  // style. For a 'not-styles' export, the one of the HTML style
289  // should be used as a reference
290  if( !bOutStyles && pTemplate )
291  pReferenceFormat = pTemplate->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TEXT, false );
292  else
293  pReferenceFormat = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TEXT, false );
294  }
295 
296  if( pReferenceFormat || nDeep==0 )
297  {
298  pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
299  pFormat->GetAttrSet().GetRanges() ) );
300  // if the differences to a different style are supposed to be
301  // written, hard attribute is necessary. This is always true
302  // for styles that are not derived from HTML-tag styles.
303 
304  pItemSet->Set( pFormat->GetAttrSet() );
305 
306  if( pReferenceFormat )
307  SwHTMLWriter::SubtractItemSet( *pItemSet, pReferenceFormat->GetAttrSet(), true );
308 
309  // delete ItemSet that is empty straight away. This will save work
310  // later on
311  if( !pItemSet->Count() )
312  {
313  pItemSet.reset();
314  }
315  }
316 
317  if( !bTextColl )
318  return;
319 
320  if( bOutStyles )
321  {
322  // We have to add hard attributes for any script dependent
323  // item that is not accessed by the style
324  static const sal_uInt16 aWhichIds[3][4] =
325  {
332  };
333 
334  sal_uInt16 nRef = 0;
335  sal_uInt16 aSets[2] = {0,0};
336  switch( nCSS1Script )
337  {
339  nRef = 0;
340  aSets[0] = 1;
341  aSets[1] = 2;
342  break;
343  case CSS1_OUTMODE_CJK:
344  nRef = 1;
345  aSets[0] = 0;
346  aSets[1] = 2;
347  break;
348  case CSS1_OUTMODE_CTL:
349  nRef = 2;
350  aSets[0] = 0;
351  aSets[1] = 1;
352  break;
353  }
354  for( int i=0; i<4; ++i )
355  {
356  const SfxPoolItem& rRef = pFormat->GetFormatAttr( aWhichIds[nRef][i] );
357  for(sal_uInt16 nSet : aSets)
358  {
359  const SfxPoolItem& rSet = pFormat->GetFormatAttr( aWhichIds[nSet][i] );
360  if( rSet != rRef )
361  {
362  if( !pItemSet )
363  pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
364  pFormat->GetAttrSet().GetRanges() ) );
365  pItemSet->Put( rSet );
366  }
367  }
368  }
369  }
370 
371  // remember all the different default spacings from the style or
372  // the comparison style.
373  const SvxLRSpaceItem &rLRSpace =
374  (pReferenceFormat ? pReferenceFormat : pFormat)->GetLRSpace();
375  nLeftMargin = rLRSpace.GetTextLeft();
376  nRightMargin = rLRSpace.GetRight();
378 
379  const SvxULSpaceItem &rULSpace =
380  (pReferenceFormat ? pReferenceFormat : pFormat)->GetULSpace();
381  nTopMargin = rULSpace.GetUpper();
382  nBottomMargin = rULSpace.GetLower();
383 
384  // export language if it differs from the default language
385  sal_uInt16 nWhichId =
387  const SvxLanguageItem& rLang =
388  static_cast<const SvxLanguageItem&>(pFormat->GetFormatAttr( nWhichId ));
389  LanguageType eLang = rLang.GetLanguage();
390  if( eLang != eDfltLang )
391  {
392  if( !pItemSet )
393  pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
394  pFormat->GetAttrSet().GetRanges() ) );
395  pItemSet->Put( rLang );
396  }
397 
398  static const sal_uInt16 aWhichIds[3] =
401  for(sal_uInt16 i : aWhichIds)
402  {
403  if( i != nWhichId )
404  {
405  const SvxLanguageItem& rTmpLang =
406  static_cast<const SvxLanguageItem&>(pFormat->GetFormatAttr(i));
407  if( rTmpLang.GetLanguage() != eLang )
408  {
409  if( !pItemSet )
410  pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
411  pFormat->GetAttrSet().GetRanges() ) );
412  pItemSet->Put( rTmpLang );
413  }
414  }
415  }
416 
417 }
418 
420 {
421 }
422 
423 static void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat,
424  const SfxItemSet *pNodeItemSet,
425  SwHTMLTextCollOutputInfo& rInfo )
426 {
427  OSL_ENSURE( RES_CONDTXTFMTCOLL==rFormat.Which() || RES_TXTFMTCOLL==rFormat.Which(),
428  "not a paragraph style" );
429 
430  SwHTMLWriter & rHWrt = static_cast<SwHTMLWriter&>(rWrt);
431 
432  // First, some flags
433  sal_uInt16 nNewDefListLvl = 0;
434  sal_uInt16 nNumStart = USHRT_MAX;
435  bool bForceDL = false;
436  bool bDT = false;
437  rInfo.bInNumBulList = false; // Are we in a list?
438  bool bNumbered = false; // The current paragraph is numbered
439  bool bPara = false; // the current token is <P>
440  rInfo.bParaPossible = false; // a <P> may be additionally output
441  bool bNoEndTag = false; // don't output an end tag
442 
443  rHWrt.m_bNoAlign = false; // no ALIGN=... possible
444  sal_uInt8 nBulletGrfLvl = 255; // The bullet graphic we want to output
445 
446  // Are we in a bulleted or numbered list?
447  const SwTextNode* pTextNd = rWrt.m_pCurrentPam->GetNode().GetTextNode();
448 
449  SwHTMLNumRuleInfo aNumInfo;
450  if( rHWrt.GetNextNumInfo() )
451  {
452  aNumInfo = *rHWrt.GetNextNumInfo();
453  rHWrt.ClearNextNumInfo();
454  }
455  else
456  {
457  aNumInfo.Set( *pTextNd );
458  }
459 
460  if( aNumInfo.GetNumRule() )
461  {
462  rInfo.bInNumBulList = true;
463  nNewDefListLvl = 0;
464 
465  // is the current paragraph numbered?
466  bNumbered = aNumInfo.IsNumbered();
467  sal_uInt8 nLvl = aNumInfo.GetLevel();
468 
469  OSL_ENSURE( pTextNd->GetActualListLevel() == nLvl,
470  "Remembered Num level is wrong" );
471  OSL_ENSURE( bNumbered == pTextNd->IsCountedInList(),
472  "Remembered numbering state is wrong" );
473 
474  if( bNumbered )
475  {
476  nBulletGrfLvl = nLvl; // only temporarily!!!
477  // #i57919#
478  // correction of re-factoring done by cws swnumtree:
479  // - <nNumStart> has to contain the restart value, if the
480  // numbering is restarted at this text node. Value <USHRT_MAX>
481  // indicates, that no additional restart value has to be written.
482  if ( pTextNd->IsListRestart() )
483  {
484  nNumStart = static_cast< sal_uInt16 >(pTextNd->GetActualListStartValue());
485  }
486  OSL_ENSURE( rHWrt.m_nLastParaToken == HtmlTokenId::NONE,
487  "<PRE> was not closed before <LI>." );
488  }
489  }
490 
491  // Now, we're getting the token and, if necessary, the class
492  std::unique_ptr<SwHTMLFormatInfo> pTmpInfo(new SwHTMLFormatInfo(&rFormat));
493  SwHTMLFormatInfo *pFormatInfo;
494  SwHTMLFormatInfos::iterator it = rHWrt.m_TextCollInfos.find( pTmpInfo );
495  if (it != rHWrt.m_TextCollInfos.end())
496  {
497  pFormatInfo = it->get();
498  }
499  else
500  {
501  pFormatInfo = new SwHTMLFormatInfo( &rFormat, rWrt.m_pDoc, rHWrt.m_xTemplate.get(),
502  rHWrt.m_bCfgOutStyles, rHWrt.m_eLang,
503  rHWrt.m_nCSS1Script );
504  rHWrt.m_TextCollInfos.insert(std::unique_ptr<SwHTMLFormatInfo>(pFormatInfo));
505  if( rHWrt.m_aScriptParaStyles.count( rFormat.GetName() ) )
506  pFormatInfo->bScriptDependent = true;
507  }
508 
509  // Now, we define what is possible due to the token
510  HtmlTokenId nToken = HtmlTokenId::NONE; // token for tag change
511  bool bOutNewLine = false; // only output a single LF?
512  if( !pFormatInfo->aToken.isEmpty() )
513  {
514  // It is an HTML-tag style or the style is derived from such a
515  // style.
516  rInfo.aToken = pFormatInfo->aToken;
517 
519  {
520  rInfo.bParaPossible = true;
521  rHWrt.m_bNoAlign = true;
522  }
523  else if (rInfo.aToken == OOO_STRING_SVTOOLS_HTML_blockquote)
524  {
525  rInfo.bParaPossible = true;
526  rHWrt.m_bNoAlign = true;
527  }
528  else if (rInfo.aToken == OOO_STRING_SVTOOLS_HTML_parabreak)
529  {
530  bPara = true;
531  }
532  else if (rInfo.aToken == OOO_STRING_SVTOOLS_HTML_preformtxt)
533  {
534  if (HtmlTokenId::PREFORMTXT_ON == rHWrt.m_nLastParaToken)
535  {
536  bOutNewLine = true;
537  }
538  else
539  {
540  nToken = HtmlTokenId::PREFORMTXT_ON;
541  rHWrt.m_bNoAlign = true;
542  bNoEndTag = true;
543  }
544  }
546  {
547  bDT = rInfo.aToken == OOO_STRING_SVTOOLS_HTML_dt;
548  rInfo.bParaPossible = !bDT;
549  rHWrt.m_bNoAlign = true;
550  bForceDL = true;
551  }
552  }
553  else
554  {
555  // all styles that do not correspond to an HTML tag, or that are
556  // not derived from it, are exported as <P>
557 
559  bPara = true;
560  }
561 
562  // If necessary, take the hard attribute from the style
563  if( pFormatInfo->pItemSet )
564  {
565  OSL_ENSURE(!rInfo.pItemSet, "Where does this ItemSet come from?");
566  rInfo.pItemSet.reset(new SfxItemSet( *pFormatInfo->pItemSet ));
567  }
568 
569  // additionally, add the hard attribute from the paragraph
570  if( pNodeItemSet )
571  {
572  if (rInfo.pItemSet)
573  rInfo.pItemSet->Put( *pNodeItemSet );
574  else
575  rInfo.pItemSet.reset(new SfxItemSet( *pNodeItemSet ));
576  }
577 
578  // we will need the lower spacing of the paragraph later on
579  const SvxULSpaceItem& rULSpace =
580  pNodeItemSet ? pNodeItemSet->Get(RES_UL_SPACE)
581  : rFormat.GetULSpace();
582 
583  if( (rHWrt.m_bOutHeader &&
584  rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() ==
585  rWrt.m_pCurrentPam->GetMark()->nNode.GetIndex()) ||
586  rHWrt.m_bOutFooter )
587  {
588  if( rHWrt.m_bCfgOutStyles )
589  {
590  SvxULSpaceItem aULSpaceItem( rULSpace );
591  if( rHWrt.m_bOutHeader )
592  aULSpaceItem.SetLower( rHWrt.m_nHeaderFooterSpace );
593  else
594  aULSpaceItem.SetUpper( rHWrt.m_nHeaderFooterSpace );
595 
596  if (!rInfo.pItemSet)
597  {
599  }
600  rInfo.pItemSet->Put( aULSpaceItem );
601  }
602  rHWrt.m_bOutHeader = false;
603  rHWrt.m_bOutFooter = false;
604  }
605 
606  if( bOutNewLine )
607  {
608  // output a line break (without indentation) at the beginning of the
609  // paragraph, only
610  rInfo.aToken.clear(); // don't output an end tag
612 
613  return;
614  }
615 
616  // should an ALIGN=... be written?
617  const SfxPoolItem* pAdjItem = nullptr;
618  const SfxPoolItem* pItem;
619 
620  if( rInfo.pItemSet &&
621  SfxItemState::SET == rInfo.pItemSet->GetItemState( RES_PARATR_ADJUST,
622  false, &pItem ) )
623  {
624  pAdjItem = pItem;
625  }
626 
627  // Consider the lower spacing of the paragraph? (never in the last
628  // paragraph of tables)
629  bool bUseParSpace = !rHWrt.m_bOutTable ||
630  (rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() !=
631  rWrt.m_pCurrentPam->GetMark()->nNode.GetIndex());
632  // If styles are exported, indented paragraphs become definition lists
633  const SvxLRSpaceItem& rLRSpace =
634  pNodeItemSet ? pNodeItemSet->Get(RES_LR_SPACE)
635  : rFormat.GetLRSpace();
636  if( (!rHWrt.m_bCfgOutStyles || bForceDL) && !rInfo.bInNumBulList )
637  {
638  sal_Int32 nLeftMargin;
639  if( bForceDL )
640  nLeftMargin = rLRSpace.GetTextLeft();
641  else
642  nLeftMargin = rLRSpace.GetTextLeft() > pFormatInfo->nLeftMargin
643  ? rLRSpace.GetTextLeft() - pFormatInfo->nLeftMargin
644  : 0;
645 
646  if( nLeftMargin > 0 && rHWrt.m_nDefListMargin > 0 )
647  {
648  nNewDefListLvl = static_cast< sal_uInt16 >((nLeftMargin + (rHWrt.m_nDefListMargin/2)) /
649  rHWrt.m_nDefListMargin);
650  if( nNewDefListLvl == 0 && bForceDL && !bDT )
651  nNewDefListLvl = 1;
652  }
653  else
654  {
655  // If the left margin is 0 or negative, emulating indent
656  // with <dd> does not work. We then set a def list only if
657  // the dd style is used.
658  nNewDefListLvl = (bForceDL&& !bDT) ? 1 : 0;
659  }
660 
661  bool bIsNextTextNode =
662  rWrt.m_pDoc->GetNodes()[rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex()+1]
663  ->IsTextNode();
664 
665  if( bForceDL && bDT )
666  {
667  // Instead of a DD we must use a DT from the level above this one.
668  nNewDefListLvl++;
669  }
670  else if( !nNewDefListLvl && !rHWrt.m_bCfgOutStyles && bPara &&
671  rULSpace.GetLower()==0 &&
672  ((bUseParSpace && bIsNextTextNode) || rHWrt.m_nDefListLvl==1) &&
673  (!pAdjItem || SvxAdjust::Left==
674  static_cast<const SvxAdjustItem *>(pAdjItem)->GetAdjust()) )
675  {
676  // Export paragraphs without a lower spacing as DT
677  nNewDefListLvl = 1;
678  bDT = true;
679  rInfo.bParaPossible = false;
680  rHWrt.m_bNoAlign = true;
681  }
682  }
683 
684  if( nNewDefListLvl != rHWrt.m_nDefListLvl )
685  rHWrt.OutAndSetDefList( nNewDefListLvl );
686 
687  // if necessary, start a bulleted or numbered list
688  if( rInfo.bInNumBulList )
689  {
690  OSL_ENSURE( !rHWrt.m_nDefListLvl, "DL cannot be inside OL!" );
691  OutHTML_NumBulListStart( rHWrt, aNumInfo );
692 
693  if( bNumbered )
694  {
695  if( !rHWrt.m_aBulletGrfs[nBulletGrfLvl].isEmpty() )
696  bNumbered = false;
697  else
698  nBulletGrfLvl = 255;
699  }
700  }
701 
702  // Take the defaults of the style, because they don't need to be
703  // exported
704  rHWrt.m_nDfltLeftMargin = pFormatInfo->nLeftMargin;
705  rHWrt.m_nDfltRightMargin = pFormatInfo->nRightMargin;
706  rHWrt.m_nDfltFirstLineIndent = pFormatInfo->nFirstLineIndent;
707 
708  if( rInfo.bInNumBulList )
709  {
710  if( !rHWrt.IsHTMLMode( HTMLMODE_LSPACE_IN_NUMBUL ) )
711  rHWrt.m_nDfltLeftMargin = rLRSpace.GetTextLeft();
712 
713  // In numbered lists, don't output a first line indent.
714  rHWrt.m_nFirstLineIndent = rLRSpace.GetTextFirstLineOfst();
715  }
716 
717  if( rInfo.bInNumBulList && bNumbered && bPara && !rHWrt.m_bCfgOutStyles )
718  {
719  // a single LI doesn't have spacing
720  rHWrt.m_nDfltTopMargin = 0;
721  rHWrt.m_nDfltBottomMargin = 0;
722  }
723  else if( rHWrt.m_nDefListLvl && bPara )
724  {
725  // a single DD doesn't have spacing, as well
726  rHWrt.m_nDfltTopMargin = 0;
727  rHWrt.m_nDfltBottomMargin = 0;
728  }
729  else
730  {
731  rHWrt.m_nDfltTopMargin = pFormatInfo->nTopMargin;
732  // if in the last paragraph of a table the lower paragraph spacing
733  // is changed, Netscape doesn't get it. That's why we don't
734  // export anything here for now, by setting this spacing to the
735  // default value.
736  if( rHWrt.m_bCfgNetscape4 && !bUseParSpace )
737  rHWrt.m_nDfltBottomMargin = rULSpace.GetLower();
738  else
739  rHWrt.m_nDfltBottomMargin = pFormatInfo->nBottomMargin;
740  }
741 
742  if( rHWrt.m_nDefListLvl )
743  {
744  rHWrt.m_nLeftMargin =
745  (rHWrt.m_nDefListLvl-1) * rHWrt.m_nDefListMargin;
746  }
747 
748  if( rHWrt.m_bLFPossible && !rHWrt.m_bFirstLine )
749  rHWrt.OutNewLine(); // paragraph tag on a new line
750  rInfo.bOutPara = false;
751 
752  // this is now our new token
753  rHWrt.ChangeParaToken( nToken );
754 
755  bool bHasParSpace = bUseParSpace && rULSpace.GetLower() > 0;
756 
757  // if necessary, start a new list item
758  if( rInfo.bInNumBulList && bNumbered )
759  {
760  HtmlWriter html(rWrt.Strm(), rHWrt.maNamespace);
762  if( USHRT_MAX != nNumStart )
763  html.attribute(OOO_STRING_SVTOOLS_HTML_O_value, OString::number(nNumStart));
764  if (rHWrt.mbXHTML)
765  {
766  rWrt.Strm().WriteCharPtr(">");
767  rInfo.bOutLi = true;
768  }
769  else
770  // Finish the opening element, but don't close it.
771  html.characters(OString());
772  }
773 
774  if( rHWrt.m_nDefListLvl > 0 && !bForceDL )
775  {
777  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHWrt.GetNamespace() + aTag );
778  }
779 
780  if( pAdjItem &&
781  rHWrt.IsHTMLMode( HTMLMODE_NO_CONTROL_CENTERING ) &&
782  rHWrt.HasControls() )
783  {
784  // The align=... attribute does behave strange in netscape
785  // if there are controls in a paragraph, because the control and
786  // all text behind the control does not recognize this attribute.
787  OString sOut = "<" OOO_STRING_SVTOOLS_HTML_division;
788  rWrt.Strm().WriteOString( sOut );
789 
790  rHWrt.m_bTextAttr = false;
791  rHWrt.m_bOutOpts = true;
792  OutHTML_SvxAdjust( rWrt, *pAdjItem );
793  rWrt.Strm().WriteChar( '>' );
794  pAdjItem = nullptr;
795  rHWrt.m_bNoAlign = false;
796  rInfo.bOutDiv = true;
797  rHWrt.IncIndentLevel();
798  rHWrt.m_bLFPossible = true;
799  rHWrt.OutNewLine();
800  }
801 
802  // for BLOCKQUOTE, ADDRESS and DD we output another paragrah token, if
803  // - no styles are written and
804  // - a lower spacing or a paragraph alignment exists
805  OString aToken = rInfo.aToken;
806  if( !rHWrt.m_bCfgOutStyles && rInfo.bParaPossible && !bPara &&
807  (bHasParSpace || pAdjItem) )
808  {
809  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHWrt.GetNamespace() + rInfo.aToken );
811  bPara = true;
812  rHWrt.m_bNoAlign = false;
813  }
814 
815  LanguageType eLang;
816  if (rInfo.pItemSet)
817  eLang = static_cast<const SvxLanguageItem&>(rInfo.pItemSet->Get(SwHTMLWriter::GetLangWhichIdFromScript(rHWrt.m_nCSS1Script))).GetLanguage();
818  else
819  eLang = rHWrt.m_eLang;
820 
821  if( rInfo.pItemSet )
822  {
823  static const sal_uInt16 aWhichIds[3] = { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE };
824 
825  for(sal_uInt16 i : aWhichIds)
826  {
827  // export language if it differs from the default language only.
828  const SfxPoolItem *pTmpItem;
829  if( SfxItemState::SET == rInfo.pItemSet->GetItemState( i,
830  true, &pTmpItem ) &&
831  static_cast<const SvxLanguageItem *>(pTmpItem)->GetLanguage() == eLang )
832  rInfo.pItemSet->ClearItem( i );
833  }
834  }
835 
836  // and the text direction
837  SvxFrameDirection nDir = rHWrt.GetHTMLDirection(
838  (pNodeItemSet ? pNodeItemSet->Get( RES_FRAMEDIR )
839  : rFormat.GetFrameDir() ).GetValue() );
840 
841  // We only write a <P>, if
842  // - we are not inside OL/UL/DL, or
843  // - the paragraph of an OL/UL is not numbered or
844  // - styles are not exported and
845  // - a lower spacing, or
846  // - a paragraph alignment exists, or
847  // - styles are exported and
848  // - the text body style was changed, or
849  // - a user format is exported, or
850  // - a paragraph attribute exists
851  if( !bPara ||
852  (!rInfo.bInNumBulList && !rHWrt.m_nDefListLvl) ||
853  (rInfo.bInNumBulList && !bNumbered) ||
854  (!rHWrt.m_bCfgOutStyles &&
855  (bHasParSpace || pAdjItem ||
856  (eLang != LANGUAGE_DONTKNOW && eLang != rHWrt.m_eLang))) ||
857  nDir != rHWrt.m_nDirection ||
858  rHWrt.m_bCfgOutStyles )
859  {
860  // now, options are output
861  rHWrt.m_bTextAttr = false;
862  rHWrt.m_bOutOpts = true;
863 
864  OString sOut = "<" + rHWrt.GetNamespace() + aToken;
865 
866  if( eLang != LANGUAGE_DONTKNOW && eLang != rHWrt.m_eLang )
867  {
868  rWrt.Strm().WriteOString( sOut );
869  sOut = "";
870  rHWrt.OutLanguage( eLang );
871  }
872 
873  if( nDir != rHWrt.m_nDirection )
874  {
875  if( !sOut.isEmpty() )
876  {
877  rWrt.Strm().WriteOString( sOut );
878  sOut = "";
879  }
880  rHWrt.OutDirection( nDir );
881  }
882 
883  if( rHWrt.m_bCfgOutStyles &&
884  (!pFormatInfo->aClass.isEmpty() || pFormatInfo->bScriptDependent) )
885  {
886  sOut += " " OOO_STRING_SVTOOLS_HTML_O_class "=\"";
887  rWrt.Strm().WriteOString( sOut );
888  sOut = "";
889  OUString aClass( pFormatInfo->aClass );
890  if( pFormatInfo->bScriptDependent )
891  {
892  if( !aClass.isEmpty() )
893  aClass += "-";
894  switch( rHWrt.m_nCSS1Script )
895  {
897  aClass += "western";
898  break;
899  case CSS1_OUTMODE_CJK:
900  aClass += "cjk";
901  break;
902  case CSS1_OUTMODE_CTL:
903  aClass += "ctl";
904  break;
905  }
906  }
907  HTMLOutFuncs::Out_String( rWrt.Strm(), aClass,
908  rHWrt.m_eDestEnc, &rHWrt.m_aNonConvertableCharacters );
909  sOut += "\"";
910  }
911  rWrt.Strm().WriteOString( sOut );
912  sOut = "";
913 
914  // if necessary, output alignment
915  if( !rHWrt.m_bNoAlign && pAdjItem )
916  OutHTML_SvxAdjust( rWrt, *pAdjItem );
917 
918  rHWrt.m_bParaDotLeaders = bPara && rHWrt.m_bCfgPrintLayout && rHWrt.indexOfDotLeaders(
919  pTextNd->GetAnyFormatColl().GetPoolFormatId(), pTextNd->GetText()) > -1;
920 
921  // and now, if necessary, the STYLE options
922  if (rHWrt.m_bCfgOutStyles && rInfo.pItemSet)
923  {
924  OutCSS1_ParaTagStyleOpt( rWrt, *rInfo.pItemSet );
925  }
926 
927  if (rHWrt.m_bParaDotLeaders) {
928  sOut += " " OOO_STRING_SVTOOLS_HTML_O_class "=\""
929  sCSS2_P_CLASS_leaders "\"><"
931  rWrt.Strm().WriteOString( sOut );
932  sOut = "";
933  }
934 
935  rWrt.Strm().WriteChar( '>' );
936 
937  // is a </P> supposed to be written?
938  rInfo.bOutPara =
939  bPara &&
940  ( rHWrt.m_bCfgOutStyles || bHasParSpace );
941 
942  // if no end tag is supposed to be written, delete it
943  if( bNoEndTag )
944  rInfo.aToken.clear();
945  }
946 
947  if( nBulletGrfLvl != 255 )
948  {
949  OSL_ENSURE( aNumInfo.GetNumRule(), "Where is the numbering gone???" );
950  OSL_ENSURE( nBulletGrfLvl < MAXLEVEL, "There are not this many layers." );
951  const SwNumFormat& rNumFormat = aNumInfo.GetNumRule()->Get(nBulletGrfLvl);
953  rHWrt.m_aBulletGrfs[nBulletGrfLvl]);
954  }
955 
956  rHWrt.GetNumInfo() = aNumInfo;
957 
958  // reset the defaults
959  rHWrt.m_nDfltLeftMargin = 0;
960  rHWrt.m_nDfltRightMargin = 0;
961  rHWrt.m_nDfltFirstLineIndent = 0;
962  rHWrt.m_nDfltTopMargin = 0;
963  rHWrt.m_nDfltBottomMargin = 0;
964  rHWrt.m_nLeftMargin = 0;
965  rHWrt.m_nFirstLineIndent = 0;
966 }
967 
968 static void OutHTML_SwFormatOff( Writer& rWrt, const SwHTMLTextCollOutputInfo& rInfo )
969 {
970  SwHTMLWriter & rHWrt = static_cast<SwHTMLWriter&>(rWrt);
971 
972  // if there is no token, we don't need to output anything
973  if( rInfo.aToken.isEmpty() )
974  {
975  rHWrt.FillNextNumInfo();
976  const SwHTMLNumRuleInfo& rNextInfo = *rHWrt.GetNextNumInfo();
977  // a bulleted list must be closed in PRE as well
978  if( rInfo.bInNumBulList )
979  {
980 
981  const SwHTMLNumRuleInfo& rNRInfo = rHWrt.GetNumInfo();
982  if( rNextInfo.GetNumRule() != rNRInfo.GetNumRule() ||
983  rNextInfo.GetDepth() != rNRInfo.GetDepth() ||
984  rNextInfo.IsNumbered() || rNextInfo.IsRestart() )
985  rHWrt.ChangeParaToken( HtmlTokenId::NONE );
986  OutHTML_NumBulListEnd( rHWrt, rNextInfo );
987  }
988  else if( rNextInfo.GetNumRule() != nullptr )
989  rHWrt.ChangeParaToken( HtmlTokenId::NONE );
990 
991  return;
992  }
993 
994  if( rInfo.ShouldOutputToken() )
995  {
996  if( rHWrt.m_bLFPossible )
997  rHWrt.OutNewLine( true );
998 
999  // if necessary, for BLOCKQUOTE, ADDRESS and DD another paragraph token
1000  // is output, if
1001  // - no styles are written and
1002  // - a lower spacing exists
1003  if( rInfo.bParaPossible && rInfo.bOutPara )
1005 
1006  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHWrt.GetNamespace() + rInfo.aToken, false );
1007  rHWrt.m_bLFPossible =
1011  }
1012  if( rInfo.bOutDiv )
1013  {
1014  rHWrt.DecIndentLevel();
1015  if( rHWrt.m_bLFPossible )
1016  rHWrt.OutNewLine();
1018  rHWrt.m_bLFPossible = true;
1019  }
1020 
1021  if (rInfo.bOutLi)
1023  false);
1024 
1025  // if necessary, close a bulleted or numbered list
1026  if( rInfo.bInNumBulList )
1027  {
1028  rHWrt.FillNextNumInfo();
1029  OutHTML_NumBulListEnd( rHWrt, *rHWrt.GetNextNumInfo() );
1030  }
1031 }
1032 
1034 {
1035  sal_Int32 nStart;
1036  sal_Int32 nEnd;
1037  std::unique_ptr<SfxPoolItem> pItem;
1038 
1039 public:
1040 
1041  HTMLStartEndPos( const SfxPoolItem& rItem, sal_Int32 nStt, sal_Int32 nE );
1042 
1043  const SfxPoolItem *GetItem() const { return pItem.get(); }
1044 
1045  void SetStart( sal_Int32 nStt ) { nStart = nStt; }
1046  sal_Int32 GetStart() const { return nStart; }
1047 
1048  sal_Int32 GetEnd() const { return nEnd; }
1049  void SetEnd( sal_Int32 nE ) { nEnd = nE; }
1050 };
1051 
1052 HTMLStartEndPos::HTMLStartEndPos( const SfxPoolItem& rItem, sal_Int32 nStt,
1053  sal_Int32 nE ) :
1054  nStart( nStt ),
1055  nEnd( nE ),
1056  pItem( rItem.Clone() )
1057 {}
1058 
1059 typedef std::vector<HTMLStartEndPos *> HTMLStartEndPositions;
1060 
1061 enum HTMLOnOffState { HTML_NOT_SUPPORTED, // unsupported Attribute
1062  HTML_REAL_VALUE, // Attribute with value
1063  HTML_ON_VALUE, // Attribute is On-Tag
1064  HTML_OFF_VALUE, // Attribute is Off-Tag
1065  HTML_CHRFMT_VALUE, // Attribute for character format
1066  HTML_COLOR_VALUE, // Attribute for foreground color
1067  HTML_STYLE_VALUE, // Attribute must be exported as style
1068  HTML_DROPCAP_VALUE, // DropCap-Attribute
1069  HTML_AUTOFMT_VALUE }; // Attribute for automatic character styles
1070 
1072 {
1073  HTMLStartEndPositions aStartLst; // list, sorted for start positions
1074  HTMLStartEndPositions aEndLst; // list, sorted for end positions
1075  std::deque<sal_Int32> aScriptChgLst; // positions where script changes
1076  // 0 is not contained in this list,
1077  // but the text length
1078  // the script that is valid up to the position
1079  // contained in aScriptChgList at the same index
1080  std::vector<sal_uInt16> aScriptLst;
1081 
1082  SwDoc *pDoc; // the current document
1083  SwDoc* const pTemplate; // the HTML template (or 0)
1084  boost::optional<Color> xDfltColor;// the default foreground colors
1085  std::set<OUString>& rScriptTextStyles;
1086 
1088  bool bOutStyles : 1; // are styles exported
1089 
1090  // Insert/remove a SttEndPos in/from the Start and End lists.
1091  // The end position is known.
1092  void InsertItem_( HTMLStartEndPos *pPos, HTMLStartEndPositions::size_type nEndPos );
1093  void RemoveItem_( HTMLStartEndPositions::size_type nEndPos );
1094 
1095  // determine the 'type' of the attribute
1097 
1098  // does a specific OnTag item exist
1099  bool ExistsOnTagItem( sal_uInt16 nWhich, sal_Int32 nPos );
1100 
1101  // does an item exist that can be used to disable an attribute that
1102  // is exported the same way as the supplied item in the same range?
1103  bool ExistsOffTagItem( sal_uInt16 nWhich, sal_Int32 nStartPos,
1104  sal_Int32 nEndPos );
1105 
1106  // adapt the end of a splitted item
1107  void FixSplittedItem( HTMLStartEndPos *pPos, sal_Int32 nNewEnd,
1108  HTMLStartEndPositions::size_type nStartPos );
1109 
1110  // insert an attribute in the lists and, if necessary, split it
1111  void InsertItem( const SfxPoolItem& rItem, sal_Int32 nStart,
1112  sal_Int32 nEnd );
1113 
1114  // split an already existing attribute
1115  void SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart,
1116  sal_Int32 nEnd );
1117 
1118  // Insert without taking care of script
1119  void InsertNoScript( const SfxPoolItem& rItem, sal_Int32 nStart,
1120  sal_Int32 nEnd, SwHTMLFormatInfos& rFormatInfos,
1121  bool bParaAttrs );
1122 
1123  const SwHTMLFormatInfo *GetFormatInfo( const SwFormat& rFormat,
1124  SwHTMLFormatInfos& rFormatInfos );
1125 
1126 public:
1127 
1128  HTMLEndPosLst( SwDoc *pDoc, SwDoc* pTemplate, boost::optional<Color> xDfltColor,
1129  bool bOutStyles, sal_uLong nHTMLMode,
1130  const OUString& rText, std::set<OUString>& rStyles );
1131  ~HTMLEndPosLst();
1132 
1133  // insert an attribute
1134  void Insert( const SfxPoolItem& rItem, sal_Int32 nStart, sal_Int32 nEnd,
1135  SwHTMLFormatInfos& rFormatInfos, bool bParaAttrs=false );
1136  void Insert( const SfxItemSet& rItemSet, sal_Int32 nStart, sal_Int32 nEnd,
1137  SwHTMLFormatInfos& rFormatInfos, bool bDeep,
1138  bool bParaAttrs=false );
1139  void Insert( const SwDrawFrameFormat& rFormat, sal_Int32 nPos,
1140  SwHTMLFormatInfos& rFormatInfos );
1141 
1142  sal_uInt16 GetScriptAtPos( sal_Int32 nPos,
1143  sal_uInt16 nWeak );
1144 
1145  void OutStartAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos,
1146  HTMLOutContext *pContext = nullptr );
1147  void OutEndAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos,
1148  HTMLOutContext *pContext );
1149 
1150  bool IsHTMLMode( sal_uLong nMode ) const { return (nHTMLMode & nMode) != 0; }
1151 };
1152 
1153 void HTMLEndPosLst::InsertItem_( HTMLStartEndPos *pPos, HTMLStartEndPositions::size_type nEndPos )
1154 {
1155  // Insert the attribute in the Start list behind all attributes that
1156  // were started before, or at the same position.
1157  sal_Int32 nStart = pPos->GetStart();
1158  HTMLStartEndPositions::size_type i {0};
1159 
1160  while( i < aStartLst.size() && aStartLst[i]->GetStart() <= nStart )
1161  ++i;
1162  aStartLst.insert( aStartLst.begin() + i, pPos );
1163 
1164  // the position in the End list was supplied
1165  aEndLst.insert( aEndLst.begin() + nEndPos, pPos );
1166 }
1167 
1168 void HTMLEndPosLst::RemoveItem_( HTMLStartEndPositions::size_type nEndPos )
1169 {
1170  HTMLStartEndPos *pPos = aEndLst[nEndPos];
1171 
1172  // now, we are looking for it in the Start list
1173  HTMLStartEndPositions::iterator it =
1174  std::find(aStartLst.begin(), aStartLst.end(), pPos );
1175  OSL_ENSURE(it != aStartLst.end(), "Item not found in Start List!");
1176  if( it != aStartLst.end() )
1177  aStartLst.erase( it );
1178 
1179  aEndLst.erase( aEndLst.begin() + nEndPos );
1180 
1181  delete pPos;
1182 }
1183 
1185 {
1187  switch( rItem.Which() )
1188  {
1189  case RES_CHRATR_POSTURE:
1192  switch( static_cast<const SvxPostureItem&>(rItem).GetPosture() )
1193  {
1194  case ITALIC_NORMAL:
1195  eState = HTML_ON_VALUE;
1196  break;
1197  case ITALIC_NONE:
1198  eState = HTML_OFF_VALUE;
1199  break;
1200  default:
1202  eState = HTML_STYLE_VALUE;
1203  break;
1204  }
1205  break;
1206 
1207  case RES_CHRATR_CROSSEDOUT:
1208  switch( static_cast<const SvxCrossedOutItem&>(rItem).GetStrikeout() )
1209  {
1210  case STRIKEOUT_SINGLE:
1211  case STRIKEOUT_DOUBLE:
1212  eState = HTML_ON_VALUE;
1213  break;
1214  case STRIKEOUT_NONE:
1215  eState = HTML_OFF_VALUE;
1216  break;
1217  default:
1218  ;
1219  }
1220  break;
1221 
1222  case RES_CHRATR_ESCAPEMENT:
1223  switch( static_cast<SvxEscapement>(static_cast<const SvxEscapementItem&>(rItem).GetEnumValue()) )
1224  {
1225  case SvxEscapement::Superscript:
1226  case SvxEscapement::Subscript:
1227  eState = HTML_ON_VALUE;
1228  break;
1229  case SvxEscapement::Off:
1230  eState = HTML_OFF_VALUE;
1231  break;
1232  default:
1233  ;
1234  }
1235  break;
1236 
1237  case RES_CHRATR_UNDERLINE:
1238  switch( static_cast<const SvxUnderlineItem&>(rItem).GetLineStyle() )
1239  {
1240  case LINESTYLE_SINGLE:
1241  eState = HTML_ON_VALUE;
1242  break;
1243  case LINESTYLE_NONE:
1244  eState = HTML_OFF_VALUE;
1245  break;
1246  default:
1248  eState = HTML_STYLE_VALUE;
1249  break;
1250  }
1251  break;
1252 
1253  case RES_CHRATR_OVERLINE:
1254  case RES_CHRATR_HIDDEN:
1256  eState = HTML_STYLE_VALUE;
1257  break;
1258 
1259  case RES_CHRATR_WEIGHT:
1260  case RES_CHRATR_CJK_WEIGHT:
1261  case RES_CHRATR_CTL_WEIGHT:
1262  switch( static_cast<const SvxWeightItem&>(rItem).GetWeight() )
1263  {
1264  case WEIGHT_BOLD:
1265  eState = HTML_ON_VALUE;
1266  break;
1267  case WEIGHT_NORMAL:
1268  eState = HTML_OFF_VALUE;
1269  break;
1270  default:
1272  eState = HTML_STYLE_VALUE;
1273  break;
1274  }
1275  break;
1276 
1277  case RES_CHRATR_BLINK:
1278  eState = static_cast<const SvxBlinkItem&>(rItem).GetValue() ? HTML_ON_VALUE
1279  : HTML_OFF_VALUE;
1280  break;
1281 
1282  case RES_CHRATR_COLOR:
1283  eState = HTML_COLOR_VALUE;
1284  break;
1285 
1286  case RES_CHRATR_FONT:
1287  case RES_CHRATR_FONTSIZE:
1288  case RES_CHRATR_LANGUAGE:
1289  case RES_CHRATR_CJK_FONT:
1292  case RES_CHRATR_CTL_FONT:
1295  case RES_TXTATR_INETFMT:
1296  eState = HTML_REAL_VALUE;
1297  break;
1298 
1299  case RES_TXTATR_CHARFMT:
1300  eState = HTML_CHRFMT_VALUE;
1301  break;
1302 
1303  case RES_TXTATR_AUTOFMT:
1304  eState = HTML_AUTOFMT_VALUE;
1305  break;
1306 
1307  case RES_CHRATR_CASEMAP:
1308  eState = HTML_STYLE_VALUE;
1309  break;
1310 
1311  case RES_CHRATR_KERNING:
1312  eState = HTML_STYLE_VALUE;
1313  break;
1314 
1315  case RES_CHRATR_BACKGROUND:
1317  eState = HTML_STYLE_VALUE;
1318  break;
1319 
1320  case RES_PARATR_DROP:
1321  eState = HTML_DROPCAP_VALUE;
1322  break;
1323 
1324  case RES_CHRATR_BOX:
1326  eState = HTML_STYLE_VALUE;
1327  break;
1328  }
1329 
1330  return eState;
1331 }
1332 
1333 bool HTMLEndPosLst::ExistsOnTagItem( sal_uInt16 nWhich, sal_Int32 nPos )
1334 {
1335  for( auto pTest : aStartLst )
1336  {
1337  if( pTest->GetStart() > nPos )
1338  {
1339  // this attribute, and all attributes that follow, start later
1340  break;
1341  }
1342  else if( pTest->GetEnd() > nPos )
1343  {
1344  // the attribute starts before, or at, the current position and
1345  // ends after it
1346  const SfxPoolItem *pItem = pTest->GetItem();
1347  if( pItem->Which() == nWhich &&
1348  HTML_ON_VALUE == GetHTMLItemState(*pItem) )
1349  {
1350  // an OnTag attribute was found
1351  return true;
1352  }
1353  }
1354  }
1355 
1356  return false;
1357 }
1358 
1359 bool HTMLEndPosLst::ExistsOffTagItem( sal_uInt16 nWhich, sal_Int32 nStartPos,
1360  sal_Int32 nEndPos )
1361 {
1362  if( nWhich != RES_CHRATR_CROSSEDOUT &&
1363  nWhich != RES_CHRATR_UNDERLINE &&
1364  nWhich != RES_CHRATR_BLINK )
1365  {
1366  return false;
1367  }
1368 
1369  for( auto pTest : aStartLst )
1370  {
1371  if( pTest->GetStart() > nStartPos )
1372  {
1373  // this attribute, and all attributes that follow, start later
1374  break;
1375  }
1376  else if( pTest->GetStart()==nStartPos &&
1377  pTest->GetEnd()==nEndPos )
1378  {
1379  // the attribute starts before or at the current position and
1380  // ends after it
1381  const SfxPoolItem *pItem = pTest->GetItem();
1382  sal_uInt16 nTstWhich = pItem->Which();
1383  if( (nTstWhich == RES_CHRATR_CROSSEDOUT ||
1384  nTstWhich == RES_CHRATR_UNDERLINE ||
1385  nTstWhich == RES_CHRATR_BLINK) &&
1386  HTML_OFF_VALUE == GetHTMLItemState(*pItem) )
1387  {
1388  // an OffTag attribute was found that is exported the same
1389  // way as the current item
1390  return true;
1391  }
1392  }
1393  }
1394 
1395  return false;
1396 }
1397 
1398 void HTMLEndPosLst::FixSplittedItem( HTMLStartEndPos *pPos, sal_Int32 nNewEnd,
1399  HTMLStartEndPositions::size_type nStartPos )
1400 {
1401  // fix the end position accordingly
1402  pPos->SetEnd( nNewEnd );
1403 
1404  // remove the item from the End list
1405  HTMLStartEndPositions::iterator it =
1406  std::find(aEndLst.begin(), aEndLst.end(), pPos );
1407  OSL_ENSURE(it != aEndLst.end(), "Item not found in End List!" );
1408  if( it != aEndLst.end() )
1409  aEndLst.erase( it );
1410 
1411  // from now on, it is closed as the last one at the corresponding position
1412  HTMLStartEndPositions::size_type nEndPos {0};
1413  while( nEndPos < aEndLst.size() && aEndLst[nEndPos]->GetEnd() <= nNewEnd )
1414  ++nEndPos;
1415  aEndLst.insert( aEndLst.begin() + nEndPos, pPos );
1416 
1417  // now, adjust the attributes that got started afterwards
1418  for( HTMLStartEndPositions::size_type i = nStartPos+1; i<aStartLst.size(); ++i )
1419  {
1420  HTMLStartEndPos *pTest = aStartLst[i];
1421  sal_Int32 nTestEnd = pTest->GetEnd();
1422  if( pTest->GetStart() >= nNewEnd )
1423  {
1424  // the Test attribute and all the following ones start, after the
1425  // splitted attribute ends
1426  break;
1427  }
1428  else if( nTestEnd > nNewEnd )
1429  {
1430  // the Test attribute starts before the splitted attribute
1431  // ends, and ends afterwards, i.e., it must be splitted, as well
1432 
1433  // set the new end
1434  pTest->SetEnd( nNewEnd );
1435 
1436  // remove the attribute from the End list
1437  it = std::find(aEndLst.begin(), aEndLst.end(), pTest );
1438  OSL_ENSURE(it != aEndLst.end(), "Item not found in End List!" );
1439  if( it != aEndLst.end() )
1440  aEndLst.erase( it );
1441 
1442  // it now ends as the first attribute in the respective position.
1443  // We already know this position in the End list.
1444  aEndLst.insert( aEndLst.begin() + nEndPos, pTest );
1445 
1446  // insert the 'rest' of the attribute
1447  InsertItem( *pTest->GetItem(), nNewEnd, nTestEnd );
1448  }
1449  }
1450 }
1451 
1452 void HTMLEndPosLst::InsertItem( const SfxPoolItem& rItem, sal_Int32 nStart,
1453  sal_Int32 nEnd )
1454 {
1455  HTMLStartEndPositions::size_type i;
1456  for( i = 0; i < aEndLst.size(); i++ )
1457  {
1458  HTMLStartEndPos *pTest = aEndLst[i];
1459  sal_Int32 nTestEnd = pTest->GetEnd();
1460  if( nTestEnd <= nStart )
1461  {
1462  // the Test attribute ends, before the new one starts
1463  continue;
1464  }
1465  else if( nTestEnd < nEnd )
1466  {
1467  if( pTest->GetStart() < nStart )
1468  {
1469  // the Test attribute ends, before the new one ends. Thus, the
1470  // new attribute must be splitted.
1471  InsertItem_( new HTMLStartEndPos( rItem, nStart, nTestEnd ), i );
1472  nStart = nTestEnd;
1473  }
1474  }
1475  else
1476  {
1477  // the Test attribute (and all that follow) ends, before the new
1478  // one ends
1479  break;
1480  }
1481  }
1482 
1483  // one attribute must still be inserted
1484  InsertItem_( new HTMLStartEndPos( rItem, nStart, nEnd ), i );
1485 }
1486 
1487 void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart,
1488  sal_Int32 nEnd )
1489 {
1490  sal_uInt16 nWhich = rItem.Which();
1491 
1492  // first, we must search for the old items by using the start list and
1493  // determine the new item range
1494 
1495  for( HTMLStartEndPositions::size_type i=0; i<aStartLst.size(); ++i )
1496  {
1497  HTMLStartEndPos *pTest = aStartLst[i];
1498  sal_Int32 nTestStart = pTest->GetStart();
1499  sal_Int32 nTestEnd = pTest->GetEnd();
1500 
1501  if( nTestStart >= nEnd )
1502  {
1503  // this attribute, and all that follow, start later
1504  break;
1505  }
1506  else if( nTestEnd > nStart )
1507  {
1508  // the Test attribute ends in the range that must be deleted
1509  const SfxPoolItem *pItem = pTest->GetItem();
1510 
1511  // only the corresponding OnTag attributes have to be considered
1512  if( pItem->Which() == nWhich &&
1513  HTML_ON_VALUE == GetHTMLItemState( *pItem ) )
1514  {
1515  bool bDelete = true;
1516 
1517  if( nTestStart < nStart )
1518  {
1519  // the start of the new attribute corresponds to the new
1520  // end of the attribute
1521  FixSplittedItem( pTest, nStart, i );
1522  bDelete = false;
1523  }
1524  else
1525  {
1526  // the Test item only starts after the new end of the
1527  // attribute. Therefore, it can be completely erased.
1528  aStartLst.erase( aStartLst.begin() + i );
1529  i--;
1530 
1531  HTMLStartEndPositions::iterator it =
1532  std::find(aEndLst.begin(), aEndLst.end(), pTest );
1533  OSL_ENSURE(it != aEndLst.end(), "Item not found in End List!" );
1534  if( it != aEndLst.end() )
1535  aEndLst.erase( it );
1536  }
1537 
1538  // if necessary, insert the second part of the splitted
1539  // attribute
1540  if( nTestEnd > nEnd )
1541  {
1542  InsertItem( *pTest->GetItem(), nEnd, nTestEnd );
1543  }
1544 
1545  if( bDelete )
1546  delete pTest;
1547  }
1548  }
1549  }
1550 }
1551 
1553  SwHTMLFormatInfos& rFormatInfos )
1554 {
1555  SwHTMLFormatInfo *pFormatInfo;
1556  std::unique_ptr<SwHTMLFormatInfo> pTmpInfo(new SwHTMLFormatInfo(&rFormat));
1557  SwHTMLFormatInfos::iterator it = rFormatInfos.find( pTmpInfo );
1558  if (it != rFormatInfos.end())
1559  {
1560  pFormatInfo = it->get();
1561  }
1562  else
1563  {
1564  pFormatInfo = new SwHTMLFormatInfo( &rFormat, pDoc, pTemplate,
1565  bOutStyles );
1566  rFormatInfos.insert(std::unique_ptr<SwHTMLFormatInfo>(pFormatInfo));
1567  if ( rScriptTextStyles.count( rFormat.GetName() ) )
1568  pFormatInfo->bScriptDependent = true;
1569  }
1570 
1571  return pFormatInfo;
1572 }
1573 
1575  bool bStyles, sal_uLong nMode, const OUString& rText,
1576  std::set<OUString>& rStyles)
1577  : pDoc(pD)
1578  , pTemplate(pTempl)
1579  , xDfltColor(std::move(xDfltCol))
1580  , rScriptTextStyles(rStyles)
1581  , nHTMLMode(nMode)
1582  , bOutStyles(bStyles)
1583 {
1584  sal_Int32 nEndPos = rText.getLength();
1585  sal_Int32 nPos = 0;
1586  while( nPos < nEndPos )
1587  {
1588  sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType( rText, nPos );
1589  nPos = g_pBreakIt->GetBreakIter()->endOfScript( rText, nPos, nScript );
1590  aScriptChgLst.push_back( nPos );
1591  aScriptLst.push_back( nScript );
1592  }
1593 }
1594 
1596 {
1597  OSL_ENSURE(aStartLst.empty(), "Start List not empty in destructor");
1598  OSL_ENSURE(aEndLst.empty(), "End List not empty in destructor");
1599 }
1600 
1602  sal_Int32 nStart, sal_Int32 nEnd,
1603  SwHTMLFormatInfos& rFormatInfos, bool bParaAttrs )
1604 {
1605  // no range ?? in that case, don't take it, it will never take effect !!
1606  if( nStart != nEnd )
1607  {
1608  bool bSet = false, bSplit = false;
1609  switch( GetHTMLItemState(rItem) )
1610  {
1611  case HTML_ON_VALUE:
1612  // output the attribute, if it isn't 'on', already
1613  if( !ExistsOnTagItem( rItem.Which(), nStart ) )
1614  bSet = true;
1615  break;
1616 
1617  case HTML_OFF_VALUE:
1618  // If the corresponding attribute is 'on', split it.
1619  // Additionally, output it as Style, if it is not set for the
1620  // whole paragraph, because in that case it was already output
1621  // together with the paragraph tag.
1622  if( ExistsOnTagItem( rItem.Which(), nStart ) )
1623  bSplit = true;
1624  bSet = bOutStyles && !bParaAttrs &&
1625  !ExistsOffTagItem( rItem.Which(), nStart, nEnd );
1626  break;
1627 
1628  case HTML_REAL_VALUE:
1629  // we can always output the attribute
1630  bSet = true;
1631  break;
1632 
1633  case HTML_STYLE_VALUE:
1634  // We can only output the attribute as CSS1. If it is set for
1635  // the paragraph, it was already output with the paragraph tag.
1636  // The only exception is the character-background attribute. This
1637  // attribute must always be handled like a Hint.
1638  bSet = bOutStyles &&
1639  (!bParaAttrs
1640  || rItem.Which()==RES_CHRATR_BACKGROUND
1641  || rItem.Which()==RES_CHRATR_BOX
1642  || rItem.Which()==RES_CHRATR_OVERLINE);
1643  break;
1644 
1645  case HTML_CHRFMT_VALUE:
1646  {
1647  OSL_ENSURE( RES_TXTATR_CHARFMT == rItem.Which(),
1648  "Not a character style after all" );
1649  const SwFormatCharFormat& rChrFormat = static_cast<const SwFormatCharFormat&>(rItem);
1650  const SwCharFormat* pFormat = rChrFormat.GetCharFormat();
1651 
1652  const SwHTMLFormatInfo *pFormatInfo = GetFormatInfo( *pFormat, rFormatInfos );
1653  if( !pFormatInfo->aToken.isEmpty() )
1654  {
1655  // output the character style tag before the hard
1656  // attributes
1657  InsertItem( rItem, nStart, nEnd );
1658  }
1659  if( pFormatInfo->pItemSet )
1660  {
1661  Insert( *pFormatInfo->pItemSet, nStart, nEnd,
1662  rFormatInfos, true, bParaAttrs );
1663  }
1664  }
1665  break;
1666 
1667  case HTML_AUTOFMT_VALUE:
1668  {
1669  const SwFormatAutoFormat& rAutoFormat = static_cast<const SwFormatAutoFormat&>(rItem);
1670  const std::shared_ptr<SfxItemSet>& pSet = rAutoFormat.GetStyleHandle();
1671  if( pSet.get() )
1672  Insert( *pSet, nStart, nEnd, rFormatInfos, true, bParaAttrs );
1673  }
1674  break;
1675 
1676  case HTML_COLOR_VALUE:
1677  // A foreground color as a paragraph attribute is only exported if
1678  // it is not the same as the default color.
1679  {
1680  OSL_ENSURE( RES_CHRATR_COLOR == rItem.Which(),
1681  "Not a foreground color, after all" );
1682  Color aColor( static_cast<const SvxColorItem&>(rItem).GetValue() );
1683  if( COL_AUTO == aColor )
1684  aColor = COL_BLACK;
1685  bSet = !bParaAttrs || !xDfltColor ||
1686  !xDfltColor->IsRGBEqual( aColor );
1687  }
1688  break;
1689 
1690  case HTML_DROPCAP_VALUE:
1691  {
1692  OSL_ENSURE( RES_PARATR_DROP == rItem.Which(),
1693  "Not a drop cap, after all" );
1694  const SwFormatDrop& rDrop = static_cast<const SwFormatDrop&>(rItem);
1695  nEnd = nStart + rDrop.GetChars();
1696  if( !bOutStyles )
1697  {
1698  // At least use the attributes of the character style
1699  const SwCharFormat *pCharFormat = rDrop.GetCharFormat();
1700  if( pCharFormat )
1701  {
1702  Insert( pCharFormat->GetAttrSet(), nStart, nEnd,
1703  rFormatInfos, true, bParaAttrs );
1704  }
1705  }
1706  else
1707  {
1708  bSet = true;
1709  }
1710  }
1711  break;
1712  default:
1713  ;
1714  }
1715 
1716  if( bSet )
1717  InsertItem( rItem, nStart, nEnd );
1718  if( bSplit )
1719  SplitItem( rItem, nStart, nEnd );
1720  }
1721 }
1722 
1724  sal_Int32 nStart, sal_Int32 nEnd,
1725  SwHTMLFormatInfos& rFormatInfos, bool bParaAttrs )
1726 {
1727  bool bDependsOnScript = false, bDependsOnAnyScript = false;
1728  sal_uInt16 nScript = i18n::ScriptType::LATIN;
1729  switch( rItem.Which() )
1730  {
1731  case RES_CHRATR_FONT:
1732  case RES_CHRATR_FONTSIZE:
1733  case RES_CHRATR_LANGUAGE:
1734  case RES_CHRATR_POSTURE:
1735  case RES_CHRATR_WEIGHT:
1736  bDependsOnScript = true;
1737  nScript = i18n::ScriptType::LATIN;
1738  break;
1739 
1740  case RES_CHRATR_CJK_FONT:
1744  case RES_CHRATR_CJK_WEIGHT:
1745  bDependsOnScript = true;
1746  nScript = i18n::ScriptType::ASIAN;
1747  break;
1748 
1749  case RES_CHRATR_CTL_FONT:
1753  case RES_CHRATR_CTL_WEIGHT:
1754  bDependsOnScript = true;
1755  nScript = i18n::ScriptType::COMPLEX;
1756  break;
1757  case RES_TXTATR_CHARFMT:
1758  {
1759  const SwFormatCharFormat& rChrFormat = static_cast<const SwFormatCharFormat&>(rItem);
1760  const SwCharFormat* pFormat = rChrFormat.GetCharFormat();
1761  const SwHTMLFormatInfo *pFormatInfo = GetFormatInfo( *pFormat, rFormatInfos );
1762  if( pFormatInfo->bScriptDependent )
1763  {
1764  bDependsOnScript = true;
1765  bDependsOnAnyScript = true;
1766  }
1767  }
1768  break;
1769  case RES_TXTATR_INETFMT:
1770  {
1772  RES_POOLCHR_INET_NORMAL), rFormatInfos )->bScriptDependent ||
1774  RES_POOLCHR_INET_VISIT), rFormatInfos )->bScriptDependent )
1775  {
1776  bDependsOnScript = true;
1777  bDependsOnAnyScript = true;
1778  }
1779  }
1780  break;
1781  }
1782 
1783  if( bDependsOnScript )
1784  {
1785  sal_Int32 nPos = nStart;
1786  for( size_t i=0; i < aScriptChgLst.size(); i++ )
1787  {
1788  sal_Int32 nChgPos = aScriptChgLst[i];
1789  if( nPos >= nChgPos )
1790  {
1791  // the hint starts behind or at the next script change,
1792  // so we may continue with this position.
1793  continue;
1794  }
1795  if( nEnd <= nChgPos )
1796  {
1797  // the (rest of) the hint ends before or at the next script
1798  // change, so we can insert it, but only if it belongs
1799  // to the current script.
1800  if( bDependsOnAnyScript || nScript == aScriptLst[i] )
1801  InsertNoScript( rItem, nPos, nEnd, rFormatInfos,
1802  bParaAttrs );
1803  break;
1804  }
1805 
1806  // the hint starts before the next script change and ends behind
1807  // it, so we can insert a hint up to the next script change and
1808  // continue with the rest of the hint.
1809  if( bDependsOnAnyScript || nScript == aScriptLst[i] )
1810  InsertNoScript( rItem, nPos, nChgPos, rFormatInfos, bParaAttrs );
1811  nPos = nChgPos;
1812  }
1813  }
1814  else
1815  {
1816  InsertNoScript( rItem, nStart, nEnd, rFormatInfos, bParaAttrs );
1817  }
1818 }
1819 
1820 void HTMLEndPosLst::Insert( const SfxItemSet& rItemSet,
1821  sal_Int32 nStart, sal_Int32 nEnd,
1822  SwHTMLFormatInfos& rFormatInfos,
1823  bool bDeep, bool bParaAttrs )
1824 {
1825  SfxWhichIter aIter( rItemSet );
1826 
1827  sal_uInt16 nWhich = aIter.FirstWhich();
1828  while( nWhich )
1829  {
1830  const SfxPoolItem *pItem;
1831  if( SfxItemState::SET == rItemSet.GetItemState( nWhich, bDeep, &pItem ) )
1832  {
1833  Insert( *pItem, nStart, nEnd, rFormatInfos, bParaAttrs );
1834  }
1835 
1836  nWhich = aIter.NextWhich();
1837  }
1838 }
1839 
1840 void HTMLEndPosLst::Insert( const SwDrawFrameFormat& rFormat, sal_Int32 nPos,
1841  SwHTMLFormatInfos& rFormatInfos )
1842 {
1843  const SdrObject* pTextObj = SwHTMLWriter::GetMarqueeTextObj( rFormat );
1844 
1845  if( pTextObj )
1846  {
1847  // get the edit engine attributes of the object as SW attributes and
1848  // insert them as hints. Because of the amount of Hints the styles
1849  // are not considered!
1850  const SfxItemSet& rFormatItemSet = rFormat.GetAttrSet();
1851  SfxItemSet aItemSet( *rFormatItemSet.GetPool(), svl::Items<RES_CHRATR_BEGIN,
1852  RES_CHRATR_END>{} );
1853  SwHTMLWriter::GetEEAttrsFromDrwObj( aItemSet, pTextObj );
1854  bool bOutStylesOld = bOutStyles;
1855  bOutStyles = false;
1856  Insert( aItemSet, nPos, nPos+1, rFormatInfos, false );
1857  bOutStyles = bOutStylesOld;
1858  }
1859 }
1860 
1861 sal_uInt16 HTMLEndPosLst::GetScriptAtPos( sal_Int32 nPos, sal_uInt16 nWeak )
1862 {
1863  sal_uInt16 nRet = CSS1_OUTMODE_ANY_SCRIPT;
1864 
1865  size_t nScriptChgs = aScriptChgLst.size();
1866  size_t i=0;
1867  while( i < nScriptChgs && nPos >= aScriptChgLst[i] )
1868  i++;
1869  OSL_ENSURE( i < nScriptChgs, "script list is too short" );
1870  if( i < nScriptChgs )
1871  {
1872  if( i18n::ScriptType::WEAK == aScriptLst[i] )
1873  nRet = nWeak;
1874  else
1876  }
1877 
1878  return nRet;
1879 }
1880 
1881 void HTMLEndPosLst::OutStartAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos,
1882  HTMLOutContext *pContext )
1883 {
1884  rHWrt.m_bTagOn = true;
1885 
1886  // Character border attribute must be the first which is written out
1887  // because of border merge.
1888  HTMLStartEndPositions::size_type nCharBoxIndex = 0;
1889  while( nCharBoxIndex < aStartLst.size() &&
1890  aStartLst[nCharBoxIndex]->GetItem()->Which() != RES_CHRATR_BOX )
1891  {
1892  ++nCharBoxIndex;
1893  }
1894 
1895  // the attributes of the start list are sorted in ascending order
1896  for( HTMLStartEndPositions::size_type i=0; i< aStartLst.size(); ++i )
1897  {
1898  HTMLStartEndPos *pPos = nullptr;
1899  if( nCharBoxIndex < aStartLst.size() )
1900  {
1901  if( i == 0 )
1902  pPos = aStartLst[nCharBoxIndex];
1903  else if( i == nCharBoxIndex )
1904  pPos = aStartLst[0];
1905  else
1906  pPos = aStartLst[i];
1907  }
1908  else
1909  pPos = aStartLst[i];
1910 
1911  sal_Int32 nStart = pPos->GetStart();
1912  if( nStart > nPos )
1913  {
1914  // this attribute, and all that follow, will be opened later on
1915  break;
1916  }
1917  else if( nStart == nPos )
1918  {
1919  // output the attribute
1920  sal_uInt16 nCSS1Script = rHWrt.m_nCSS1Script;
1921  sal_uInt16 nWhich = pPos->GetItem()->Which();
1922  if( RES_TXTATR_CHARFMT == nWhich ||
1923  RES_TXTATR_INETFMT == nWhich ||
1924  RES_PARATR_DROP == nWhich )
1925  {
1926  rHWrt.m_nCSS1Script = GetScriptAtPos( nPos, nCSS1Script );
1927  }
1928  if( pContext )
1929  {
1930  HTMLOutFuncs::FlushToAscii( rHWrt.Strm(), *pContext );
1931  pContext = nullptr; // one time only
1932  }
1933  Out( aHTMLAttrFnTab, *pPos->GetItem(), rHWrt );
1934  rHWrt.maStartedAttributes[pPos->GetItem()->Which()]++;
1935  rHWrt.m_nCSS1Script = nCSS1Script;
1936  }
1937  }
1938 }
1939 
1940 void HTMLEndPosLst::OutEndAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos,
1941  HTMLOutContext *pContext = nullptr )
1942 {
1943  rHWrt.m_bTagOn = false;
1944 
1945  // the attributes in the End list are sorted in ascending order
1946  HTMLStartEndPositions::size_type i {0};
1947  while( i < aEndLst.size() )
1948  {
1949  HTMLStartEndPos *pPos = aEndLst[i];
1950  sal_Int32 nEnd = pPos->GetEnd();
1951 
1952  if( SAL_MAX_INT32 == nPos || nEnd == nPos )
1953  {
1954  if( pContext )
1955  {
1956  HTMLOutFuncs::FlushToAscii( rHWrt.Strm(), *pContext );
1957  pContext = nullptr; // one time only
1958  }
1959  // Skip closing span if next character span has the same border (border merge)
1960  bool bSkipOut = false;
1961  if( pPos->GetItem()->Which() == RES_CHRATR_BOX )
1962  {
1963  HTMLStartEndPositions::iterator it =
1964  std::find(aStartLst.begin(), aStartLst.end(), pPos );
1965  OSL_ENSURE(it != aStartLst.end(), "Item not found in Start List!" );
1966  if (it != aStartLst.end())
1967  ++it;
1968  while(it != aStartLst.end() )
1969  {
1970  HTMLStartEndPos *pEndPos = *it;
1971  if( pEndPos->GetItem()->Which() == RES_CHRATR_BOX &&
1972  *static_cast<const SvxBoxItem*>(pEndPos->GetItem()) ==
1973  *static_cast<const SvxBoxItem*>(pPos->GetItem()) )
1974  {
1975  pEndPos->SetStart(pPos->GetStart());
1976  bSkipOut = true;
1977  break;
1978  }
1979  ++it;
1980  }
1981  }
1982  if( !bSkipOut )
1983  {
1984  Out( aHTMLAttrFnTab, *pPos->GetItem(), rHWrt );
1985  rHWrt.maStartedAttributes[pPos->GetItem()->Which()]--;
1986  }
1987  RemoveItem_( i );
1988  }
1989  else if( nEnd > nPos )
1990  {
1991  // this attribute, and all that follow, are closed later on
1992  break;
1993  }
1994  else
1995  {
1996  // The attribute is closed before the current position. This
1997  // is not allowed, but we can handle it anyway.
1998  OSL_ENSURE( nEnd >= nPos,
1999  "The attribute should've been closed a long time ago" );
2000  i++;
2001  }
2002  }
2003 }
2004 
2005 /* Output of the nodes*/
2007 {
2008  const SwTextNode * pNd = &static_cast<const SwTextNode&>(rNode);
2009  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2010 
2011  const OUString& rStr = pNd->GetText();
2012  sal_Int32 nEnd = rStr.getLength();
2013 
2014  // special case: empty node and HR style (horizontal rule)
2015  // output a <HR>, only
2016  sal_uInt16 nPoolId = pNd->GetAnyFormatColl().GetPoolFormatId();
2017 
2018  // Handle horizontal rule <hr>
2019  if (!nEnd &&
2021  {
2022  // then, the paragraph-anchored graphics/OLE objects in the paragraph
2023  // MIB 8.7.97: We enclose the line in a <PRE>. This means that the
2024  // spacings are wrong, but otherwise we get an empty paragraph
2025  // after the <HR> which is even uglier.
2026  rHTMLWrt.ChangeParaToken( HtmlTokenId::NONE );
2027 
2028  // Output all the nodes that are anchored to a frame
2029  rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HtmlPosition::Any );
2030 
2031  if( rHTMLWrt.m_bLFPossible )
2032  rHTMLWrt.OutNewLine(); // paragraph tag on a new line
2033 
2034  rHTMLWrt.m_bLFPossible = true;
2035 
2036  HtmlWriter aHtml(rWrt.Strm(), rHTMLWrt.maNamespace);
2038 
2039  const SfxItemSet* pItemSet = pNd->GetpSwAttrSet();
2040  if( !pItemSet )
2041  {
2042  aHtml.endAttribute();
2043  return rHTMLWrt;
2044  }
2045  const SfxPoolItem* pItem;
2046  if( SfxItemState::SET == pItemSet->GetItemState( RES_LR_SPACE, false, &pItem ))
2047  {
2048  sal_Int32 nLeft = static_cast<const SvxLRSpaceItem*>(pItem)->GetLeft();
2049  sal_Int32 nRight = static_cast<const SvxLRSpaceItem*>(pItem)->GetRight();
2050  if( nLeft || nRight )
2051  {
2052  const SwFrameFormat& rPgFormat =
2054  ( RES_POOLPAGE_HTML, false )->GetMaster();
2055  const SwFormatFrameSize& rSz = rPgFormat.GetFrameSize();
2056  const SvxLRSpaceItem& rLR = rPgFormat.GetLRSpace();
2057  const SwFormatCol& rCol = rPgFormat.GetCol();
2058 
2059  long nPageWidth = rSz.GetWidth() - rLR.GetLeft() - rLR.GetRight();
2060 
2061  if( 1 < rCol.GetNumCols() )
2062  nPageWidth /= rCol.GetNumCols();
2063 
2064  const SwTableNode* pTableNd = pNd->FindTableNode();
2065  if( pTableNd )
2066  {
2067  const SwTableBox* pBox = pTableNd->GetTable().GetTableBox(
2068  pNd->StartOfSectionIndex() );
2069  if( pBox )
2070  nPageWidth = pBox->GetFrameFormat()->GetFrameSize().GetWidth();
2071  }
2072 
2073  OString sWidth = OString::number(SwHTMLWriter::ToPixel(nPageWidth - nLeft - nRight, false));
2074  aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_width, sWidth);
2075 
2076  if( !nLeft )
2078  else if( !nRight )
2080  else
2082  }
2083  }
2084 
2085  if( SfxItemState::SET == pItemSet->GetItemState( RES_BOX, false, &pItem ))
2086  {
2087  const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem);
2088  const editeng::SvxBorderLine* pBorderLine = pBoxItem->GetBottom();
2089  if( pBorderLine )
2090  {
2091  sal_uInt16 nWidth = pBorderLine->GetScaledWidth();
2092  OString sWidth = OString::number(SwHTMLWriter::ToPixel(nWidth, false));
2093  aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_size, sWidth);
2094 
2095  const Color& rBorderColor = pBorderLine->GetColor();
2096  if( !rBorderColor.IsRGBEqual( COL_GRAY ) )
2097  {
2099  }
2100 
2101  if( !pBorderLine->GetInWidth() )
2102  {
2104  }
2105  }
2106  }
2107  aHtml.end();
2108  return rHTMLWrt;
2109  }
2110 
2111  // Do not export the empty nodes with 2pt fonts and standard style that
2112  // are inserted before tables and sections, but do export bookmarks
2113  // and paragraph anchored frames.
2114  if( !nEnd && (nPoolId == RES_POOLCOLL_STANDARD ||
2115  nPoolId == RES_POOLCOLL_TABLE ||
2116  nPoolId == RES_POOLCOLL_TABLE_HDLN) )
2117  {
2118  // The current node is empty and contains the standard style ...
2119  const SfxPoolItem* pItem;
2120  const SfxItemSet* pItemSet = pNd->GetpSwAttrSet();
2121  if( pItemSet && pItemSet->Count() &&
2122  SfxItemState::SET == pItemSet->GetItemState( RES_CHRATR_FONTSIZE, false, &pItem ) &&
2123  40 == static_cast<const SvxFontHeightItem *>(pItem)->GetHeight() )
2124  {
2125  // ... moreover, the 2pt font is set ...
2126  sal_uLong nNdPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex();
2127  const SwNode *pNextNd = rWrt.m_pDoc->GetNodes()[nNdPos+1];
2128  const SwNode *pPrevNd = rWrt.m_pDoc->GetNodes()[nNdPos-1];
2129  bool bStdColl = nPoolId == RES_POOLCOLL_STANDARD;
2130  if( ( bStdColl && (pNextNd->IsTableNode() || pNextNd->IsSectionNode()) ) ||
2131  ( !bStdColl &&
2132  pNextNd->IsEndNode() &&
2133  pPrevNd->IsStartNode() &&
2135  {
2136  // ... and it is located before a table or a section
2137  rHTMLWrt.OutBookmarks();
2138  rHTMLWrt.m_bLFPossible = rHTMLWrt.m_nLastParaToken == HtmlTokenId::NONE;
2139 
2140  // Output all frames that are anchored to this node
2141  rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HtmlPosition::Any );
2142  rHTMLWrt.m_bLFPossible = false;
2143 
2144  return rWrt;
2145  }
2146  }
2147  }
2148 
2149  // catch PageBreaks and PageDescs
2150  bool bPageBreakBehind = false;
2151  if( rHTMLWrt.m_bCfgFormFeed &&
2152  !(rHTMLWrt.m_bOutTable || rHTMLWrt.m_bOutFlyFrame) &&
2153  rHTMLWrt.m_pStartNdIdx->GetIndex() != rHTMLWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() )
2154  {
2155  bool bPageBreakBefore = false;
2156  const SfxPoolItem* pItem;
2157  const SfxItemSet* pItemSet = pNd->GetpSwAttrSet();
2158 
2159  if( pItemSet )
2160  {
2161  if( SfxItemState::SET == pItemSet->GetItemState( RES_PAGEDESC, true, &pItem ) &&
2162  static_cast<const SwFormatPageDesc *>(pItem)->GetPageDesc() )
2163  {
2164  bPageBreakBefore = true;
2165  }
2166  else if( SfxItemState::SET == pItemSet->GetItemState( RES_BREAK, true, &pItem ) )
2167  {
2168  switch( static_cast<const SvxFormatBreakItem *>(pItem)->GetBreak() )
2169  {
2170  case SvxBreak::PageBefore:
2171  bPageBreakBefore = true;
2172  break;
2173  case SvxBreak::PageAfter:
2174  bPageBreakBehind = true;
2175  break;
2176  case SvxBreak::PageBoth:
2177  bPageBreakBefore = true;
2178  bPageBreakBehind = true;
2179  break;
2180  default:
2181  break;
2182  }
2183  }
2184  }
2185 
2186  if( bPageBreakBefore )
2187  rWrt.Strm().WriteChar( '\f' );
2188  }
2189 
2190  // if necessary, open a form
2191  rHTMLWrt.OutForm();
2192 
2193  // Output the page-anchored frames that are 'anchored' to this node
2194  bool bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HtmlPosition::Prefix );
2195 
2196  // Output all frames that are anchored to this node that are supposed to
2197  // be written before the paragraph tag.
2198  if( bFlysLeft )
2199  {
2200  bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HtmlPosition::Before );
2201  }
2202 
2203  if( rHTMLWrt.m_pCurrentPam->GetPoint()->nNode == rHTMLWrt.m_pCurrentPam->GetMark()->nNode )
2204  {
2205  nEnd = rHTMLWrt.m_pCurrentPam->GetMark()->nContent.GetIndex();
2206  }
2207 
2208  // are there any hard attributes that must be written as options?
2209  rHTMLWrt.m_bTagOn = true;
2210 
2211  // now, output the tag of the paragraph
2212  const SwFormat& rFormat = pNd->GetAnyFormatColl();
2213  SwHTMLTextCollOutputInfo aFormatInfo;
2214  bool bOldLFPossible = rHTMLWrt.m_bLFPossible;
2215  OutHTML_SwFormat( rWrt, rFormat, pNd->GetpSwAttrSet(), aFormatInfo );
2216 
2217  // If we didn't open a new line before the paragraph tag, we do that now
2218  rHTMLWrt.m_bLFPossible = rHTMLWrt.m_nLastParaToken == HtmlTokenId::NONE;
2219  if( !bOldLFPossible && rHTMLWrt.m_bLFPossible )
2220  rHTMLWrt.OutNewLine();
2221 
2222  // then, the bookmarks (including end tag)
2223  rHTMLWrt.m_bOutOpts = false;
2224  rHTMLWrt.OutBookmarks();
2225 
2226  // now it's a good opportunity again for an LF - if it is still allowed
2227  if( rHTMLWrt.m_bLFPossible &&
2228  rHTMLWrt.GetLineLen() >= rHTMLWrt.m_nWhishLineLen )
2229  {
2230  rHTMLWrt.OutNewLine();
2231  }
2232  rHTMLWrt.m_bLFPossible = false;
2233 
2234  // find text that originates from an outline numbering
2235  sal_Int32 nOffset = 0;
2236  OUString aOutlineText;
2237  OUString aFullText;
2238 
2239  // export numbering string as plain text only for the outline numbering,
2240  // because the outline numbering isn't exported as a numbering - see <SwHTMLNumRuleInfo::Set(..)>
2241  if ( pNd->IsOutline() &&
2242  pNd->GetNumRule() == pNd->GetDoc()->GetOutlineNumRule() )
2243  {
2244  aOutlineText = pNd->GetNumString();
2245  nOffset = nOffset + aOutlineText.getLength();
2246  aFullText = aOutlineText;
2247  }
2248  OUString aFootEndNoteSym;
2249  if( rHTMLWrt.m_pFormatFootnote )
2250  {
2251  aFootEndNoteSym = rHTMLWrt.GetFootEndNoteSym( *rHTMLWrt.m_pFormatFootnote );
2252  nOffset = nOffset + aFootEndNoteSym.getLength();
2253  aFullText += aFootEndNoteSym;
2254  }
2255 
2256  // Table of Contents or other paragraph with dot leaders?
2257  sal_Int32 nIndexTab = rHTMLWrt.indexOfDotLeaders( nPoolId, rStr );
2258  if (nIndexTab > -1)
2259  // skip part after the tabulator (page number)
2260  nEnd = nIndexTab;
2261 
2262  // are there any hard attributes that must be written as tags?
2263  aFullText += rStr;
2264  HTMLEndPosLst aEndPosLst( rWrt.m_pDoc, rHTMLWrt.m_xTemplate.get(),
2265  rHTMLWrt.m_xDfltColor, rHTMLWrt.m_bCfgOutStyles,
2266  rHTMLWrt.GetHTMLMode(), aFullText,
2267  rHTMLWrt.m_aScriptTextStyles );
2268  if( aFormatInfo.pItemSet )
2269  {
2270  aEndPosLst.Insert( *aFormatInfo.pItemSet, 0, nEnd + nOffset,
2271  rHTMLWrt.m_CharFormatInfos, false, true );
2272  }
2273 
2274  if( !aOutlineText.isEmpty() || rHTMLWrt.m_pFormatFootnote )
2275  {
2276  // output paragraph attributes, so that the text gets the attributes of
2277  // the paragraph.
2278  aEndPosLst.OutStartAttrs( rHTMLWrt, 0 );
2279 
2280  // Theoretically, we would have to consider the character style of
2281  // the numbering. Because it cannot be set via the UI, let's ignore
2282  // it for now.
2283 
2284  if( !aOutlineText.isEmpty() )
2285  HTMLOutFuncs::Out_String( rWrt.Strm(), aOutlineText,
2286  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters);
2287 
2288  if( rHTMLWrt.m_pFormatFootnote )
2289  {
2290  rHTMLWrt.OutFootEndNoteSym( *rHTMLWrt.m_pFormatFootnote, aFootEndNoteSym,
2291  aEndPosLst.GetScriptAtPos( aOutlineText.getLength(), rHTMLWrt.m_nCSS1Script ) );
2292  rHTMLWrt.m_pFormatFootnote = nullptr;
2293  }
2294  }
2295 
2296  // for now, correct the start. I.e., if we only output part of the sentence,
2297  // the attributes must be correct there, as well!!
2298  rHTMLWrt.m_bTextAttr = true;
2299 
2300  size_t nAttrPos = 0;
2301  sal_Int32 nStrPos = rHTMLWrt.m_pCurrentPam->GetPoint()->nContent.GetIndex();
2302  const SwTextAttr * pHt = nullptr;
2303  const size_t nCntAttr = pNd->HasHints() ? pNd->GetSwpHints().Count() : 0;
2304  if( nCntAttr && nStrPos > ( pHt = pNd->GetSwpHints().Get(0) )->GetStart() )
2305  {
2306  // Ok, there are earlier attributes that we must output
2307  do {
2308  aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset );
2309 
2310  nAttrPos++;
2311  if( pHt->Which() == RES_TXTATR_FIELD
2312  || pHt->Which() == RES_TXTATR_ANNOTATION )
2313  continue;
2314 
2315  if ( pHt->End() && !pHt->HasDummyChar() )
2316  {
2317  const sal_Int32 nHtEnd = *pHt->End(),
2318  nHtStt = pHt->GetStart();
2319  if( !rHTMLWrt.m_bWriteAll && nHtEnd <= nStrPos )
2320  continue;
2321 
2322  // don't consider empty hints at the beginning - or should we ??
2323  if( nHtEnd == nHtStt )
2324  continue;
2325 
2326  // add attribute to the list
2327  if( rHTMLWrt.m_bWriteAll )
2328  aEndPosLst.Insert( pHt->GetAttr(), nHtStt + nOffset,
2329  nHtEnd + nOffset,
2330  rHTMLWrt.m_CharFormatInfos );
2331  else
2332  {
2333  sal_Int32 nTmpStt = nHtStt < nStrPos ? nStrPos : nHtStt;
2334  sal_Int32 nTmpEnd = std::min(nHtEnd, nEnd);
2335  aEndPosLst.Insert( pHt->GetAttr(), nTmpStt + nOffset,
2336  nTmpEnd + nOffset,
2337  rHTMLWrt.m_CharFormatInfos );
2338  }
2339  continue;
2340  // but don't output it, that will be done later !!
2341  }
2342 
2343  } while( nAttrPos < nCntAttr && nStrPos >
2344  ( pHt = pNd->GetSwpHints().Get( nAttrPos ) )->GetStart() );
2345 
2346  // so, let's output all collected attributes from the string pos on
2347  aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset );
2348  aEndPosLst.OutStartAttrs( rHTMLWrt, nStrPos + nOffset );
2349  }
2350 
2351  bool bWriteBreak = (HtmlTokenId::PREFORMTXT_ON != rHTMLWrt.m_nLastParaToken);
2352  if( bWriteBreak && pNd->GetNumRule() )
2353  bWriteBreak = false;
2354 
2355  {
2356  HTMLOutContext aContext( rHTMLWrt.m_eDestEnc );
2357 
2358  for( ; nStrPos < nEnd; nStrPos++ )
2359  {
2360  // output the frames that are anchored to the current position
2361  if( bFlysLeft )
2362  {
2363  aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset, &aContext );
2364  bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(),
2365  nStrPos, HtmlPosition::Inside,
2366  &aContext );
2367  }
2368 
2369  bool bOutChar = true;
2370  const SwTextAttr * pTextHt = nullptr;
2371  if (nAttrPos < nCntAttr && pHt->GetStart() == nStrPos)
2372  {
2373  do {
2374  if ( pHt->End() && !pHt->HasDummyChar() )
2375  {
2376  if( *pHt->End() != nStrPos )
2377  {
2378  // insert hints with end, if they don't start
2379  // an empty range (hints that don't start a range
2380  // are ignored)
2381  aEndPosLst.Insert( pHt->GetAttr(), nStrPos + nOffset,
2382  *pHt->End() + nOffset,
2383  rHTMLWrt.m_CharFormatInfos );
2384  }
2385  }
2386  else
2387  {
2388  // hints without an end are output last
2389  OSL_ENSURE( !pTextHt, "Why is there already an attribute without an end?" );
2390  if( rHTMLWrt.m_nTextAttrsToIgnore>0 )
2391  {
2392  rHTMLWrt.m_nTextAttrsToIgnore--;
2393  }
2394  else
2395  {
2396  pTextHt = pHt;
2397  SwFieldIds nFieldWhich;
2398  if( RES_TXTATR_FIELD != pHt->Which()
2399  || ( SwFieldIds::Postit != (nFieldWhich = static_cast<const SwFormatField&>(pHt->GetAttr()).GetField()->Which())
2400  && SwFieldIds::Script != nFieldWhich ) )
2401  {
2402  bWriteBreak = false;
2403  }
2404  }
2405  bOutChar = false; // don't output 255
2406  }
2407  } while( ++nAttrPos < nCntAttr && nStrPos ==
2408  ( pHt = pNd->GetSwpHints().Get( nAttrPos ) )->GetStart() );
2409  }
2410 
2411  // Additionally, some draw formats can bring attributes
2412  if( pTextHt && RES_TXTATR_FLYCNT == pTextHt->Which() )
2413  {
2414  const SwFrameFormat* pFrameFormat =
2415  static_cast<const SwFormatFlyCnt &>(pTextHt->GetAttr()).GetFrameFormat();
2416 
2417  if( RES_DRAWFRMFMT == pFrameFormat->Which() )
2418  aEndPosLst.Insert( *static_cast<const SwDrawFrameFormat *>(pFrameFormat),
2419  nStrPos + nOffset,
2420  rHTMLWrt.m_CharFormatInfos );
2421  }
2422 
2423  aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset, &aContext );
2424  aEndPosLst.OutStartAttrs( rHTMLWrt, nStrPos + nOffset, &aContext );
2425 
2426  if( pTextHt )
2427  {
2428  rHTMLWrt.m_bLFPossible = rHTMLWrt.m_nLastParaToken == HtmlTokenId::NONE &&
2429  nStrPos > 0 &&
2430  rStr[nStrPos-1] == ' ';
2431  sal_uInt16 nCSS1Script = rHTMLWrt.m_nCSS1Script;
2432  rHTMLWrt.m_nCSS1Script = aEndPosLst.GetScriptAtPos(
2433  nStrPos + nOffset, nCSS1Script );
2434  HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext );
2435  Out( aHTMLAttrFnTab, pTextHt->GetAttr(), rHTMLWrt );
2436  rHTMLWrt.m_nCSS1Script = nCSS1Script;
2437  rHTMLWrt.m_bLFPossible = false;
2438  }
2439 
2440  if( bOutChar )
2441  {
2442  sal_uInt32 c = rStr[nStrPos];
2443  if( rtl::isHighSurrogate(c) && nStrPos < nEnd - 1 )
2444  {
2445  const sal_Unicode d = rStr[nStrPos + 1];
2446  if( rtl::isLowSurrogate(d) )
2447  {
2448  c = rtl::combineSurrogates(c, d);
2449  nStrPos++;
2450  }
2451  }
2452 
2453  // try to split a line after about 255 characters
2454  // at a space character unless in a PRE-context
2455  if( ' ' == c && rHTMLWrt.m_nLastParaToken == HtmlTokenId::NONE )
2456  {
2457  sal_Int32 nLineLen;
2458  nLineLen = rHTMLWrt.GetLineLen();
2459 
2460  sal_Int32 nWordLen = rStr.indexOf( ' ', nStrPos+1 );
2461  if( nWordLen == -1 )
2462  nWordLen = nEnd;
2463  nWordLen -= nStrPos;
2464 
2465  if( nLineLen >= rHTMLWrt.m_nWhishLineLen ||
2466  (nLineLen+nWordLen) >= rHTMLWrt.m_nWhishLineLen )
2467  {
2468  HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext );
2469  rHTMLWrt.OutNewLine();
2470  bOutChar = false;
2471  }
2472  }
2473 
2474  if( bOutChar )
2475  {
2476  if( 0x0a == c )
2477  {
2478  HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext );
2479  HtmlWriter aHtml(rWrt.Strm(), rHTMLWrt.maNamespace);
2481  }
2482  else if (c == CH_TXT_ATR_FORMELEMENT)
2483  {
2484  // Placeholder for a single-point fieldmark.
2485 
2486  SwPosition aMarkPos = *rWrt.m_pCurrentPam->GetPoint();
2487  aMarkPos.nContent += nStrPos - aMarkPos.nContent.GetIndex();
2488  rHTMLWrt.OutPointFieldmarks(aMarkPos);
2489  }
2490  else
2491  HTMLOutFuncs::Out_Char( rWrt.Strm(), c, aContext, &rHTMLWrt.m_aNonConvertableCharacters );
2492 
2493  // if a paragraph's last character is a hard line break
2494  // then we need to add an extra <br>
2495  // because browsers like Mozilla wouldn't add a line for the next paragraph
2496  bWriteBreak = (0x0a == c) &&
2497  (HtmlTokenId::PREFORMTXT_ON != rHTMLWrt.m_nLastParaToken);
2498  }
2499  }
2500  }
2501  HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext );
2502  }
2503 
2504  aEndPosLst.OutEndAttrs( rHTMLWrt, SAL_MAX_INT32 );
2505 
2506  // Output the frames that are anchored to the last position
2507  if( bFlysLeft )
2508  bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(),
2509  nEnd, HtmlPosition::Inside );
2510  OSL_ENSURE( !bFlysLeft, "Not all frames were saved!" );
2511 
2512  rHTMLWrt.m_bTextAttr = false;
2513 
2514  if( bWriteBreak )
2515  {
2516  bool bEndOfCell = rHTMLWrt.m_bOutTable &&
2517  rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() ==
2518  rWrt.m_pCurrentPam->GetMark()->nNode.GetIndex();
2519 
2520  if( bEndOfCell && !nEnd &&
2522  {
2523  // If the last paragraph of a table cell is empty and we export
2524  // for the MS-IE, we write a &nbsp; instead of a <BR>
2526  }
2527  else
2528  {
2529  HtmlWriter aHtml(rHTMLWrt.Strm(), rHTMLWrt.maNamespace);
2531  const SvxULSpaceItem& rULSpace = pNd->GetSwAttrSet().Get(RES_UL_SPACE);
2532  if (rULSpace.GetLower() > 0 && !bEndOfCell)
2533  {
2534  aHtml.single(OOO_STRING_SVTOOLS_HTML_linebreak);
2535  }
2536  rHTMLWrt.m_bLFPossible = true;
2537  }
2538  }
2539 
2540  if( rHTMLWrt.m_bClearLeft || rHTMLWrt.m_bClearRight )
2541  {
2542  const sal_Char* pString;
2543  if( rHTMLWrt.m_bClearLeft )
2544  {
2545  if( rHTMLWrt.m_bClearRight )
2547  else
2549  }
2550  else
2551  {
2553  }
2554 
2555  HtmlWriter aHtml(rHTMLWrt.Strm(), rHTMLWrt.maNamespace);
2557  aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_clear, pString);
2558  aHtml.end();
2559 
2560  rHTMLWrt.m_bClearLeft = false;
2561  rHTMLWrt.m_bClearRight = false;
2562 
2563  rHTMLWrt.m_bLFPossible = true;
2564  }
2565 
2566  // if an LF is not allowed already, it is allowed once the paragraphs
2567  // ends with a ' '
2568  if( !rHTMLWrt.m_bLFPossible &&
2569  rHTMLWrt.m_nLastParaToken == HtmlTokenId::NONE &&
2570  nEnd > 0 && ' ' == rStr[nEnd-1] )
2571  rHTMLWrt.m_bLFPossible = true;
2572 
2573  // dot leaders: print the skipped page number in a different span element
2574  if (nIndexTab > -1) {
2575  OString sOut = OUStringToOString(rStr.copy(nIndexTab + 1), RTL_TEXTENCODING_ASCII_US);
2576  rWrt.Strm().WriteOString( "</span><span>" + sOut + "</span>" );
2577  }
2578 
2579  rHTMLWrt.m_bTagOn = false;
2580  OutHTML_SwFormatOff( rWrt, aFormatInfo );
2581 
2582  // if necessary, close a form
2583  rHTMLWrt.OutForm( false );
2584 
2585  if( bPageBreakBehind )
2586  rWrt.Strm().WriteChar( '\f' );
2587 
2588  return rHTMLWrt;
2589 }
2590 
2591 sal_uInt32 SwHTMLWriter::ToPixel( sal_uInt32 nVal, const bool bVert )
2592 {
2593  if( Application::GetDefaultDevice() && nVal )
2594  {
2595  Size aSz( bVert ? 0 : nVal, bVert ? nVal : 0 );
2596  aSz = Application::GetDefaultDevice()->LogicToPixel(aSz, MapMode( MapUnit::MapTwip ));
2597  nVal = bVert ? aSz.Height() : aSz.Width();
2598  if( !nVal ) // if there is a Twip, there should be a pixel as well
2599  nVal = 1;
2600  }
2601  return nVal;
2602 }
2603 
2604 static Writer& OutHTML_CSS1Attr( Writer& rWrt, const SfxPoolItem& rHt )
2605 {
2606  // if hints are currently written, we try to write the hint as an
2607  // CSS1 attribute
2608 
2609  if( static_cast<SwHTMLWriter&>(rWrt).m_bCfgOutStyles && static_cast<SwHTMLWriter&>(rWrt).m_bTextAttr )
2610  OutCSS1_HintSpanTag( rWrt, rHt );
2611 
2612  return rWrt;
2613 }
2614 
2615 /* File CHRATR.HXX: */
2616 
2617 static Writer& OutHTML_SvxColor( Writer& rWrt, const SfxPoolItem& rHt )
2618 {
2619  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2620  if( rHTMLWrt.m_bOutOpts )
2621  return rWrt;
2622 
2623  if( !rHTMLWrt.m_bTextAttr && rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bCfgPreferStyles )
2624  {
2625  // don't write the font color as a tag, if styles are preferred to
2626  // normal tags
2627  return rWrt;
2628  }
2629 
2630  if( rHTMLWrt.m_bTagOn )
2631  {
2632  Color aColor( static_cast<const SvxColorItem&>(rHt).GetValue() );
2633  if( COL_AUTO == aColor )
2634  aColor = COL_BLACK;
2635 
2636  if (rHTMLWrt.mbXHTML)
2637  {
2638  OString sOut = "<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span
2640  rWrt.Strm().WriteOString(sOut);
2641  HTMLOutFuncs::Out_Color(rWrt.Strm(), aColor, /*bXHTML=*/true).WriteChar('>');
2642  }
2643  else
2644  {
2645  OString sOut = "<" OOO_STRING_SVTOOLS_HTML_font " "
2647  rWrt.Strm().WriteOString( sOut );
2648  HTMLOutFuncs::Out_Color( rWrt.Strm(), aColor ).WriteChar( '>' );
2649  }
2650  }
2651  else
2652  {
2653  if (rHTMLWrt.mbXHTML)
2655  rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span, false);
2656  else
2658  }
2659 
2660  return rWrt;
2661 }
2662 
2663 static Writer& OutHTML_SwPosture( Writer& rWrt, const SfxPoolItem& rHt )
2664 {
2665  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2666  if( rHTMLWrt.m_bOutOpts )
2667  return rWrt;
2668 
2669  const FontItalic nPosture = static_cast<const SvxPostureItem&>(rHt).GetPosture();
2670  if( ITALIC_NORMAL == nPosture )
2671  {
2673  }
2674  else if( rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bTextAttr )
2675  {
2676  // maybe as CSS1 attribute?
2677  OutCSS1_HintSpanTag( rWrt, rHt );
2678  }
2679 
2680  return rWrt;
2681 }
2682 
2683 static Writer& OutHTML_SvxFont( Writer& rWrt, const SfxPoolItem& rHt )
2684 {
2685  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2686  if( rHTMLWrt.m_bOutOpts )
2687  return rWrt;
2688 
2689  if( rHTMLWrt.m_bTagOn )
2690  {
2691  OUString aNames;
2692  SwHTMLWriter::PrepareFontList( static_cast<const SvxFontItem&>(rHt), aNames, 0,
2693  rHTMLWrt.IsHTMLMode(HTMLMODE_FONT_GENERIC) );
2694  if (rHTMLWrt.mbXHTML)
2695  {
2696  OString sOut = "<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span
2697  " " OOO_STRING_SVTOOLS_HTML_O_style "=\"font-family: ";
2698  rWrt.Strm().WriteOString(sOut);
2699  HTMLOutFuncs::Out_String(rWrt.Strm(), aNames, rHTMLWrt.m_eDestEnc,
2700  &rHTMLWrt.m_aNonConvertableCharacters)
2701  .WriteCharPtr("\">");
2702  }
2703  else
2704  {
2705  OString sOut = "<" OOO_STRING_SVTOOLS_HTML_font " "
2707  rWrt.Strm().WriteOString( sOut );
2708  HTMLOutFuncs::Out_String( rWrt.Strm(), aNames, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters )
2709  .WriteCharPtr( "\">" );
2710  }
2711  }
2712  else
2713  {
2714  if (rHTMLWrt.mbXHTML)
2716  rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span, false);
2717  else
2719  }
2720 
2721  return rWrt;
2722 }
2723 
2724 static Writer& OutHTML_SvxFontHeight( Writer& rWrt, const SfxPoolItem& rHt )
2725 {
2726  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2727  if( rHTMLWrt.m_bOutOpts )
2728  return rWrt;
2729 
2730  if( rHTMLWrt.m_bTagOn )
2731  {
2732  if (rHTMLWrt.mbXHTML)
2733  {
2734  OString sOut = "<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span;
2735 
2736  sal_uInt32 nHeight = static_cast<const SvxFontHeightItem&>(rHt).GetHeight();
2737  // Twips -> points.
2738  sal_uInt16 nSize = nHeight / 20;
2739  sOut += " " OOO_STRING_SVTOOLS_HTML_O_style "=\"font-size: "
2740  + OString::number(static_cast<sal_Int32>(nSize)) + "pt\"";
2741  rWrt.Strm().WriteOString(sOut);
2742  }
2743  else
2744  {
2745  OString sOut = "<" OOO_STRING_SVTOOLS_HTML_font;
2746 
2747  sal_uInt32 nHeight = static_cast<const SvxFontHeightItem&>(rHt).GetHeight();
2748  sal_uInt16 nSize = rHTMLWrt.GetHTMLFontSize( nHeight );
2749  sOut += " " OOO_STRING_SVTOOLS_HTML_O_size "=\"" +
2750  OString::number(static_cast<sal_Int32>(nSize)) + "\"";
2751  rWrt.Strm().WriteOString( sOut );
2752 
2753  if( rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bTextAttr )
2754  {
2755  // always export font size as CSS option, too
2756  OutCSS1_HintStyleOpt( rWrt, rHt );
2757  }
2758  }
2759  rWrt.Strm().WriteChar( '>' );
2760  }
2761  else
2762  {
2763  if (rHTMLWrt.mbXHTML)
2765  rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span, false);
2766  else
2768  }
2769 
2770  return rWrt;
2771 }
2772 
2773 static Writer& OutHTML_SvxLanguage( Writer& rWrt, const SfxPoolItem& rHt )
2774 {
2775  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2776  if( rHTMLWrt.m_bOutOpts )
2777  return rWrt;
2778 
2779  LanguageType eLang = static_cast<const SvxLanguageItem &>(rHt).GetLanguage();
2780  if( LANGUAGE_DONTKNOW == eLang )
2781  return rWrt;
2782 
2783  if( rHTMLWrt.m_bTagOn )
2784  {
2785  OString sOut = "<" OOO_STRING_SVTOOLS_HTML_span;
2786  rWrt.Strm().WriteOString( sOut );
2787  rHTMLWrt.OutLanguage( static_cast<const SvxLanguageItem &>(rHt).GetLanguage() );
2788  rWrt.Strm().WriteChar( '>' );
2789  }
2790  else
2791  {
2793  }
2794 
2795  return rWrt;
2796 }
2797 static Writer& OutHTML_SwWeight( Writer& rWrt, const SfxPoolItem& rHt )
2798 {
2799  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2800  if( rHTMLWrt.m_bOutOpts )
2801  return rWrt;
2802 
2803  const FontWeight nBold = static_cast<const SvxWeightItem&>(rHt).GetWeight();
2804  if( WEIGHT_BOLD == nBold )
2805  {
2807  }
2808  else if( rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bTextAttr )
2809  {
2810  // maybe as CSS1 attribute ?
2811  OutCSS1_HintSpanTag( rWrt, rHt );
2812  }
2813 
2814  return rWrt;
2815 }
2816 
2817 static Writer& OutHTML_SwCrossedOut( Writer& rWrt, const SfxPoolItem& rHt )
2818 {
2819  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2820  if( rHTMLWrt.m_bOutOpts )
2821  return rWrt;
2822 
2823  // Because of Netscape, we output STRIKE and not S!
2824  const FontStrikeout nStrike = static_cast<const SvxCrossedOutItem&>(rHt).GetStrikeout();
2825  if( STRIKEOUT_NONE != nStrike && !rHTMLWrt.mbReqIF )
2826  {
2828  }
2829  else if( rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bTextAttr )
2830  {
2831  // maybe as CSS1 attribute?
2832  OutCSS1_HintSpanTag( rWrt, rHt );
2833  }
2834 
2835  return rWrt;
2836 }
2837 
2838 static Writer& OutHTML_SvxEscapement( Writer& rWrt, const SfxPoolItem& rHt )
2839 {
2840  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2841  if( rHTMLWrt.m_bOutOpts )
2842  return rWrt;
2843 
2844  const SvxEscapement eEscape =
2845  static_cast<SvxEscapement>(static_cast<const SvxEscapementItem&>(rHt).GetEnumValue());
2846  OString aTag;
2847  switch( eEscape )
2848  {
2849  case SvxEscapement::Superscript: aTag = OOO_STRING_SVTOOLS_HTML_superscript; break;
2850  case SvxEscapement::Subscript: aTag = OOO_STRING_SVTOOLS_HTML_subscript; break;
2851  default:
2852  ;
2853  }
2854 
2855  if( !aTag.isEmpty() )
2856  {
2857  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + aTag, rHTMLWrt.m_bTagOn );
2858  }
2859  else if( rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bTextAttr )
2860  {
2861  // maybe as CSS1 attribute?
2862  OutCSS1_HintSpanTag( rWrt, rHt );
2863  }
2864 
2865  return rWrt;
2866 }
2867 
2868 static Writer& OutHTML_SwUnderline( Writer& rWrt, const SfxPoolItem& rHt )
2869 {
2870  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2871  if( rHTMLWrt.m_bOutOpts )
2872  return rWrt;
2873 
2874  const FontLineStyle eUnder = static_cast<const SvxUnderlineItem&>(rHt).GetLineStyle();
2875  if( LINESTYLE_NONE != eUnder && !rHTMLWrt.mbReqIF )
2876  {
2878  }
2879  else if( rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bTextAttr )
2880  {
2881  // maybe as CSS1 attribute?
2882  OutCSS1_HintSpanTag( rWrt, rHt );
2883  }
2884 
2885  return rWrt;
2886 }
2887 
2888 static Writer& OutHTML_SwFlyCnt( Writer& rWrt, const SfxPoolItem& rHt )
2889 {
2890  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2891  const SwFormatFlyCnt& rFlyCnt = static_cast<const SwFormatFlyCnt&>(rHt);
2892 
2893  const SwFrameFormat& rFormat = *rFlyCnt.GetFrameFormat();
2894  const SdrObject *pSdrObj = nullptr;
2895 
2897  static_cast<SwHTMLFrameType>(rHTMLWrt.GuessFrameType( rFormat, pSdrObj ));
2898  AllHtmlFlags nMode = aHTMLOutFrameAsCharTable[eType][rHTMLWrt.m_nExportMode];
2899  rHTMLWrt.OutFrameFormat( nMode, rFormat, pSdrObj );
2900  return rWrt;
2901 }
2902 
2903 // This is now our Blink item. Blinking is activated by setting the item to
2904 // true!
2905 static Writer& OutHTML_SwBlink( Writer& rWrt, const SfxPoolItem& rHt )
2906 {
2907  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2908  if( rHTMLWrt.m_bOutOpts )
2909  return rWrt;
2910 
2911  if( static_cast<const SvxBlinkItem&>(rHt).GetValue() )
2912  {
2914  }
2915  else if( rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bTextAttr )
2916  {
2917  // maybe as CSS1 attribute?
2918  OutCSS1_HintSpanTag( rWrt, rHt );
2919  }
2920 
2921  return rWrt;
2922 }
2923 
2924 Writer& OutHTML_INetFormat( Writer& rWrt, const SwFormatINetFormat& rINetFormat, bool bOn )
2925 {
2926  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2927 
2928  OUString aURL( rINetFormat.GetValue() );
2929  const SvxMacroTableDtor *pMacTable = rINetFormat.GetMacroTable();
2930  bool bEvents = pMacTable != nullptr && !pMacTable->empty();
2931 
2932  // Anything to output at all?
2933  if( aURL.isEmpty() && !bEvents && rINetFormat.GetName().isEmpty() )
2934  return rWrt;
2935 
2936  // bOn controls if we are writing the opening or closing tag
2937  if( !bOn )
2938  {
2940  return rWrt;
2941  }
2942 
2943  OString sOut("<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor);
2944 
2945  bool bScriptDependent = false;
2946  {
2949  std::unique_ptr<SwHTMLFormatInfo> pFormatInfo(new SwHTMLFormatInfo(pFormat));
2950  auto const it = rHTMLWrt.m_CharFormatInfos.find( pFormatInfo );
2951  if (it != rHTMLWrt.m_CharFormatInfos.end())
2952  {
2953  bScriptDependent = (*it)->bScriptDependent;
2954  }
2955  }
2956  if( !bScriptDependent )
2957  {
2960  std::unique_ptr<SwHTMLFormatInfo> pFormatInfo(new SwHTMLFormatInfo(pFormat));
2961  auto const it = rHTMLWrt.m_CharFormatInfos.find( pFormatInfo );
2962  if (it != rHTMLWrt.m_CharFormatInfos.end())
2963  {
2964  bScriptDependent = (*it)->bScriptDependent;
2965  }
2966  }
2967 
2968  if( bScriptDependent )
2969  {
2970  sOut += " " OOO_STRING_SVTOOLS_HTML_O_class "=\"";
2971  const sal_Char* pStr = nullptr;
2972  switch( rHTMLWrt.m_nCSS1Script )
2973  {
2974  case CSS1_OUTMODE_WESTERN:
2975  pStr = "western";
2976  break;
2977  case CSS1_OUTMODE_CJK:
2978  pStr = "cjk";
2979  break;
2980  case CSS1_OUTMODE_CTL:
2981  pStr = "ctl";
2982  break;
2983  }
2984  sOut += OString(pStr) + "\"";
2985  }
2986 
2987  rWrt.Strm().WriteOString( sOut );
2988  sOut = "";
2989 
2990  OUString sRel;
2991 
2992  if( !aURL.isEmpty() || bEvents )
2993  {
2994  OUString sTmp( aURL.toAsciiUpperCase() );
2995  sal_Int32 nPos = sTmp.indexOf( "\" REL=" );
2996  if( nPos >= 0 )
2997  {
2998  sRel = aURL.copy( nPos+1 );
2999  aURL = aURL.copy( 0, nPos);
3000  }
3001  aURL = comphelper::string::strip(aURL, ' ');
3002 
3003  sOut += " " OOO_STRING_SVTOOLS_HTML_O_href "=\"";
3004  rWrt.Strm().WriteOString( sOut );
3005  rHTMLWrt.OutHyperlinkHRefValue( aURL );
3006  sOut = "\"";
3007  }
3008 
3009  if( !rINetFormat.GetName().isEmpty() )
3010  {
3011  sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\"";
3012  rWrt.Strm().WriteOString( sOut );
3013  HTMLOutFuncs::Out_String( rWrt.Strm(), rINetFormat.GetName(),
3014  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
3015  sOut = "\"";
3016  }
3017 
3018  const OUString& rTarget = rINetFormat.GetTargetFrame();
3019  if( !rTarget.isEmpty() )
3020  {
3021  sOut += " " OOO_STRING_SVTOOLS_HTML_O_target "=\"";
3022  rWrt.Strm().WriteOString( sOut );
3023  HTMLOutFuncs::Out_String( rWrt.Strm(), rTarget, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
3024  sOut = "\"";
3025  }
3026 
3027  if( !sRel.isEmpty() )
3028  sOut += OUStringToOString(sRel, RTL_TEXTENCODING_ASCII_US);
3029 
3030  if( !sOut.isEmpty() )
3031  rWrt.Strm().WriteOString( sOut );
3032 
3033  if( bEvents )
3034  HTMLOutFuncs::Out_Events( rWrt.Strm(), *pMacTable, aAnchorEventTable,
3035  rHTMLWrt.m_bCfgStarBasic, rHTMLWrt.m_eDestEnc,
3036  &rHTMLWrt.m_aNonConvertableCharacters );
3037  rWrt.Strm().WriteCharPtr( ">" );
3038 
3039  return rWrt;
3040 }
3041 
3043 {
3044  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
3045 
3046  if( rHTMLWrt.m_bOutOpts )
3047  return rWrt;
3048 
3049  const SwFormatINetFormat& rINetFormat = static_cast<const SwFormatINetFormat&>(rHt);
3050 
3051  if( rHTMLWrt.m_bTagOn )
3052  {
3053  // if necessary, temporarily close an attribute that is still open
3054  if( !rHTMLWrt.m_aINetFormats.empty() )
3055  {
3056  SwFormatINetFormat *pINetFormat =
3057  rHTMLWrt.m_aINetFormats.back();
3058  OutHTML_INetFormat( rWrt, *pINetFormat, false );
3059  }
3060 
3061  // now, open the new one
3062  OutHTML_INetFormat( rWrt, rINetFormat, true );
3063 
3064  // and remember it
3065  SwFormatINetFormat *pINetFormat = new SwFormatINetFormat( rINetFormat );
3066  rHTMLWrt.m_aINetFormats.push_back( pINetFormat );
3067  }
3068  else
3069  {
3070  OutHTML_INetFormat( rWrt, rINetFormat, false );
3071 
3072  OSL_ENSURE( rHTMLWrt.m_aINetFormats.size(), "there must be a URL attribute missing" );
3073  if( !rHTMLWrt.m_aINetFormats.empty() )
3074  {
3075  // get its own attribute from the stack
3076  SwFormatINetFormat *pINetFormat = rHTMLWrt.m_aINetFormats.back();
3077  rHTMLWrt.m_aINetFormats.pop_back();
3078  delete pINetFormat;
3079  }
3080 
3081  if( !rHTMLWrt.m_aINetFormats.empty() )
3082  {
3083  // there is still an attribute on the stack that must be reopened
3084  SwFormatINetFormat *pINetFormat = rHTMLWrt.m_aINetFormats.back();
3085  OutHTML_INetFormat( rWrt, *pINetFormat, true );
3086  }
3087  }
3088 
3089  return rWrt;
3090 }
3091 
3093 {
3094  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
3095  if( rHTMLWrt.m_bOutOpts )
3096  return rWrt;
3097 
3098  const SwFormatCharFormat& rChrFormat = static_cast<const SwFormatCharFormat&>(rHt);
3099  const SwCharFormat* pFormat = rChrFormat.GetCharFormat();
3100 
3101  if( !pFormat )
3102  {
3103  return rWrt;
3104  }
3105 
3106  std::unique_ptr<SwHTMLFormatInfo> pTmpInfo(new SwHTMLFormatInfo(pFormat));
3107  SwHTMLFormatInfos::const_iterator it = rHTMLWrt.m_CharFormatInfos.find(pTmpInfo);
3108  if (it == rHTMLWrt.m_CharFormatInfos.end())
3109  return rWrt;
3110 
3111  const SwHTMLFormatInfo *pFormatInfo = it->get();
3112  OSL_ENSURE( pFormatInfo, "Why is there no information about the character style?" );
3113 
3114  if( rHTMLWrt.m_bTagOn )
3115  {
3116  OString sOut = "<" + rHTMLWrt.GetNamespace();
3117  if( !pFormatInfo->aToken.isEmpty() )
3118  sOut += pFormatInfo->aToken;
3119  else
3120  sOut += OString(OOO_STRING_SVTOOLS_HTML_span);
3121 
3122  if( rHTMLWrt.m_bCfgOutStyles &&
3123  (!pFormatInfo->aClass.isEmpty() || pFormatInfo->bScriptDependent) )
3124  {
3125  sOut += " " OOO_STRING_SVTOOLS_HTML_O_class "=\"";
3126  rWrt.Strm().WriteOString( sOut );
3127  OUString aClass( pFormatInfo->aClass );
3128  if( pFormatInfo->bScriptDependent )
3129  {
3130  if( !aClass.isEmpty() )
3131  aClass += "-";
3132  switch( rHTMLWrt.m_nCSS1Script )
3133  {
3134  case CSS1_OUTMODE_WESTERN:
3135  aClass += "western";
3136  break;
3137  case CSS1_OUTMODE_CJK:
3138  aClass += "cjk";
3139  break;
3140  case CSS1_OUTMODE_CTL:
3141  aClass += "ctl";
3142  break;
3143  }
3144  }
3145  HTMLOutFuncs::Out_String( rWrt.Strm(), aClass,
3146  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
3147  sOut = "\"";
3148  }
3149  sOut += ">";
3150  rWrt.Strm().WriteOString( sOut );
3151  }
3152  else
3153  {
3154  OString aTag = !pFormatInfo->aToken.isEmpty() ? pFormatInfo->aToken.getStr()
3156  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rHTMLWrt.GetNamespace() + aTag, false);
3157  }
3158 
3159  return rWrt;
3160 }
3161 
3162 static Writer& OutHTML_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt )
3163 {
3164  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
3165  if( !rHTMLWrt.m_bOutOpts || !rHTMLWrt.m_bTagOn )
3166  return rWrt;
3167 
3168  const SvxAdjustItem& rAdjust = static_cast<const SvxAdjustItem&>(rHt);
3169  const sal_Char* pStr = nullptr;
3170  switch( rAdjust.GetAdjust() )
3171  {
3172  case SvxAdjust::Center: pStr = OOO_STRING_SVTOOLS_HTML_AL_center; break;
3173  case SvxAdjust::Left: pStr = OOO_STRING_SVTOOLS_HTML_AL_left; break;
3174  case SvxAdjust::Right: pStr = OOO_STRING_SVTOOLS_HTML_AL_right; break;
3175  case SvxAdjust::Block: pStr = OOO_STRING_SVTOOLS_HTML_AL_justify; break;
3176  default:
3177  ;
3178  }
3179  if( pStr )
3180  {
3181  OString sOut = " " OOO_STRING_SVTOOLS_HTML_O_align "=\"" +
3182  OString(pStr) + "\"";
3183  rWrt.Strm().WriteOString( sOut );
3184  }
3185 
3186  return rWrt;
3187 }
3188 
3189 /*
3190  * here, define the table for the HTML function pointers to the output
3191  * functions.
3192  */
3193 
3195 /* RES_CHRATR_CASEMAP */ OutHTML_CSS1Attr,
3196 /* RES_CHRATR_CHARSETCOLOR */ nullptr,
3197 /* RES_CHRATR_COLOR */ OutHTML_SvxColor,
3198 /* RES_CHRATR_CONTOUR */ nullptr,
3199 /* RES_CHRATR_CROSSEDOUT */ OutHTML_SwCrossedOut,
3200 /* RES_CHRATR_ESCAPEMENT */ OutHTML_SvxEscapement,
3201 /* RES_CHRATR_FONT */ OutHTML_SvxFont,
3202 /* RES_CHRATR_FONTSIZE */ OutHTML_SvxFontHeight,
3203 /* RES_CHRATR_KERNING */ OutHTML_CSS1Attr,
3204 /* RES_CHRATR_LANGUAGE */ OutHTML_SvxLanguage,
3205 /* RES_CHRATR_POSTURE */ OutHTML_SwPosture,
3206 /* RES_CHRATR_UNUSED1*/ nullptr,
3207 /* RES_CHRATR_SHADOWED */ nullptr,
3208 /* RES_CHRATR_UNDERLINE */ OutHTML_SwUnderline,
3209 /* RES_CHRATR_WEIGHT */ OutHTML_SwWeight,
3210 /* RES_CHRATR_WORDLINEMODE */ nullptr,
3211 /* RES_CHRATR_AUTOKERN */ nullptr,
3212 /* RES_CHRATR_BLINK */ OutHTML_SwBlink,
3213 /* RES_CHRATR_NOHYPHEN */ nullptr, // New: don't hyphenate
3214 /* RES_CHRATR_UNUSED2 */ nullptr,
3215 /* RES_CHRATR_BACKGROUND */ OutHTML_CSS1Attr, // New: character background
3216 /* RES_CHRATR_CJK_FONT */ OutHTML_SvxFont,
3217 /* RES_CHRATR_CJK_FONTSIZE */ OutHTML_SvxFontHeight,
3218 /* RES_CHRATR_CJK_LANGUAGE */ OutHTML_SvxLanguage,
3219 /* RES_CHRATR_CJK_POSTURE */ OutHTML_SwPosture,
3220 /* RES_CHRATR_CJK_WEIGHT */ OutHTML_SwWeight,
3221 /* RES_CHRATR_CTL_FONT */ OutHTML_SvxFont,
3222 /* RES_CHRATR_CTL_FONTSIZE */ OutHTML_SvxFontHeight,
3223 /* RES_CHRATR_CTL_LANGUAGE */ OutHTML_SvxLanguage,
3224 /* RES_CHRATR_CTL_POSTURE */ OutHTML_SwPosture,
3225 /* RES_CHRATR_CTL_WEIGHT */ OutHTML_SwWeight,
3226 /* RES_CHRATR_ROTATE */ nullptr,
3227 /* RES_CHRATR_EMPHASIS_MARK */ nullptr,
3228 /* RES_CHRATR_TWO_LINES */ nullptr,
3229 /* RES_CHRATR_SCALEW */ nullptr,
3230 /* RES_CHRATR_RELIEF */ nullptr,
3231 /* RES_CHRATR_HIDDEN */ OutHTML_CSS1Attr,
3232 /* RES_CHRATR_OVERLINE */ OutHTML_CSS1Attr,
3233 /* RES_CHRATR_RSID */ nullptr,
3234 /* RES_CHRATR_BOX */ OutHTML_CSS1Attr,
3235 /* RES_CHRATR_SHADOW */ nullptr,
3236 /* RES_CHRATR_HIGHLIGHT */ nullptr,
3237 /* RES_CHRATR_GRABBAG */ nullptr,
3238 /* RES_CHRATR_BIDIRTL */ nullptr,
3239 /* RES_CHRATR_IDCTHINT */ nullptr,
3240 
3241 /* RES_TXTATR_REFMARK */ nullptr,
3242 /* RES_TXTATR_TOXMARK */ nullptr,
3243 /* RES_TXTATR_META */ nullptr,
3244 /* RES_TXTATR_METAFIELD */ nullptr,
3245 /* RES_TXTATR_AUTOFMT */ nullptr,
3246 /* RES_TXTATR_INETFMT */ OutHTML_SwFormatINetFormat,
3247 /* RES_TXTATR_CHARFMT */ OutHTML_SwTextCharFormat,
3248 /* RES_TXTATR_CJK_RUBY */ nullptr,
3249 /* RES_TXTATR_UNKNOWN_CONTAINER */ nullptr,
3250 /* RES_TXTATR_INPUTFIELD */ OutHTML_SwFormatField,
3251 
3252 /* RES_TXTATR_FIELD */ OutHTML_SwFormatField,
3253 /* RES_TXTATR_FLYCNT */ OutHTML_SwFlyCnt,
3254 /* RES_TXTATR_FTN */ OutHTML_SwFormatFootnote,
3255 /* RES_TXTATR_ANNOTATION */ OutHTML_SwFormatField,
3256 /* RES_TXTATR_DUMMY3 */ nullptr,
3257 /* RES_TXTATR_DUMMY1 */ nullptr, // Dummy:
3258 /* RES_TXTATR_DUMMY2 */ nullptr, // Dummy:
3259 
3260 /* RES_PARATR_LINESPACING */ nullptr,
3261 /* RES_PARATR_ADJUST */ OutHTML_SvxAdjust,
3262 /* RES_PARATR_SPLIT */ nullptr,
3263 /* RES_PARATR_WIDOWS */ nullptr,
3264 /* RES_PARATR_ORPHANS */ nullptr,
3265 /* RES_PARATR_TABSTOP */ nullptr,
3266 /* RES_PARATR_HYPHENZONE*/ nullptr,
3267 /* RES_PARATR_DROP */ OutHTML_CSS1Attr,
3268 /* RES_PARATR_REGISTER */ nullptr, // new: register-true
3269 /* RES_PARATR_NUMRULE */ nullptr, // Dummy:
3270 /* RES_PARATR_SCRIPTSPACE */ nullptr, // Dummy:
3271 /* RES_PARATR_HANGINGPUNCTUATION */ nullptr, // Dummy:
3272 /* RES_PARATR_FORBIDDEN_RULES */ nullptr, // new
3273 /* RES_PARATR_VERTALIGN */ nullptr, // new
3274 /* RES_PARATR_SNAPTOGRID*/ nullptr, // new
3275 /* RES_PARATR_CONNECT_TO_BORDER */ nullptr, // new
3276 /* RES_PARATR_OUTLINELEVEL */ nullptr,
3277 /* RES_PARATR_RSID */ nullptr,
3278 /* RES_PARATR_GRABBAG */ nullptr,
3279 
3280 /* RES_PARATR_LIST_ID */ nullptr, // new
3281 /* RES_PARATR_LIST_LEVEL */ nullptr, // new
3282 /* RES_PARATR_LIST_ISRESTART */ nullptr, // new
3283 /* RES_PARATR_LIST_RESTARTVALUE */ nullptr, // new
3284 /* RES_PARATR_LIST_ISCOUNTED */ nullptr, // new
3285 
3286 /* RES_FILL_ORDER */ nullptr,
3287 /* RES_FRM_SIZE */ nullptr,
3288 /* RES_PAPER_BIN */ nullptr,
3289 /* RES_LR_SPACE */ nullptr,
3290 /* RES_UL_SPACE */ nullptr,
3291 /* RES_PAGEDESC */ nullptr,
3292 /* RES_BREAK */ nullptr,
3293 /* RES_CNTNT */ nullptr,
3294 /* RES_HEADER */ nullptr,
3295 /* RES_FOOTER */ nullptr,
3296 /* RES_PRINT */ nullptr,
3297 /* RES_OPAQUE */ nullptr,
3298 /* RES_PROTECT */ nullptr,
3299 /* RES_SURROUND */ nullptr,
3300 /* RES_VERT_ORIENT */ nullptr,
3301 /* RES_HORI_ORIENT */ nullptr,
3302 /* RES_ANCHOR */ nullptr,
3303 /* RES_BACKGROUND */ nullptr,
3304 /* RES_BOX */ nullptr,
3305 /* RES_SHADOW */ nullptr,
3306 /* RES_FRMMACRO */ nullptr,
3307 /* RES_COL */ nullptr,
3308 /* RES_KEEP */ nullptr,
3309 /* RES_URL */ nullptr,
3310 /* RES_EDIT_IN_READONLY */ nullptr,
3311 /* RES_LAYOUT_SPLIT */ nullptr,
3312 /* RES_CHAIN */ nullptr,
3313 /* RES_TEXTGRID */ nullptr,
3314 /* RES_LINENUMBER */ nullptr,
3315 /* RES_FTN_AT_TXTEND */ nullptr,
3316 /* RES_END_AT_TXTEND */ nullptr,
3317 /* RES_COLUMNBALANCE */ nullptr,
3318 /* RES_FRAMEDIR */ nullptr,
3319 /* RES_HEADER_FOOTER_EAT_SPACING */ nullptr,
3320 /* RES_ROW_SPLIT */ nullptr,
3321 /* RES_FOLLOW_TEXT_FLOW */ nullptr,
3322 /* RES_COLLAPSING_BORDERS */ nullptr,
3323 /* RES_WRAP_INFLUENCE_ON_OBJPOS */ nullptr,
3324 /* RES_AUTO_STYLE */ nullptr,
3325 /* RES_FRMATR_STYLE_NAME */ nullptr,
3326 /* RES_FRMATR_CONDITIONAL_STYLE_NAME */ nullptr,
3327 /* RES_FRMATR_GRABBAG */ nullptr,
3328 /* RES_TEXT_VERT_ADJUST */ nullptr,
3329 
3330 /* RES_GRFATR_MIRRORGRF */ nullptr,
3331 /* RES_GRFATR_CROPGRF */ nullptr,
3332 /* RES_GRFATR_ROTATION */ nullptr,
3333 /* RES_GRFATR_LUMINANCE */ nullptr,
3334 /* RES_GRFATR_CONTRAST */ nullptr,
3335 /* RES_GRFATR_CHANNELR */ nullptr,
3336 /* RES_GRFATR_CHANNELG */ nullptr,
3337 /* RES_GRFATR_CHANNELB */ nullptr,
3338 /* RES_GRFATR_GAMMA */ nullptr,
3339 /* RES_GRFATR_INVERT */ nullptr,
3340 /* RES_GRFATR_TRANSPARENCY */ nullptr,
3341 /* RES_GRFATR_DRWAMODE */ nullptr,
3342 /* RES_GRFATR_DUMMY1 */ nullptr,
3343 /* RES_GRFATR_DUMMY2 */ nullptr,
3344 /* RES_GRFATR_DUMMY3 */ nullptr,
3345 /* RES_GRFATR_DUMMY4 */ nullptr,
3346 /* RES_GRFATR_DUMMY5 */ nullptr,
3347 
3348 /* RES_BOXATR_FORMAT */ nullptr,
3349 /* RES_BOXATR_FORMULA */ nullptr,
3350 /* RES_BOXATR_VALUE */ nullptr
3351 };
3352 
3353 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
long GetLeft() const
long Width() const
sal_uInt8 GetLevel() const
Definition: htmlnum.hxx:110
bool m_bCfgFormFeed
Definition: wrthtml.hxx:339
sal_Int32 & GetStart()
start position
Definition: txatbase.hxx:77
static const SdrObject * GetMarqueeTextObj(const SwDrawFrameFormat &rFormat)
#define RES_CHRATR_WEIGHT
Definition: hintids.hxx:83
void InsertNoScript(const SfxPoolItem &rItem, sal_Int32 nStart, sal_Int32 nEnd, SwHTMLFormatInfos &rFormatInfos, bool bParaAttrs)
Definition: htmlatr.cxx:1601
#define OOO_STRING_SVTOOLS_HTML_preformtxt
HTMLStartEndPositions aEndLst
Definition: htmlatr.cxx:1074
sal_uInt16 GuessFrameType(const SwFrameFormat &rFrameFormat, const SdrObject *&rpStrObj)
sal_uLong GetIndex() const
Definition: node.hxx:282
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
SwHTMLNumRuleInfo & GetNumInfo()
Definition: wrthtml.hxx:521
sal_uInt16 nBottomMargin
Definition: wrthtml.hxx:222
bool mbXHTML
If XHTML markup should be written instead of HTML.
Definition: wrthtml.hxx:392
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
#define OOO_STRING_SVTOOLS_HTML_O_clear
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
Marks a position in the document model.
Definition: pam.hxx:35
#define OOO_STRING_SVTOOLS_HTML_blink
bool IsSectionNode() const
Definition: node.hxx:644
#define RES_CHRATR_CJK_LANGUAGE
Definition: hintids.hxx:92
#define RES_CONDTXTFMTCOLL
Definition: hintids.hxx:278
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1344
sal_uInt16 GetLower() const
SvxAdjust GetAdjust() const
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars=nullptr)
void Insert(const SfxPoolItem &rItem, sal_Int32 nStart, sal_Int32 nEnd, SwHTMLFormatInfos &rFormatInfos, bool bParaAttrs=false)
Definition: htmlatr.cxx:1723
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:76
static SVT_DLLPUBLIC void applyColor(HtmlWriter &rHtmlWriter, const OString &aAttributeName, const Color &rColor)
sal_uLong StartOfSectionIndex() const
Definition: node.hxx:673
bool m_bClearLeft
Definition: wrthtml.hxx:375
SwHTMLFormatInfo(const SwFormat *pF)
Definition: wrthtml.hxx:227
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:78
void FillNextNumInfo()
const OUString & GetText() const
Definition: ndtxt.hxx:211
bool ExistsOffTagItem(sal_uInt16 nWhich, sal_Int32 nStartPos, sal_Int32 nEndPos)
Definition: htmlatr.cxx:1359
bool IsOutline() const
Returns if this text node is an outline.
Definition: ndtxt.cxx:4002
bool bScriptDependent
Definition: wrthtml.hxx:224
SwHTMLNumRuleInfo * GetNextNumInfo()
Definition: wrthtml.hxx:525
SwPaM * m_pCurrentPam
Definition: shellio.hxx:406
std::string GetValue
#define OOO_STRING_SVTOOLS_HTML_AL_all
short GetTextFirstLineOfst() const
#define OOO_STRING_SVTOOLS_HTML_AL_center
long Height() const
SwNodeIndex nNode
Definition: pam.hxx:37
sal_uInt16 m_nTextAttrsToIgnore
Definition: wrthtml.hxx:325
#define RES_CHRATR_CJK_POSTURE
Definition: hintids.hxx:93
long GetWidth() const
std::set< OUString > & rScriptTextStyles
Definition: htmlatr.cxx:1085
const SvxBrushItem * GetBrush() const
sal_uInt16 m_nExportMode
Definition: wrthtml.hxx:326
#define OOO_STRING_SVTOOLS_HTML_O_SDonmouseover
static SVT_DLLPUBLIC SvStream & Out_Events(SvStream &, const SvxMacroTableDtor &, const HTMLOutEvent *, bool bOutStarBasic, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars)
void Set(const SwHTMLNumRuleInfo &rInf)
Definition: htmlnum.hxx:93
sal_uIntPtr sal_uLong
bool ShouldOutputToken() const
Definition: htmlatr.cxx:225
static Writer & OutHTML_SvxLanguage(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2773
#define RES_FRAMEDIR
Definition: hintids.hxx:225
void OutBookmarks()
Definition: wrthtml.cxx:1116
static sal_uInt16 GetDefListLvl(const OUString &rNm, sal_uInt16 nPoolId)
Definition: htmlatr.cxx:101
const SwPosition * GetMark() const
Definition: pam.hxx:209
const SvxFrameDirectionItem & GetFrameDir(bool=true) const
Definition: frmatr.hxx:94
static void OutHTML_SwFormatOff(Writer &rWrt, const SwHTMLTextCollOutputInfo &rInfo)
Definition: htmlatr.cxx:968
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:402
bool IsRestart() const
Definition: htmlnum.hxx:78
sal_Int32 toInt32(OUString const &rStr)
Definition: doc.hxx:185
void DecIndentLevel()
Definition: wrthtml.hxx:494
OUString m_aNonConvertableCharacters
Definition: wrthtml.hxx:291
#define RES_CHRATR_CJK_WEIGHT
Definition: hintids.hxx:94
sal_uInt16 FirstWhich()
#define sCSS2_P_CLASS_leaders
Definition: wrthtml.hxx:398
#define RES_CHRATR_FONT
Definition: hintids.hxx:75
constexpr::Color COL_GRAY(0x80, 0x80, 0x80)
void OutFrameFormat(AllHtmlFlags nType, const SwFrameFormat &rFormat, const SdrObject *pSdrObj)
bool HasDummyChar() const
Definition: txatbase.hxx:96
const std::shared_ptr< SfxItemSet > & GetStyleHandle() const
Definition: fmtautofmt.hxx:48
SvxFrameDirection
Writer & OutHTML_SwTextNode(Writer &rWrt, const SwContentNode &rNode)
Definition: htmlatr.cxx:2006
#define RES_CHRATR_BLINK
Definition: hintids.hxx:86
SvStream & WriteOString(const OString &rStr)
#define RES_CHRATR_CJK_FONT
Definition: hintids.hxx:90
void single(const OString &aContent)
Writer & OutCSS1_ParaTagStyleOpt(Writer &rWrt, const SfxItemSet &rItemSet)
Definition: css1atr.cxx:1826
#define RES_CHRATR_CJK_FONTSIZE
Definition: hintids.hxx:91
#define RES_TXTATR_CHARFMT
Definition: hintids.hxx:142
sal_uInt16 Which() const
Definition: txatbase.hxx:105
static Writer & OutHTML_SvxEscapement(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2838
#define OOO_STRING_SVTOOLS_HTML_superscript
#define OOO_STRING_SVTOOLS_HTML_italic
bool IsListRestart() const
Definition: ndtxt.cxx:4120
HTMLStartEndPositions aStartLst
Definition: htmlatr.cxx:1073
#define CH_TXT_ATR_FORMELEMENT
Definition: hintids.hxx:50
sal_Int32 nStart
Definition: htmlatr.cxx:1035
bool m_bOutTable
Definition: wrthtml.hxx:359
SvStream & WriteCharPtr(const char *pBuf)
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4097
OString maNamespace
XML namespace, in case of XHTML.
Definition: wrthtml.hxx:394
SwDoc *const pTemplate
Definition: htmlatr.cxx:1083
static SVT_DLLPUBLIC SvStream & Out_Color(SvStream &, const Color &, bool bXHTML=false)
sal_uInt16 NextWhich()
#define CSS1_OUTMODE_CJK
Definition: wrthtml.hxx:180
Writer & OutHTML_NumBulListStart(SwHTMLWriter &rWrt, const SwHTMLNumRuleInfo &rInfo)
sal_Int32 GetStart() const
Definition: htmlatr.cxx:1046
static OutputDevice * GetDefaultDevice()
WEIGHT_BOLD
Writer & OutCSS1_HintSpanTag(Writer &rWrt, const SfxPoolItem &rHt)
Definition: css1atr.cxx:3720
#define OOO_STRING_SVTOOLS_HTML_subscript
#define OOO_STRING_SVTOOLS_HTML_O_onmouseout
void OutNewLine(bool bCheck=false)
Definition: wrthtml.cxx:1412
bool m_bWriteAll
Definition: shellio.hxx:407
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
void SetEnd(sal_Int32 nE)
Definition: htmlatr.cxx:1049
sal_uInt16 sal_Unicode
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
#define RES_CHRATR_END
Definition: hintids.hxx:114
bool m_bLFPossible
Definition: wrthtml.hxx:377
#define OOO_STRING_SVTOOLS_HTML_O_size
static SVT_DLLPUBLIC SvStream & Out_AsciiTag(SvStream &, const OString &rStr, bool bOn=true)
static Writer & OutHTML_SwFormatINetFormat(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:3042
bool mbReqIF
If the ReqIF subset of XHTML should be written.
Definition: wrthtml.hxx:396
SwAttrFnTab aHTMLAttrFnTab
Definition: htmlatr.cxx:3194
LINESTYLE_NONE
#define RES_CHRATR_CTL_FONTSIZE
Definition: hintids.hxx:96
static SVT_DLLPUBLIC SvStream & Out_Char(SvStream &, sal_uInt32 cChar, HTMLOutContext &rContext, OUString *pNonConvertableChars)
SwIndex nContent
Definition: pam.hxx:38
boost::optional< Color > m_xDfltColor
Definition: wrthtml.hxx:297
static void SubtractItemSet(SfxItemSet &rItemSet, const SfxItemSet &rRefItemSet, bool bSetDefaults, bool bClearSame=true, const SfxItemSet *pRefScriptItemSet=nullptr)
Definition: css1atr.cxx:1007
#define OOO_STRING_SVTOOLS_HTML_O_href
static Writer & OutHTML_SvxFontHeight(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2724
static void PrepareFontList(const SvxFontItem &rFontItem, OUString &rNames, sal_Unicode cQuote, bool bGeneric)
Definition: css1atr.cxx:1090
Writer & OutHTML_NumBulListEnd(SwHTMLWriter &rWrt, const SwHTMLNumRuleInfo &rNextInfo)
#define CSS1_OUTMODE_ANY_SCRIPT
Definition: wrthtml.hxx:176
#define OOO_STRING_SVTOOLS_HTML_strike
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:458
char sal_Char
const OUString & GetName() const
Definition: format.hxx:111
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
#define OOO_STRING_SVTOOLS_HTML_AL_justify
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
bool IsStartNode() const
Definition: node.hxx:624
#define HTMLMODE_NO_CONTROL_CENTERING
Definition: wrthtml.hxx:127
#define RES_UL_SPACE
Definition: hintids.hxx:197
#define OOO_STRING_SVTOOLS_HTML_horzrule
FnAttrOut SwAttrFnTab[POOLATTR_END-POOLATTR_BEGIN]
Definition: wrt_fn.hxx:32
const SvxMacroTableDtor * GetMacroTable() const
Definition: fmtinfmt.hxx:132
const SwTable & GetTable() const
Definition: node.hxx:497
static void OutHTML_SwFormat(Writer &rWrt, const SwFormat &rFormat, const SfxItemSet *pNodeItemSet, SwHTMLTextCollOutputInfo &rInfo)
Definition: htmlatr.cxx:423
#define RES_TXTFMTCOLL
Definition: hintids.hxx:275
#define RES_CHRATR_CASEMAP
Definition: hintids.hxx:69
sal_uInt16 GetScaledWidth() const
OUString GetFootEndNoteSym(const SwFormatFootnote &rFormatFootnote)
Definition: htmlftn.cxx:387
OString strip(const OString &rIn, sal_Char c)
sal_Int32 nRightMargin
Definition: wrthtml.hxx:218
static Writer & OutHTML_SwBlink(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2905
STRIKEOUT_SINGLE
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
const SfxPoolItem * GetItem() const
Definition: htmlatr.cxx:1043
static Writer & OutHTML_SvxFont(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2683
short nFirstLineIndent
Definition: wrthtml.hxx:219
bool IsHTMLMode(sal_uLong nMode) const
Definition: htmlatr.cxx:1150
#define OOO_STRING_SVTOOLS_HTML_li
bool IsHTMLMode(sal_uInt32 nMode) const
Definition: wrthtml.hxx:563
void OutStartAttrs(SwHTMLWriter &rHWrt, sal_Int32 nPos, HTMLOutContext *pContext=nullptr)
Definition: htmlatr.cxx:1881
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:143
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
std::vector< SwFormatINetFormat * > m_aINetFormats
Definition: wrthtml.hxx:287
#define HTMLMODE_FONT_GENERIC
Definition: wrthtml.hxx:125
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
#define OOO_STRING_SVTOOLS_HTML_bold
void ChangeParaToken(HtmlTokenId nNew)
Definition: htmlatr.cxx:164
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:716
Base class for various Writer styles.
Definition: format.hxx:43
static sal_uInt16 GetCSS1ScriptForScriptType(sal_uInt16 nScriptType)
Definition: htmlatr.cxx:174
const OUString & GetName() const
Definition: fmtinfmt.hxx:80
std::set< OUString > m_aScriptTextStyles
Definition: wrthtml.hxx:281
long const nTopMargin
Table of Contents - heading.
Definition: poolfmt.hxx:342
#define HTML_DLCOLL_DT
Definition: wrthtml.hxx:130
#define RES_CHRATR_COLOR
Definition: hintids.hxx:71
#define OOO_STRING_SVTOOLS_HTML_O_class
HTMLOnOffState
Definition: htmlatr.cxx:1061
#define OOO_STRING_SVTOOLS_HTML_font
static Writer & OutHTML_SvxColor(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2617
SwDoc * pDoc
Definition: htmlatr.cxx:1082
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:443
void OutLanguage(LanguageType eLang)
Definition: wrthtml.cxx:1323
bool empty() const
static sal_uInt16 GetCSS1Selector(const SwFormat *pFormat, OString &rToken, OUString &rClass, sal_uInt16 &rRefPoolId, OUString *pPseudo=nullptr)
Definition: css1atr.cxx:623
sal_uLong const nHTMLMode
Definition: htmlatr.cxx:1087
sal_uInt16 nTopMargin
Definition: wrthtml.hxx:221
Style of a layout element.
Definition: frmfmt.hxx:57
#define RES_CHRATR_OVERLINE
Definition: hintids.hxx:106
size_t Count() const
Definition: ndhints.hxx:152
bool m_bCfgStarBasic
Definition: wrthtml.hxx:340
rtl_TextEncoding m_eDestEnc
Definition: wrthtml.hxx:332
#define SAL_MAX_INT32
sal_Int32 m_nWhishLineLen
Definition: wrthtml.hxx:321
#define RES_CHRATR_BACKGROUND
Definition: hintids.hxx:89
SwTextAttr * Get(size_t nPos) const
Definition: ndhints.hxx:154
sal_uInt16 GetDepth() const
Definition: htmlnum.hxx:73
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define RES_CHRATR_CTL_FONT
Definition: hintids.hxx:95
Internet visited.
Definition: poolfmt.hxx:122
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
std::set< std::unique_ptr< SwHTMLFormatInfo >, comphelper::UniquePtrValueLess< SwHTMLFormatInfo > > SwHTMLFormatInfos
Definition: wrthtml.hxx:252
const SwPosition * GetPoint() const
Definition: pam.hxx:207
#define RES_CHRATR_BOX
Definition: hintids.hxx:108
const SwHTMLFormatInfo * GetFormatInfo(const SwFormat &rFormat, SwHTMLFormatInfos &rFormatInfos)
Definition: htmlatr.cxx:1552
sal_Int32 GetLineLen()
Definition: wrthtml.hxx:500
HTMLStartEndPos(const SfxPoolItem &rItem, sal_Int32 nStt, sal_Int32 nE)
Definition: htmlatr.cxx:1052
bool OutFlyFrame(sal_uLong nNdIdx, sal_Int32 nContentIdx, HtmlPosition nPos, HTMLOutContext *pContext=nullptr)
const Color & GetColor() const
SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const
Definition: ndtxt.cxx:4184
Writer & OutHTML_SwFormatFootnote(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlftn.cxx:248
Text body.
Definition: poolfmt.hxx:251
static SVT_DLLPUBLIC SvStream & FlushToAscii(SvStream &, HTMLOutContext &rContext)
int i
Writer & OutCSS1_HintStyleOpt(Writer &rWrt, const SfxPoolItem &rHt)
Definition: css1atr.cxx:3735
void FixSplittedItem(HTMLStartEndPos *pPos, sal_Int32 nNewEnd, HTMLStartEndPositions::size_type nStartPos)
Definition: htmlatr.cxx:1398
boost::optional< Color > xDfltColor
Definition: htmlatr.cxx:1084
sal_uInt16 Count() const
SwFieldIds
Definition: fldbas.hxx:38
SwDoc * GetDoc()
Definition: node.hxx:702
SW_DLLPUBLIC Writer & Out(const SwAttrFnTab, const SfxPoolItem &, Writer &)
Definition: wrt_fn.cxx:32
void RemoveItem_(HTMLStartEndPositions::size_type nEndPos)
Definition: htmlatr.cxx:1168
sal_Int32 nEnd
Definition: htmlatr.cxx:1036
WEIGHT_NORMAL
#define OOO_STRING_SVTOOLS_HTML_AL_left
Internet normal.
Definition: poolfmt.hxx:121
LINESTYLE_SINGLE
static const SwFormat * GetTemplateFormat(sal_uInt16 nPoolId, IDocumentStylePoolAccess *pTemplate)
Definition: css1atr.cxx:962
#define OOO_STRING_SVTOOLS_HTML_blockquote
#define OOO_STRING_SVTOOLS_HTML_O_onmouseover
#define RES_CHRATR_BEGIN
Definition: hintids.hxx:68
#define OOO_STRING_SVTOOLS_HTML_O_name
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2814
#define LANGUAGE_DONTKNOW
#define RES_CHRATR_UNDERLINE
Definition: hintids.hxx:82
#define OOO_STRING_SVTOOLS_HTML_S_nbsp
bool IsNumbered() const
Definition: htmlnum.hxx:80
sal_uInt16 GetHTMLFontSize(sal_uInt32 nFontHeight) const
Definition: wrthtml.cxx:1428
#define RES_CHRATR_ESCAPEMENT
Definition: hintids.hxx:74
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:425
bool IsEndNode() const
Definition: node.hxx:632
bool HasParaToken() const
Definition: htmlatr.cxx:224
SwpHints & GetSwpHints()
getters for SwpHints
Definition: ndtxt.hxx:808
static Writer & OutHTML_SwCrossedOut(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2817
void InsertItem_(HTMLStartEndPos *pPos, HTMLStartEndPositions::size_type nEndPos)
Definition: htmlatr.cxx:1153
SwStartNodeType GetStartNodeType() const
Definition: node.hxx:320
ITALIC_NONE
#define CSS1_FMT_ISTAG
Definition: wrthtml.hxx:132
SwNodeIndex * m_pStartNdIdx
Definition: wrthtml.hxx:298
sal_uInt8 GetChars() const
Definition: paratr.hxx:89
SwStartNode * GetStartNode()
Definition: node.hxx:591
#define OOO_STRING_SVTOOLS_HTML_dt
DocumentType const eType
bool IsRGBEqual(const Color &rColor) const
std::unique_ptr< SfxPoolItem > pItem
Definition: htmlatr.cxx:1037
#define RES_TXTATR_INETFMT
Definition: hintids.hxx:141
SfxItemPool * GetPool() const
SwHTMLFrameType
Definition: htmlfly.hxx:33
#define OOO_STRING_SVTOOLS_HTML_underline
const SwFormatFootnote * m_pFormatFootnote
Definition: wrthtml.hxx:300
std::vector< sal_uInt16 > aScriptLst
Definition: htmlatr.cxx:1080
static sal_uInt32 ToPixel(sal_uInt32 nVal, const bool bVert)
Definition: htmlatr.cxx:2591
#define HTML_DLCOLL_DD
Definition: wrthtml.hxx:129
#define CSS1_FMT_CMPREF
Definition: wrthtml.hxx:133
#define RES_CHRATR_KERNING
Definition: hintids.hxx:77
#define RES_LR_SPACE
Definition: hintids.hxx:196
HtmlTokenId
bool m_bOutOpts
Definition: wrthtml.hxx:357
void SplitItem(const SfxPoolItem &rItem, sal_Int32 nStart, sal_Int32 nEnd)
Definition: htmlatr.cxx:1487
Point LogicToPixel(const Point &rLogicPt) const
std::unique_ptr< SfxItemSet > pItemSet
Definition: wrthtml.hxx:215
bool m_bTagOn
Definition: wrthtml.hxx:346
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
bool m_bClearRight
Definition: wrthtml.hxx:376
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
#define OOO_STRING_SVTOOLS_HTML_O_align
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:83
#define OOO_STRING_SVTOOLS_HTML_division
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:216
#define OOO_STRING_SVTOOLS_HTML_linebreak
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
LanguageType GetLanguage() const
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:76
Writer & OutHTML_SwFormatField(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlfldw.cxx:438
FontWeight
#define RES_TXTATR_FIELD
Definition: hintids.hxx:150
SwCharFormat * GetCharFormat() const
Definition: fchrfmt.hxx:70
#define RES_TXTATR_AUTOFMT
Definition: hintids.hxx:140
#define OOO_STRING_SVTOOLS_HTML_AL_right
std::unique_ptr< SfxItemSet > pItemSet
Definition: htmlatr.cxx:209
std::deque< sal_Int32 > aScriptChgLst
Definition: htmlatr.cxx:1075
long const nLeftMargin
HTMLMODE_SOME_STYLES
STRIKEOUT_DOUBLE
void start(const OString &aElement)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define RES_DRAWFRMFMT
Definition: hintids.hxx:277
#define OOO_STRING_SVTOOLS_HTML_O_style
ITALIC_NORMAL
#define RES_CHRATR_CTL_LANGUAGE
Definition: hintids.hxx:97
void InsertItem(const SfxPoolItem &rItem, sal_Int32 nStart, sal_Int32 nEnd)
Definition: htmlatr.cxx:1452
OUString aClass
Definition: wrthtml.hxx:213
unsigned char sal_uInt8
const OUString & GetTargetFrame() const
Definition: fmtinfmt.hxx:89
#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 HTMLMODE_LSPACE_IN_NUMBUL
Definition: wrthtml.hxx:118
rtl::Reference< SwDoc > m_xTemplate
Definition: wrthtml.hxx:296
void OutForm(bool bTagOn=true, const SwStartNode *pStNd=nullptr)
Definition: htmlforw.cxx:236
#define OOO_STRING_SVTOOLS_HTML_O_target
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:259
#define CSS1_OUTMODE_WESTERN
Definition: wrthtml.hxx:178
#define RES_TXTATR_ANNOTATION
Definition: hintids.hxx:153
static Writer & OutHTML_SwPosture(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2663
static Writer & OutHTML_SwWeight(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2797
sal_Int32 GetIndex() const
Definition: index.hxx:95
static Writer & OutHTML_SwTextCharFormat(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:3092
bool IsCountedInList() const
Definition: ndtxt.cxx:4240
#define OOO_STRING_SVTOOLS_HTML_O_onclick
SwNodes & GetNodes()
Definition: doc.hxx:403
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
#define OOO_STRING_SVTOOLS_HTML_O_noshade
Writer & OutHTML_BulletImage(Writer &rWrt, const sal_Char *pTag, const SvxBrushItem *pBrush, const OUString &rGraphicURL)
const sal_Int32 * End() const
Definition: txatbase.hxx:142
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:386
sal_Int32 GetEnd() const
Definition: htmlatr.cxx:1048
#define OOO_STRING_SVTOOLS_HTML_parabreak
#define RES_PARATR_ADJUST
Definition: hintids.hxx:162
OString GetNamespace() const
Determines the prefix string needed to respect the requested namespace alias.
Definition: wrthtml.cxx:1461
static Writer & OutHTML_CSS1Attr(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2604
void OutHyperlinkHRefValue(const OUString &rURL)
Definition: wrthtml.cxx:1243
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:379
const SwFormat * pFormat
Definition: wrthtml.hxx:210
void OutEndAttrs(SwHTMLWriter &rHWrt, sal_Int32 nPos, HTMLOutContext *pContext)
Definition: htmlatr.cxx:1940
#define HTMLMODE_NBSP_IN_TABLES
Definition: wrthtml.hxx:117
#define OOO_STRING_SVTOOLS_HTML_image
SvStream & WriteChar(char nChar)
#define RES_TXTATR_FLYCNT
Definition: hintids.hxx:151
Format of a fly content.
Definition: fmtflcnt.hxx:32
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
bool m_bCfgPreferStyles
Definition: wrthtml.hxx:338
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:723
long GetRight() const
#define OOO_STRING_SVTOOLS_HTML_O_SDonmouseout
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:351
#define OOO_STRING_SVTOOLS_HTML_O_value
#define OOO_STRING_SVTOOLS_HTML_O_face
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter()
Definition: breakit.hxx:62
OUString GetNumString(const bool _bInclPrefixAndSuffixStrings=true, const unsigned int _nRestrictToThisLevel=MAXLEVEL, SwRootFrame const *pLayout=nullptr) const
Returns outline of numbering string.
Definition: ndtxt.cxx:3131
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:153
SwHTMLFormatInfos m_CharFormatInfos
Definition: wrthtml.hxx:285
void OutPointFieldmarks(const SwPosition &rPos)
Definition: wrthtml.cxx:1157
SvxEscapement
SvStream & Strm()
Definition: writer.cxx:221
#define RES_CHRATR_HIDDEN
Definition: hintids.hxx:105
#define RES_BOX
Definition: hintids.hxx:211
#define OOO_STRING_SVTOOLS_HTML_address
const sal_uInt16 * GetRanges() const
sal_uInt16 GetNumCols() const
Definition: fmtclds.hxx:114
#define OOO_STRING_SVTOOLS_HTML_O_color
std::vector< HTMLStartEndPos * > HTMLStartEndPositions
Definition: htmlatr.cxx:1059
SwFrameFormat * GetFrameFormat() const
Definition: fmtflcnt.hxx:45
#define RES_CHRATR_CROSSEDOUT
Definition: hintids.hxx:73
void SetStart(sal_Int32 nStt)
Definition: htmlatr.cxx:1045
static void GetEEAttrsFromDrwObj(SfxItemSet &rItemSet, const SdrObject *pObj)
bool IsTableNode() const
Definition: node.hxx:640
bool m_bTextAttr
Definition: wrthtml.hxx:355
static Writer & OutHTML_SwFlyCnt(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2888
#define RES_PARATR_DROP
Definition: hintids.hxx:168
HTMLEndPosLst(SwDoc *pDoc, SwDoc *pTemplate, boost::optional< Color > xDfltColor, bool bOutStyles, sal_uLong nHTMLMode, const OUString &rText, std::set< OUString > &rStyles)
Definition: htmlatr.cxx:1574
HTMLOutEvent const aAnchorEventTable[]
Definition: htmlatr.cxx:91
long const nBottomMargin
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
If SwFormatDrop is a Client, it is the CharFormat that describes the font for the DropCaps...
Definition: paratr.hxx:50
bool m_bCfgOutStyles
Definition: wrthtml.hxx:337
STRIKEOUT_NONE
long const nRightMargin
static Writer & OutHTML_SwUnderline(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:2868
HTMLOnOffState GetHTMLItemState(const SfxPoolItem &rItem)
Definition: htmlatr.cxx:1184
void OutAndSetDefList(sal_uInt16 nNewLvl)
Definition: htmlatr.cxx:126
Subgroup table.
Definition: poolfmt.hxx:341
#define RES_PAGEDESC
Definition: hintids.hxx:198
#define RES_BREAK
Definition: hintids.hxx:199
sal_Int32 indexOfDotLeaders(sal_uInt16 nPoolId, const OUString &rText)
Definition: wrthtml.cxx:1445
Writer & OutHTML_INetFormat(Writer &rWrt, const SwFormatINetFormat &rINetFormat, bool bOn)
Definition: htmlatr.cxx:2924
FontLineStyle
bool ExistsOnTagItem(sal_uInt16 nWhich, sal_Int32 nPos)
Definition: htmlatr.cxx:1333
static sal_uInt16 GetLangWhichIdFromScript(sal_uInt16 nScript)
Definition: wrthtml.cxx:1305
long GetTextLeft() const
#define OOO_STRING_SVTOOLS_HTML_dd
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_Int32 nPos
#define OOO_STRING_SVTOOLS_HTML_span
#define CSS1_OUTMODE_CTL
Definition: wrthtml.hxx:182
sal_uInt16 GetInWidth() const
DefTokenId const nToken
SwNumRule * GetNumRule()
Definition: htmlnum.hxx:69
const editeng::SvxBorderLine * GetBottom() const
#define OOO_STRING_SVTOOLS_HTML_anchor
FontStrikeout
#define OOO_STRING_SVTOOLS_HTML_O_SDonclick
#define OOO_STRING_SVTOOLS_HTML_O_width
AllHtmlFlags const aHTMLOutFrameAsCharTable[MAX_FRMTYPES][MAX_BROWSERS]
Definition: htmlflyt.cxx:409
sal_uInt16 Which() const
static Writer & OutHTML_SvxAdjust(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlatr.cxx:3162
void OutFootEndNoteSym(const SwFormatFootnote &rFormatFootnote, const OUString &rNum, sal_uInt16 nScript)
Definition: htmlftn.cxx:404
sal_uInt16 m_nCSS1Script
Definition: wrthtml.hxx:328
#define SAL_NEWLINE_STRING
#define OOO_STRING_SVTOOLS_HTML_deflist
sal_uInt32 GetHTMLMode() const
Definition: wrthtml.hxx:559
SwDoc * m_pDoc
Definition: shellio.hxx:404
OString aToken
Definition: wrthtml.hxx:212
HtmlTokenId m_nLastParaToken
Definition: wrthtml.hxx:307
bool m_bOutFlyFrame
Definition: wrthtml.hxx:362
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
bool HasHints() const
Definition: ndtxt.hxx:221
#define OOO_STRING_SVTOOLS_HTML_O_span
FontItalic
sal_uInt16 GetScriptAtPos(sal_Int32 nPos, sal_uInt16 nWeak)
Definition: htmlatr.cxx:1861
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1013
sal_uInt16 GetUpper() const
std::map< sal_uInt16, int > maStartedAttributes
Tracks which text portion attributes are currently open: a which id -> open count map...
Definition: wrthtml.hxx:404
sal_Int32 nLeftMargin
Definition: wrthtml.hxx:217
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
Base class of the Writer document model elements.
Definition: node.hxx:79
static const SwFormat * GetParentFormat(const SwFormat &rFormat, sal_uInt16 nDeep)
Definition: css1atr.cxx:980