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