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