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