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