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