LibreOffice Module sw (master)  1
wrthtml.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 <stdlib.h>
21 #include <hintids.hxx>
22 #include <comphelper/string.hxx>
23 #include <svl/urihelper.hxx>
24 #include <svl/languageoptions.hxx>
25 #include <rtl/tencinfo.h>
26 #include <sfx2/linkmgr.hxx>
27 #include <sfx2/docfile.hxx>
28 
29 #include <svtools/htmlcfg.hxx>
30 #include <svtools/htmltokn.h>
31 #include <svtools/htmlkywd.hxx>
32 #include <vcl/svapp.hxx>
34 #include <sfx2/frmhtmlw.hxx>
35 #include <svx/xoutbmp.hxx>
37 #include <sfx2/htmlmode.hxx>
38 #include <editeng/lrspitem.hxx>
39 #include <editeng/colritem.hxx>
40 #include <editeng/brushitem.hxx>
41 #include <editeng/langitem.hxx>
42 #include <svl/stritem.hxx>
43 #include <editeng/frmdiritem.hxx>
44 
45 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
46 #include <com/sun/star/document/XDocumentProperties.hpp>
47 #include <fmthdft.hxx>
48 #include <fmtfld.hxx>
49 #include <fmtpdsc.hxx>
50 #include <txatbase.hxx>
51 #include <frmatr.hxx>
52 #include <charfmt.hxx>
53 #include <docary.hxx>
54 #include <pam.hxx>
55 #include <doc.hxx>
56 #include <ndtxt.hxx>
57 #include <mdiexp.hxx>
58 #include <fltini.hxx>
59 #include <viewopt.hxx>
60 #include <IMark.hxx>
61 #include <poolfmt.hxx>
62 #include <pagedesc.hxx>
63 #include <section.hxx>
64 #include <swtable.hxx>
65 #include <fldbas.hxx>
66 #include <fmtclds.hxx>
67 #include <docsh.hxx>
68 #include "wrthtml.hxx"
69 #include "htmlnum.hxx"
70 #include "htmlfly.hxx"
71 #include <swmodule.hxx>
72 #include <strings.hrc>
73 #include <swerror.h>
74 #include <rtl/strbuf.hxx>
77 #include <IDocumentMarkAccess.hxx>
78 #include <xmloff/odffields.hxx>
79 #include <tools/urlobj.hxx>
80 #include <osl/file.hxx>
82 #include <unotools/tempfile.hxx>
84 
85 #define MAX_INDENT_LEVEL 20
86 
87 using namespace css;
88 
89 static char sIndentTabs[MAX_INDENT_LEVEL+2] =
90  "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
91 
92 SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL, const OUString& rFilterOptions )
93  : m_pNumRuleInfo(new SwHTMLNumRuleInfo)
94  , m_nHTMLMode(0)
95  , m_eCSS1Unit(FieldUnit::NONE)
96  , mxFormComps()
97  , m_pStartNdIdx(nullptr)
98  , m_pCurrPageDesc(nullptr)
99  , m_pFormatFootnote(nullptr)
100  , m_nWarn(0)
101  , m_nLastLFPos(0)
102  , m_nLastParaToken(HtmlTokenId::NONE)
103  , m_nBkmkTabPos(-1)
104  , m_nImgMapCnt(1)
105  , m_nFormCntrlCnt(0)
106  , m_nEndNote(0)
107  , m_nFootNote(0)
108  , m_nLeftMargin(0)
109  , m_nDfltLeftMargin(0)
110  , m_nDfltRightMargin(0)
111  , m_nFirstLineIndent(0)
112  , m_nDfltFirstLineIndent(0)
113  , m_nDfltTopMargin(0)
114  , m_nDfltBottomMargin(0)
115  , m_nIndentLvl(0)
116  , m_nWhishLineLen(0)
117  , m_nDefListLvl(0)
118  , m_nDefListMargin(0)
119  , m_nHeaderFooterSpace(0)
120  , m_nTextAttrsToIgnore(0)
121  , m_nExportMode(0)
122  , m_nCSS1OutMode(0)
123  , m_nCSS1Script(CSS1_OUTMODE_WESTERN)
124  , m_nDirection(SvxFrameDirection::Horizontal_LR_TB)
125  , m_eDestEnc(RTL_TEXTENCODING_MS_1252)
126  , m_eLang(LANGUAGE_DONTKNOW)
127  , m_bCfgOutStyles( false )
128  , m_bCfgPreferStyles( false )
129  , m_bCfgFormFeed( false )
130  , m_bCfgStarBasic( false )
131  , m_bCfgCpyLinkedGrfs( false )
132  , m_bFirstLine(true)
133  , m_bTagOn( false )
134  , m_bTextAttr( false )
135  , m_bOutOpts( false )
136  , m_bOutTable( false )
137  , m_bOutHeader( false )
138  , m_bOutFooter( false )
139  , m_bOutFlyFrame( false )
140  , m_bFirstCSS1Rule( false )
141  , m_bFirstCSS1Property( false )
142  , m_bCSS1IgnoreFirstPageDesc( false )
143  , m_bNoAlign( false )
144  , m_bClearLeft( false )
145  , m_bClearRight( false )
146  , m_bLFPossible( false )
147  , m_bPreserveForm( false )
148  , m_bCfgNetscape4( false )
149  , mbSkipImages(false)
150  , mbSkipHeaderFooter(false)
151  , mbEmbedImages(false)
152  , m_bCfgPrintLayout( false )
153  , m_bParaDotLeaders( false )
154 {
155  SetBaseURL(rBaseURL);
156 
157  if (rBaseURL.isEmpty())
158  {
159  // Paste: set base URL to a tempfile, so images are not lost.
160  mpTempBaseURL.reset(new utl::TempFile());
161  mpTempBaseURL->EnableKillingFile();
162  SetBaseURL(mpTempBaseURL->GetURL());
163  }
164 
165  SetupFilterOptions(rFilterOptions);
166 }
167 
169 {
170 }
171 
172 std::unique_ptr<SwHTMLNumRuleInfo> SwHTMLWriter::ReleaseNextNumInfo()
173 {
174  return std::move(m_pNextNumRuleInfo);
175 }
176 
178 {
179  const SfxItemSet* pSet = rMedium.GetItemSet();
180  if (pSet == nullptr)
181  return;
182 
183  const SfxPoolItem* pItem;
184  if (pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) != SfxItemState::SET)
185  return;
186 
187 
188  const OUString sFilterOptions = static_cast<const SfxStringItem*>(pItem)->GetValue();
189  SetupFilterOptions(sFilterOptions);
190 
191  comphelper::SequenceAsHashMap aStoreMap(rMedium.GetArgs());
192  auto it = aStoreMap.find("RTFOLEMimeType");
193  if (it == aStoreMap.end())
194  {
195  return;
196  }
197 
198  it->second >>= m_aRTFOLEMimeType;
199 }
200 
201 void SwHTMLWriter::SetupFilterOptions(const OUString& rFilterOptions)
202 {
203  if (rFilterOptions == "SkipImages")
204  {
205  mbSkipImages = true;
206  }
207  else if (rFilterOptions == "SkipHeaderFooter")
208  {
209  mbSkipHeaderFooter = true;
210  }
211  else if (rFilterOptions == "EmbedImages")
212  {
213  mbEmbedImages = true;
214  }
215 
216  const uno::Sequence<OUString> aOptionSeq = comphelper::string::convertCommaSeparated(rFilterOptions);
217  const OUString aXhtmlNsKey("xhtmlns=");
218  for (const auto& rOption : aOptionSeq)
219  {
220  if (rOption == "XHTML")
221  mbXHTML = true;
222  else if (rOption.startsWith(aXhtmlNsKey))
223  {
224  maNamespace = rOption.copy(aXhtmlNsKey.getLength()).toUtf8();
225  if (maNamespace == "reqif-xhtml")
226  {
227  mbReqIF = true;
228  // XHTML is always just a fragment inside ReqIF.
229  mbSkipHeaderFooter = true;
230  }
231  // XHTML namespace implies XHTML.
232  mbXHTML = true;
233  }
234  }
235 }
236 
238 {
239  // Intercept paste output if requested.
240  char* pPasteEnv = getenv("SW_DEBUG_HTML_PASTE_TO");
241  std::unique_ptr<SvStream> pPasteStream;
242  SvStream* pOldPasteStream = nullptr;
243  if (pPasteEnv)
244  {
245  OUString aPasteStr;
246  if (osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pPasteEnv), aPasteStr)
247  == osl::FileBase::E_None)
248  {
249  pPasteStream.reset(new SvFileStream(aPasteStr, StreamMode::WRITE));
250  pOldPasteStream = &Strm();
251  SetStream(pPasteStream.get());
252  }
253  }
254  comphelper::ScopeGuard g([this, pOldPasteStream] { this->SetStream(pOldPasteStream); });
255 
256  SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get();
257 
258  // font heights 1-7
259  m_aFontHeights[0] = rHtmlOptions.GetFontSize( 0 ) * 20;
260  m_aFontHeights[1] = rHtmlOptions.GetFontSize( 1 ) * 20;
261  m_aFontHeights[2] = rHtmlOptions.GetFontSize( 2 ) * 20;
262  m_aFontHeights[3] = rHtmlOptions.GetFontSize( 3 ) * 20;
263  m_aFontHeights[4] = rHtmlOptions.GetFontSize( 4 ) * 20;
264  m_aFontHeights[5] = rHtmlOptions.GetFontSize( 5 ) * 20;
265  m_aFontHeights[6] = rHtmlOptions.GetFontSize( 6 ) * 20;
266 
267  // output styles anyway
268  // (then also top and bottom paragraph spacing)
269  m_nExportMode = rHtmlOptions.GetExportMode();
270  m_nHTMLMode = GetHtmlMode(nullptr);
271 
274 
277 
280 
283 
286 
289 
291 
294 
297 
300 
302 
303  bool bWriteUTF8 = m_bWriteClipboardDoc;
304  m_eDestEnc = bWriteUTF8 ? RTL_TEXTENCODING_UTF8 : rHtmlOptions.GetTextEncoding();
305  const char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( m_eDestEnc );
306  m_eDestEnc = rtl_getTextEncodingFromMimeCharset( pCharSet );
307 
308  // Only for the MS-IE we favour the export of styles.
310 
311  m_bCfgStarBasic = rHtmlOptions.IsStarBasic();
312 
314  m_bCfgCpyLinkedGrfs = rHtmlOptions.IsSaveGraphicsLocal();
315 
316  m_bCfgPrintLayout = rHtmlOptions.IsPrintLayoutExtension();
317 
318  // get HTML template
319  bool bOldHTMLMode = false;
320  SwTextFormatColls::size_type nOldTextFormatCollCnt = 0;
321  SwCharFormats::size_type nOldCharFormatCnt = 0;
322 
323  OSL_ENSURE( !m_xTemplate.is(), "Where is the HTML template coming from?" );
324  m_xTemplate = static_cast<HTMLReader*>(ReadHTML)->GetTemplateDoc(*m_pDoc);
325  if( m_xTemplate.is() )
326  {
327  bOldHTMLMode = m_xTemplate->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE);
328  m_xTemplate->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, true);
329 
330  nOldTextFormatCollCnt = m_xTemplate->GetTextFormatColls()->size();
331  nOldCharFormatCnt = m_xTemplate->GetCharFormats()->size();
332  }
333 
334  if( m_bShowProgress )
335  ::StartProgress( STR_STATSTR_W4WWRITE, 0, m_pDoc->GetNodes().Count(),
336  m_pDoc->GetDocShell());
337 
338  m_xDfltColor.reset();
339  m_pFootEndNotes = nullptr;
340  m_pFormatFootnote = nullptr;
342  mxFormComps.clear();
343  m_nFormCntrlCnt = 0;
344  m_bPreserveForm = false;
345  m_bClearLeft = m_bClearRight = false;
346  m_bLFPossible = false;
347 
353  m_nIndentLvl = 0;
354  m_nWhishLineLen = 70;
355  m_nLastLFPos = 0;
356  m_nDefListLvl = 0;
357  m_nDefListMargin = ((m_xTemplate.is() && !m_bCfgOutStyles) ? m_xTemplate.get() : m_pDoc)
359  ->GetLRSpace().GetTextLeft();
362  m_nCSS1OutMode = 0;
364  switch( nScript )
365  {
366  case SvtScriptType::ASIAN:
368  break;
369  case SvtScriptType::COMPLEX:
371  break;
372  default:
374  break;
375  }
376  m_eLang = static_cast<const SvxLanguageItem&>(m_pDoc
378 
379  m_nFootNote = m_nEndNote = 0;
380 
382  GetNumInfo().Clear();
383  m_pNextNumRuleInfo = nullptr;
384 
385  OString aStartTags;
386 
387  // respect table and section at document beginning
388  {
389  SwTableNode * pTNd = m_pCurrentPam->GetNode().FindTableNode();
390  if( pTNd && m_bWriteAll )
391  {
392  // start with table node !!
393  m_pCurrentPam->GetPoint()->nNode = *pTNd;
394 
396  m_pCurrentPam->GetMark()->nNode = *pTNd->EndOfSectionNode();
397  }
398 
399  // first node (with can contain a page break)
400  m_pStartNdIdx = new SwNodeIndex( m_pCurrentPam->GetPoint()->nNode );
401 
402  SwSectionNode * pSNd = m_pCurrentPam->GetNode().FindSectionNode();
403  while( pSNd )
404  {
405  if( m_bWriteAll )
406  {
407  // start with section node !!
408  m_pCurrentPam->GetPoint()->nNode = *pSNd;
409  }
410  else
411  {
412  OSL_ENSURE( SectionType::FileLink != pSNd->GetSection().GetType(),
413  "Export linked areas at document beginning is not implemented" );
414 
415  // save only the tag of section
417  pSNd->GetSection().GetSectionName(), m_eDestEnc,
419 
420  aStartTags =
423  "=\"" + aName + "\">" +
424  aStartTags;
425  }
426  // FindSectionNode() on a SectionNode return the same!
427  pSNd = pSNd->StartOfSectionNode()->FindSectionNode();
428  }
429  }
430 
431  // create table of the floating frames, but only when the whole
432  // document is saved
433  m_pHTMLPosFlyFrames = nullptr;
435  m_nLastParaToken = HtmlTokenId::NONE;
436  GetControls();
438 
439  sal_uInt16 nHeaderAttrs = 0;
440  m_pCurrPageDesc = MakeHeader( nHeaderAttrs );
441 
442  m_bLFPossible = true;
443 
444  // output forms which contain only HiddenControls
445  OutHiddenForms();
446 
447  if( !aStartTags.isEmpty() )
448  Strm().WriteOString( aStartTags );
449 
450  const SfxPoolItem *pItem;
451  const SfxItemSet& rPageItemSet = m_pCurrPageDesc->GetMaster().GetAttrSet();
455  SfxItemState::SET == rPageItemSet.GetItemState( RES_HEADER, true, &pItem) )
456  {
457  const SwFrameFormat *pHeaderFormat =
458  static_cast<const SwFormatHeader *>(pItem)->GetHeaderFormat();
459  if( pHeaderFormat )
460  OutHTML_HeaderFooter( *this, *pHeaderFormat, true );
461  }
462 
463  m_nTextAttrsToIgnore = nHeaderAttrs;
466 
467  if( mxFormComps.is() )
468  OutForm( false, mxFormComps );
469 
470  if( m_pFootEndNotes )
471  OutFootEndNotes();
472 
475  SfxItemState::SET == rPageItemSet.GetItemState( RES_FOOTER, true, &pItem) )
476  {
477  const SwFrameFormat *pFooterFormat =
478  static_cast<const SwFormatFooter *>(pItem)->GetFooterFormat();
479  if( pFooterFormat )
480  OutHTML_HeaderFooter( *this, *pFooterFormat, false );
481  }
482 
483  if( m_bLFPossible )
484  OutNewLine();
485  if (!mbSkipHeaderFooter)
486  {
488  OutNewLine();
490  }
491  else if (mbReqIF)
492  // ReqIF: end xhtml.BlkStruct.class.
494 
495  // delete the table with floating frames
496  OSL_ENSURE( !m_pHTMLPosFlyFrames, "Were not all frames output?" );
497  m_pHTMLPosFlyFrames.reset();
498 
500 
501  m_CharFormatInfos.clear();
502  m_TextCollInfos.clear();
503  m_aImgMapNames.clear();
504  m_aImplicitMarks.clear();
505  m_aOutlineMarks.clear();
506  m_aOutlineMarkPoss.clear();
507  m_aNumRuleNames.clear();
508  m_aScriptParaStyles.clear();
509  m_aScriptTextStyles.clear();
510 
511  m_xDfltColor.reset();
512 
513  delete m_pStartNdIdx;
514  m_pStartNdIdx = nullptr;
515 
516  mxFormComps.clear();
517 
518  OSL_ENSURE( !m_pFootEndNotes,
519  "SwHTMLWriter::Write: Footnotes not deleted by OutFootEndNotes" );
520 
521  m_pCurrPageDesc = nullptr;
522 
524 
525  for(OUString & s : m_aBulletGrfs)
526  s.clear();
527 
529 
530  if( m_bShowProgress )
532 
533  if( m_xTemplate.is() )
534  {
535  // delete character and paragraph templates created during export
536  auto nTextFormatCollCnt = m_xTemplate->GetTextFormatColls()->size();
537  while( nTextFormatCollCnt > nOldTextFormatCollCnt )
538  m_xTemplate->DelTextFormatColl( --nTextFormatCollCnt );
539  OSL_ENSURE( m_xTemplate->GetTextFormatColls()->size() == nOldTextFormatCollCnt,
540  "wrong number of TextFormatColls deleted" );
541 
542  auto nCharFormatCnt = m_xTemplate->GetCharFormats()->size();
543  while( nCharFormatCnt > nOldCharFormatCnt )
544  m_xTemplate->DelCharFormat( --nCharFormatCnt );
545  OSL_ENSURE( m_xTemplate->GetCharFormats()->size() == nOldCharFormatCnt,
546  "wrong number of CharFormats deleted" );
547 
548  // restore HTML mode
549  m_xTemplate->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, bOldHTMLMode);
550 
551  m_xTemplate.clear();
552  }
553 
554  return m_nWarn;
555 }
556 
557 static const SwFormatCol *lcl_html_GetFormatCol( const SwSection& rSection,
558  const SwSectionFormat& rFormat )
559 {
560  const SwFormatCol *pCol = nullptr;
561 
562  const SfxPoolItem* pItem;
563  if( SectionType::FileLink != rSection.GetType() &&
564  SfxItemState::SET == rFormat.GetAttrSet().GetItemState(RES_COL,false,&pItem) &&
565  static_cast<const SwFormatCol *>(pItem)->GetNumCols() > 1 )
566  {
567  pCol = static_cast<const SwFormatCol *>(pItem);
568  }
569 
570  return pCol;
571 }
572 
573 static bool lcl_html_IsMultiColStart( const SwHTMLWriter& rHTMLWrt, sal_uLong nIndex )
574 {
575  bool bRet = false;
576  const SwSectionNode *pSectNd =
577  rHTMLWrt.m_pDoc->GetNodes()[nIndex]->GetSectionNode();
578  if( pSectNd )
579  {
580  const SwSection& rSection = pSectNd->GetSection();
581  const SwSectionFormat *pFormat = rSection.GetFormat();
582  if( pFormat && lcl_html_GetFormatCol( rSection, *pFormat ) )
583  bRet = true;
584  }
585 
586  return bRet;
587 }
588 
589 static bool lcl_html_IsMultiColEnd( const SwHTMLWriter& rHTMLWrt, sal_uLong nIndex )
590 {
591  bool bRet = false;
592  const SwEndNode *pEndNd = rHTMLWrt.m_pDoc->GetNodes()[nIndex]->GetEndNode();
593  if( pEndNd )
594  bRet = lcl_html_IsMultiColStart( rHTMLWrt,
595  pEndNd->StartOfSectionIndex() );
596 
597  return bRet;
598 }
599 
601  const SwSection& rSection,
602  const SwSectionFormat& rFormat,
603  const SwFormatCol *pCol,
604  bool bContinued=false )
605 {
606  OSL_ENSURE( pCol || !bContinued, "Continuation of DIV" );
607 
608  if( rHTMLWrt.m_bLFPossible )
609  rHTMLWrt.OutNewLine();
610 
611  OStringBuffer sOut;
612  sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_division);
613 
614  const OUString& rName = rSection.GetSectionName();
615  if( !rName.isEmpty() && !bContinued )
616  {
617  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_id "=\"");
618  rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() );
619  HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), rName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
620  sOut.append('\"');
621  }
622 
623  SvxFrameDirection nDir = rHTMLWrt.GetHTMLDirection( rFormat.GetAttrSet() );
624  rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() );
625  rHTMLWrt.OutDirection( nDir );
626 
627  if( SectionType::FileLink == rSection.GetType() )
628  {
629  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_href "=\"");
630  rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() );
631 
632  const OUString& aFName = rSection.GetLinkFileName();
633  sal_Int32 nIdx{ 0 };
634  OUString aURL( aFName.getToken(0, sfx2::cTokenSeparator, nIdx) );
635  OUString aFilter( aFName.getToken(0, sfx2::cTokenSeparator, nIdx) );
636  OUString aSection( aFName.getToken(0, sfx2::cTokenSeparator, nIdx) );
637 
638  OUString aEncURL( URIHelper::simpleNormalizedMakeRelative(rHTMLWrt.GetBaseURL(), aURL ) );
639  sal_Unicode cDelim = 255U;
640  bool bURLContainsDelim = (-1 != aEncURL.indexOf( cDelim ) );
641 
642  HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), aEncURL,
643  rHTMLWrt.m_eDestEnc,
644  &rHTMLWrt.m_aNonConvertableCharacters );
645  const char* const pDelim = "&#255;";
646  if( !aFilter.isEmpty() || !aSection.isEmpty() || bURLContainsDelim )
647  rHTMLWrt.Strm().WriteCharPtr( pDelim );
648  if( !aFilter.isEmpty() )
649  HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), aFilter, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
650  if( !aSection.isEmpty() || bURLContainsDelim )
651  rHTMLWrt.Strm().WriteCharPtr( pDelim );
652  if( !aSection.isEmpty() )
653  {
654  sal_Int32 nPos = aSection.indexOf( '%' );
655  while( nPos != -1 )
656  {
657  aSection = aSection.replaceAt(nPos, 1, "%25");
658  nPos = aSection.indexOf( '%', nPos+3 );
659  }
660  nPos = aSection.indexOf( cDelim );
661  while( nPos != -1 )
662  {
663  aSection = aSection.replaceAt(nPos, 1, "%FF" );
664  nPos = aSection.indexOf( cDelim, nPos+3 );
665  }
666  HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), aSection,
667  rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
668  }
669  sOut.append('\"');
670  }
671  else if( pCol )
672  {
673  // minimum gutter width
674  sal_uInt16 nGutter = pCol->GetGutterWidth( true );
675  if( nGutter!=USHRT_MAX )
676  {
677  if( nGutter && Application::GetDefaultDevice() )
678  {
679  nGutter = static_cast<sal_uInt16>(Application::GetDefaultDevice()
680  ->LogicToPixel( Size(nGutter, 0), MapMode(MapUnit::MapTwip) ).Width());
681  }
682  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_gutter "=\"" + OString::number(nGutter) + "\"");
683  }
684  }
685 
686  rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() );
687  if( rHTMLWrt.IsHTMLMode( rHTMLWrt.m_bCfgOutStyles ? HTMLMODE_ON : 0 ) )
688  rHTMLWrt.OutCSS1_SectionFormatOptions( rFormat, pCol );
689 
690  rHTMLWrt.Strm().WriteChar( '>' );
691 
692  rHTMLWrt.m_bLFPossible = true;
693  if( !rName.isEmpty() && !bContinued )
694  rHTMLWrt.OutImplicitMark( rName, "region" );
695 
696  rHTMLWrt.IncIndentLevel();
697 }
698 
699 static void lcl_html_OutSectionEndTag( SwHTMLWriter& rHTMLWrt )
700 {
701  rHTMLWrt.DecIndentLevel();
702  if( rHTMLWrt.m_bLFPossible )
703  rHTMLWrt.OutNewLine();
705  rHTMLWrt.m_bLFPossible = true;
706 }
707 
708 static Writer& OutHTML_Section( Writer& rWrt, const SwSectionNode& rSectNd )
709 {
710  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
711 
712  // End <PRE> and any <DL>, because a definition list's level may
713  // change inside the section.
714  rHTMLWrt.ChangeParaToken( HtmlTokenId::NONE );
715  rHTMLWrt.OutAndSetDefList( 0 );
716 
717  const SwSection& rSection = rSectNd.GetSection();
718  const SwSectionFormat *pFormat = rSection.GetFormat();
719  OSL_ENSURE( pFormat, "Section without a format?" );
720 
721  bool bStartTag = true;
722  bool bEndTag = true;
723  const SwSectionFormat *pSurrFormat = nullptr;
724  const SwSectionNode *pSurrSectNd = nullptr;
725  const SwSection *pSurrSection = nullptr;
726  const SwFormatCol *pSurrCol = nullptr;
727 
728  sal_uInt32 nSectSttIdx = rSectNd.GetIndex();
729  sal_uInt32 nSectEndIdx = rSectNd.EndOfSectionIndex();
730  const SwFormatCol *pCol = lcl_html_GetFormatCol( rSection, *pFormat );
731  if( pCol )
732  {
733  // If the next node is a columned section node, too, don't export
734  // an empty section.
735  if( lcl_html_IsMultiColStart( rHTMLWrt, nSectSttIdx+1 ) )
736  bStartTag = false;
737 
738  // The same applies if the section end with another columned section.
739  if( lcl_html_IsMultiColEnd( rHTMLWrt, nSectEndIdx-1 ) )
740  bEndTag = false;
741 
742  // is there a columned section around this one?
743  const SwStartNode *pSttNd = rSectNd.StartOfSectionNode();
744  if( pSttNd )
745  {
746  pSurrSectNd = pSttNd->FindSectionNode();
747  if( pSurrSectNd )
748  {
749  const SwStartNode *pBoxSttNd = pSttNd->FindTableBoxStartNode();
750  if( !pBoxSttNd ||
751  pBoxSttNd->GetIndex() < pSurrSectNd->GetIndex() )
752  {
753  pSurrSection = &pSurrSectNd->GetSection();
754  pSurrFormat = pSurrSection->GetFormat();
755  if( pSurrFormat )
756  pSurrCol = lcl_html_GetFormatCol( *pSurrSection,
757  *pSurrFormat );
758  }
759  }
760  }
761  }
762 
763  // The surrounding section must be closed before the current one is
764  // opened, except that it start immediately before the current one or
765  // another end immediately before the current one
766  if( pSurrCol && nSectSttIdx - pSurrSectNd->GetIndex() > 1 &&
767  !lcl_html_IsMultiColEnd( rHTMLWrt, nSectSttIdx-1 ) )
768  lcl_html_OutSectionEndTag( rHTMLWrt );
769 
770  if( bStartTag )
771  lcl_html_OutSectionStartTag( rHTMLWrt, rSection, *pFormat, pCol );
772 
773  {
774  HTMLSaveData aSaveData( rHTMLWrt,
775  rHTMLWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex()+1,
776  rSectNd.EndOfSectionIndex(),
777  false, pFormat );
778  rHTMLWrt.Out_SwDoc( rHTMLWrt.m_pCurrentPam.get() );
779  }
780 
781  rHTMLWrt.m_pCurrentPam->GetPoint()->nNode = *rSectNd.EndOfSectionNode();
782 
783  if( bEndTag )
784  lcl_html_OutSectionEndTag( rHTMLWrt );
785 
786  // The surrounding section must be started again, except that it ends
787  // immediately behind the current one.
788  if( pSurrCol &&
789  pSurrSectNd->EndOfSectionIndex() - nSectEndIdx > 1 &&
790  !lcl_html_IsMultiColStart( rHTMLWrt, nSectEndIdx+1 ) )
791  lcl_html_OutSectionStartTag( rHTMLWrt, *pSurrSection, *pSurrFormat,
792  pSurrCol, true );
793 
794  return rWrt;
795 }
796 
798 {
799  bool bSaveWriteAll = m_bWriteAll; // save
800 
801  // search next text::Bookmark position from text::Bookmark table
802  m_nBkmkTabPos = m_bWriteAll ? FindPos_Bkmk( *m_pCurrentPam->GetPoint() ) : -1;
803 
804  // output all areas of PaM's in the HTML file
805  do {
806  m_bWriteAll = bSaveWriteAll;
807  m_bFirstLine = true;
808 
809  // search for first on PaM created FlyFrame
810  // still missing:
811 
812  while( m_pCurrentPam->GetPoint()->nNode.GetIndex() < m_pCurrentPam->GetMark()->nNode.GetIndex() ||
813  (m_pCurrentPam->GetPoint()->nNode.GetIndex() == m_pCurrentPam->GetMark()->nNode.GetIndex() &&
814  m_pCurrentPam->GetPoint()->nContent.GetIndex() <= m_pCurrentPam->GetMark()->nContent.GetIndex()) )
815  {
816  SwNode& rNd = m_pCurrentPam->GetNode();
817 
818  OSL_ENSURE( !(rNd.IsGrfNode() || rNd.IsOLENode()),
819  "Unexpected Grf- or OLE-Node here" );
820  if( rNd.IsTextNode() )
821  {
822  SwTextNode* pTextNd = rNd.GetTextNode();
823 
824  if( !m_bFirstLine )
825  m_pCurrentPam->GetPoint()->nContent.Assign( pTextNd, 0 );
826 
827  OutHTML_SwTextNode( *this, *pTextNd );
828  }
829  else if( rNd.IsTableNode() )
830  {
831  OutHTML_SwTableNode( *this, *rNd.GetTableNode(), nullptr );
832  m_nBkmkTabPos = m_bWriteAll ? FindPos_Bkmk( *m_pCurrentPam->GetPoint() ) : -1;
833  }
834  else if( rNd.IsSectionNode() )
835  {
836  OutHTML_Section( *this, *rNd.GetSectionNode() );
837  m_nBkmkTabPos = m_bWriteAll ? FindPos_Bkmk( *m_pCurrentPam->GetPoint() ) : -1;
838  }
839  else if( &rNd == &m_pDoc->GetNodes().GetEndOfContent() )
840  break;
841 
842  ++m_pCurrentPam->GetPoint()->nNode; // move
843  sal_uInt32 nPos = m_pCurrentPam->GetPoint()->nNode.GetIndex();
844 
845  if( m_bShowProgress )
846  ::SetProgressState( nPos, m_pDoc->GetDocShell() ); // How far ?
847 
848  /* If only the selected area should be saved, so only the complete
849  * nodes should be saved, this means the first and n-th node
850  * partly, the 2nd till n-1 node complete. (complete means with
851  * all formats!)
852  */
853  m_bWriteAll = bSaveWriteAll ||
854  nPos != m_pCurrentPam->GetMark()->nNode.GetIndex();
855  m_bFirstLine = false;
856  m_bOutFooter = false; // after one node no footer anymore
857  }
858 
859  ChangeParaToken( HtmlTokenId::NONE ); // MIB 8.7.97: We're doing it here and not at the caller
860  OutAndSetDefList( 0 );
861 
862  } while( CopyNextPam( &pPam ) ); // until all PaM's processed
863 
864  m_bWriteAll = bSaveWriteAll; // reset to old values
865 }
866 
867 // write the StyleTable, general data, header/footer/footnotes
868 static void OutBodyColor( const char* pTag, const SwFormat *pFormat,
869  SwHTMLWriter& rHWrt )
870 {
871  const SwFormat *pRefFormat = nullptr;
872 
873  if( rHWrt.m_xTemplate.is() )
874  pRefFormat = SwHTMLWriter::GetTemplateFormat( pFormat->GetPoolFormatId(),
875  &rHWrt.m_xTemplate->getIDocumentStylePoolAccess() );
876 
877  const SvxColorItem *pColorItem = nullptr;
878 
879  const SfxItemSet& rItemSet = pFormat->GetAttrSet();
880  const SfxPoolItem *pRefItem = nullptr, *pItem = nullptr;
881  bool bItemSet = SfxItemState::SET == rItemSet.GetItemState( RES_CHRATR_COLOR,
882  true, &pItem);
883  bool bRefItemSet = pRefFormat &&
884  SfxItemState::SET == pRefFormat->GetAttrSet().GetItemState( RES_CHRATR_COLOR,
885  true, &pRefItem);
886  if( bItemSet )
887  {
888  // only when the item is set in the template of the current document
889  // or has a different value as the in HTML template, it will be set
890  const SvxColorItem *pCItem = static_cast<const SvxColorItem*>(pItem);
891 
892  if( !bRefItemSet )
893  {
894  pColorItem = pCItem;
895  }
896  else
897  {
898  Color aColor( pCItem->GetValue() );
899  if( COL_AUTO == aColor )
900  aColor = COL_BLACK;
901 
902  Color aRefColor( static_cast<const SvxColorItem*>(pRefItem)->GetValue() );
903  if( COL_AUTO == aRefColor )
904  aRefColor = COL_BLACK;
905 
906  if( !aColor.IsRGBEqual( aRefColor ) )
907  pColorItem = pCItem;
908  }
909  }
910  else if( bRefItemSet )
911  {
912  // The item was still set in the HTML template so we output the default
913  pColorItem = &rItemSet.GetPool()->GetDefaultItem( RES_CHRATR_COLOR );
914  }
915 
916  if( pColorItem )
917  {
918  OStringBuffer sOut;
919  sOut.append(OStringLiteral(" ") + pTag + "=");
920  rHWrt.Strm().WriteOString( sOut.makeStringAndClear() );
921  Color aColor( pColorItem->GetValue() );
922  if( COL_AUTO == aColor )
923  aColor = COL_BLACK;
924  HTMLOutFuncs::Out_Color( rHWrt.Strm(), aColor );
925  if( RES_POOLCOLL_STANDARD==pFormat->GetPoolFormatId() )
926  rHWrt.m_xDfltColor = aColor;
927  }
928 }
929 
931 {
932  sal_uLong nIdx = m_pCurrentPam->GetPoint()->nNode.GetIndex();
933  sal_uLong nEndIdx = m_pCurrentPam->GetMark()->nNode.GetIndex();
934 
935  SwTextNode *pTextNd = nullptr;
936  while( nIdx<=nEndIdx &&
937  nullptr==(pTextNd=m_pDoc->GetNodes()[nIdx]->GetTextNode()) )
938  nIdx++;
939 
940  OSL_ENSURE( pTextNd, "No Text-Node found" );
941  if( !pTextNd || !pTextNd->HasHints() )
942  return 0;
943 
944  sal_uInt16 nAttrs = 0;
945  const size_t nCntAttr = pTextNd->GetSwpHints().Count();
946  sal_Int32 nOldPos = 0;
947  for( size_t i=0; i<nCntAttr; ++i )
948  {
949  const SwTextAttr *pHt = pTextNd->GetSwpHints().Get(i);
950  if( !pHt->End() )
951  {
952  sal_Int32 nPos = pHt->GetStart();
953  if( nPos-nOldPos > 1
954  || ( pHt->Which() != RES_TXTATR_FIELD
955  && pHt->Which() != RES_TXTATR_ANNOTATION ) )
956  break;
957 
958  const SwFieldIds nFieldWhich =
959  static_cast<const SwFormatField&>(pHt->GetAttr()).GetField()->GetTyp()->Which();
960  if( SwFieldIds::Postit!=nFieldWhich &&
961  SwFieldIds::Script!=nFieldWhich )
962  break;
963 
964  OutNewLine();
965  OutHTML_SwFormatField( *this, pHt->GetAttr() );
966  nOldPos = nPos;
967  OSL_ENSURE( nAttrs<SAL_MAX_UINT16, "Too many attributes" );
968  nAttrs++;
969  }
970  }
971 
972  return nAttrs;
973 }
974 
975 const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
976 {
977  OStringBuffer sOut;
978  if (!mbSkipHeaderFooter)
979  {
980  if (mbXHTML)
982  else
984  HTMLOutFuncs::Out_AsciiTag( Strm(), sOut.makeStringAndClear().getStr() ); // No GetNamespace() here.
985 
986  // build prelude
987  OutNewLine();
989 
990  OutNewLine();
992 
993  IncIndentLevel(); // indent content of <HEAD>
994 
995  // DocumentInfo
996  OString sIndent = GetIndentString();
997 
998  uno::Reference<document::XDocumentProperties> xDocProps;
999  SwDocShell *pDocShell(m_pDoc->GetDocShell());
1000  if (pDocShell)
1001  {
1002  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1003  pDocShell->GetModel(), uno::UNO_QUERY_THROW);
1004  xDocProps.set(xDPS->getDocumentProperties());
1005  }
1006 
1007  // xDocProps may be null here (when copying)
1009  sIndent.getStr(), m_eDestEnc,
1011 
1012  // comments and meta-tags of first paragraph
1013  rHeaderAttrs = OutHeaderAttrs();
1014 
1016  }
1017 
1018  const SwPageDesc *pPageDesc = nullptr;
1019 
1020  // In none HTML documents the first set template will be exported
1021  // and if none is set the default template
1022  sal_uLong nNodeIdx = m_pCurrentPam->GetPoint()->nNode.GetIndex();
1023 
1024  while( nNodeIdx < m_pDoc->GetNodes().Count() )
1025  {
1026  SwNode *pNd = m_pDoc->GetNodes()[ nNodeIdx ];
1027  if( pNd->IsContentNode() )
1028  {
1029  pPageDesc = static_cast<const SwFormatPageDesc &>(pNd->GetContentNode()
1030  ->GetAttr(RES_PAGEDESC)).GetPageDesc();
1031  break;
1032  }
1033  else if( pNd->IsTableNode() )
1034  {
1035  pPageDesc = pNd->GetTableNode()->GetTable().GetFrameFormat()
1036  ->GetPageDesc().GetPageDesc();
1037  break;
1038  }
1039 
1040  nNodeIdx++;
1041  }
1042 
1043  if( !pPageDesc )
1044  pPageDesc = &m_pDoc->GetPageDesc( 0 );
1045 
1046  if (!mbSkipHeaderFooter)
1047  {
1048  // and now ... the style sheet!!!
1049  if( m_bCfgOutStyles )
1050  {
1051  OutStyleSheet( *pPageDesc );
1052  }
1053 
1054  // and now ... the BASIC and JavaScript!
1055  if( m_pDoc->GetDocShell() ) // BASIC is possible only in case we have a DocShell
1056  OutBasic(*this);
1057 
1058  DecIndentLevel(); // indent content of <HEAD>
1059  OutNewLine();
1061 
1062  // the body won't be indented, because then everything would be indented!
1063  OutNewLine();
1064  sOut.append("<" + GetNamespace() + OOO_STRING_SVTOOLS_HTML_body);
1065  Strm().WriteOString( sOut.makeStringAndClear() );
1066 
1067  // language
1068  OutLanguage( m_eLang );
1069 
1070  // output text colour, when it was set in the default template or was changed
1073  *this );
1074 
1075  // colour of (un)visited links
1078  *this );
1081  *this );
1082 
1083  const SfxItemSet& rItemSet = pPageDesc->GetMaster().GetAttrSet();
1084 
1085  // fdo#86857 page styles now contain the XATTR_*, not RES_BACKGROUND
1086  std::shared_ptr<SvxBrushItem> const aBrushItem(getSvxBrushItemFromSourceSet(rItemSet, RES_BACKGROUND));
1087  OutBackground(aBrushItem.get(), true);
1088 
1089  m_nDirection = GetHTMLDirection( rItemSet );
1090  OutDirection( m_nDirection );
1091 
1092  if( m_bCfgOutStyles )
1093  {
1094  OutCSS1_BodyTagStyleOpt( *this, rItemSet );
1095  }
1096  // append events
1097  if( m_pDoc->GetDocShell() ) // BASIC is possible only in case we have a DocShell
1099 
1100  Strm().WriteChar( '>' );
1101  }
1102  else if (mbReqIF)
1103  // ReqIF: start xhtml.BlkStruct.class.
1105 
1106  return pPageDesc;
1107 }
1108 
1109 void SwHTMLWriter::OutAnchor( const OUString& rName )
1110 {
1111  OStringBuffer sOut;
1112  sOut.append("<" + GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor " ");
1113  if (!mbXHTML)
1114  {
1115  sOut.append(OOO_STRING_SVTOOLS_HTML_O_name "=\"");
1116  Strm().WriteOString( sOut.makeStringAndClear() );
1118  }
1119  else
1120  {
1121  // XHTML wants 'id' instead of 'name', also the value can't contain
1122  // spaces.
1123  sOut.append(OOO_STRING_SVTOOLS_HTML_O_id "=\"");
1124  Strm().WriteOString( sOut.makeStringAndClear() );
1125  HTMLOutFuncs::Out_String( Strm(), rName.replace(' ', '_'), m_eDestEnc, &m_aNonConvertableCharacters ).WriteCharPtr( "\">" );
1126  }
1128 }
1129 
1131 {
1132  // fetch current bookmark
1133  const ::sw::mark::IMark* pBookmark = nullptr;
1134  IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess();
1135  if(m_nBkmkTabPos != -1)
1136  pBookmark = pMarkAccess->getAllMarksBegin()[m_nBkmkTabPos];
1137  // Output all bookmarks in this paragraph. The content position
1138  // for the moment isn't considered!
1139  sal_uInt32 nNode = m_pCurrentPam->GetPoint()->nNode.GetIndex();
1140  while( m_nBkmkTabPos != -1
1141  && pBookmark->GetMarkPos().nNode.GetIndex() == nNode )
1142  {
1143  // The area of bookmarks is first ignored, because it's not read.
1144 
1145  // first the SWG specific data:
1146  if ( dynamic_cast< const ::sw::mark::IBookmark* >(pBookmark) && !pBookmark->GetName().isEmpty() )
1147  {
1148  OutAnchor( pBookmark->GetName() );
1149  }
1150 
1151  if( ++m_nBkmkTabPos >= pMarkAccess->getAllMarksCount() )
1152  m_nBkmkTabPos = -1;
1153  else
1154  pBookmark = pMarkAccess->getAllMarksBegin()[m_nBkmkTabPos];
1155  }
1156 
1157  decltype(m_aOutlineMarkPoss)::size_type nPos;
1158  for( nPos = 0; nPos < m_aOutlineMarkPoss.size() &&
1159  m_aOutlineMarkPoss[nPos] < nNode; nPos++ )
1160  ;
1161 
1162  while( nPos < m_aOutlineMarkPoss.size() && m_aOutlineMarkPoss[nPos] == nNode )
1163  {
1164  OUString sMark( m_aOutlineMarks[nPos] );
1165  OutAnchor( sMark.replace('?', '_') ); // '?' causes problems in IE/Netscape 5
1166  m_aOutlineMarkPoss.erase( m_aOutlineMarkPoss.begin()+nPos );
1167  m_aOutlineMarks.erase( m_aOutlineMarks.begin() + nPos );
1168  }
1169 }
1170 
1172 {
1173  // "point" fieldmarks that occupy single character space, as opposed to
1174  // range fieldmarks that are associated with start and end points.
1175 
1176  const IDocumentMarkAccess* pMarkAccess = m_pDoc->getIDocumentMarkAccess();
1177  if (!pMarkAccess)
1178  return;
1179 
1180  const sw::mark::IFieldmark* pMark = pMarkAccess->getFieldmarkAt(rPos);
1181  if (!pMark)
1182  return;
1183 
1184  if (pMark->GetFieldname() == ODF_FORMCHECKBOX)
1185  {
1186  const sw::mark::ICheckboxFieldmark* pCheckBox =
1187  dynamic_cast<const sw::mark::ICheckboxFieldmark*>(pMark);
1188 
1189  if (pCheckBox)
1190  {
1191  OString aOut("<"
1193  " "
1195  "=\""
1197  "\"");
1198 
1199  if (pCheckBox->IsChecked())
1200  {
1201  aOut += " "
1203  "=\""
1205  "\"";
1206  }
1207 
1208  aOut += "/>";
1209  Strm().WriteOString(aOut);
1210  }
1211  }
1212 
1213  // TODO : Handle other single-point fieldmark types here (if any).
1214 }
1215 
1216 void SwHTMLWriter::OutImplicitMark( const OUString& rMark,
1217  const char *pMarkType )
1218 {
1219  if( !rMark.isEmpty() && !m_aImplicitMarks.empty() )
1220  {
1221  OUString sMark(rMark + OUStringChar(cMarkSeparator) + OUString::createFromAscii(pMarkType));
1222  if( 0 != m_aImplicitMarks.erase( sMark ) )
1223  {
1224  OutAnchor(sMark.replace('?', '_')); // '?' causes problems in IE/Netscape 5
1225  }
1226  }
1227 }
1228 
1229 OUString SwHTMLWriter::convertHyperlinkHRefValue(const OUString& rURL)
1230 {
1231  OUString sURL(rURL);
1232  sal_Int32 nPos = sURL.lastIndexOf(cMarkSeparator);
1233  if (nPos != -1)
1234  {
1235  OUString sCompare = sURL.copy(nPos + 1).replaceAll(" ", "");
1236  if (!sCompare.isEmpty())
1237  {
1238  sCompare = sCompare.toAsciiLowerCase();
1239  if( sCompare == "region" || sCompare == "frame" ||
1240  sCompare == "graphic" || sCompare == "ole" ||
1241  sCompare == "table" || sCompare == "outline" ||
1242  sCompare == "text" )
1243  {
1244  sURL = sURL.replace( '?', '_' ); // '?' causes problems in IE/Netscape 5
1245  }
1246  }
1247  }
1248  else if (!sURL.isEmpty() && sURL[0] != '#')
1249  {
1250  // Link is not started from "#", so looks like external link. Encode this URL.
1251  INetURLObject aURL(sURL);
1253  }
1255 }
1256 
1257 void SwHTMLWriter::OutHyperlinkHRefValue( const OUString& rURL )
1258 {
1259  OUString sURL = convertHyperlinkHRefValue(rURL);
1261 }
1262 
1263 void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic )
1264 {
1265  const Color &rBackColor = pBrushItem->GetColor();
1268  if( rBackColor != COL_TRANSPARENT )
1269  {
1270  OString sOut =
1272  Strm().WriteOString( sOut );
1273  HTMLOutFuncs::Out_Color( Strm(), rBackColor);
1274  }
1275 
1276  if( !bGraphic )
1277  return;
1278 
1279  OUString aGraphicInBase64;
1280  const Graphic* pGrf = pBrushItem->GetGraphic();
1281  OUString GraphicURL = pBrushItem->GetGraphicLink();
1282  if( mbEmbedImages || GraphicURL.isEmpty())
1283  {
1284  if( pGrf )
1285  {
1286  if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) )
1287  {
1289  }
1293  }
1294  }
1295  else
1296  {
1297  if( m_bCfgCpyLinkedGrfs )
1298  {
1299  CopyLocalFileToINet( GraphicURL );
1300  }
1301  OUString s( URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), GraphicURL));
1304  Strm().WriteCharPtr("\"");
1305 
1306  }
1307 }
1308 
1309 void SwHTMLWriter::OutBackground( const SfxItemSet& rItemSet, bool bGraphic )
1310 {
1311  const SfxPoolItem* pItem;
1312  if( SfxItemState::SET == rItemSet.GetItemState( RES_BACKGROUND, false,
1313  &pItem ))
1314  {
1315  OutBackground( static_cast<const SvxBrushItem*>(pItem), bGraphic );
1316  }
1317 }
1318 
1319 sal_uInt16 SwHTMLWriter::GetLangWhichIdFromScript( sal_uInt16 nScript )
1320 {
1321  sal_uInt16 nWhichId;
1322  switch( nScript )
1323  {
1324  case CSS1_OUTMODE_CJK:
1325  nWhichId = RES_CHRATR_CJK_LANGUAGE;
1326  break;
1327  case CSS1_OUTMODE_CTL:
1328  nWhichId = RES_CHRATR_CJK_LANGUAGE;
1329  break;
1330  default:
1331  nWhichId = RES_CHRATR_LANGUAGE;
1332  break;
1333  }
1334  return nWhichId;
1335 }
1336 
1338 {
1339  // ReqIF mode: consumers would ignore language anyway.
1340  if (LANGUAGE_DONTKNOW != nLang && !mbReqIF)
1341  {
1342  OStringBuffer sOut;
1343  sOut.append(' ');
1344  if (mbXHTML)
1345  sOut.append(OOO_STRING_SVTOOLS_XHTML_O_lang);
1346  else
1347  sOut.append(OOO_STRING_SVTOOLS_HTML_O_lang);
1348  sOut.append("=\"");
1349  Strm().WriteOString( sOut.makeStringAndClear() );
1352  }
1353 }
1354 
1356 {
1357  return GetHTMLDirection( rItemSet.Get( RES_FRAMEDIR ).GetValue() );
1358 }
1359 
1361 {
1362  switch( nDir )
1363  {
1364  case SvxFrameDirection::Vertical_LR_TB:
1365  nDir = SvxFrameDirection::Horizontal_LR_TB;
1366  break;
1367  case SvxFrameDirection::Vertical_RL_TB:
1368  nDir = SvxFrameDirection::Horizontal_RL_TB;
1369  break;
1370  case SvxFrameDirection::Environment:
1371  nDir = m_nDirection;
1372  break;
1373  default: break;
1374  }
1375 
1376  return nDir;
1377 }
1378 
1380 {
1381  OString sConverted = convertDirection(nDir);
1382  if (!sConverted.isEmpty())
1383  {
1384  OString sOut =
1386  "=\"" + sConverted + "\"";
1387  Strm().WriteOString( sOut );
1388  }
1389 }
1390 
1392 {
1393  OString sConverted;
1394  switch (nDir)
1395  {
1396  case SvxFrameDirection::Horizontal_LR_TB:
1397  case SvxFrameDirection::Vertical_LR_TB:
1398  sConverted = "ltr";
1399  break;
1400  case SvxFrameDirection::Horizontal_RL_TB:
1401  case SvxFrameDirection::Vertical_RL_TB:
1402  sConverted = "rtl";
1403  break;
1404  default: break;
1405  }
1406  return sConverted;
1407 }
1408 
1409 OString SwHTMLWriter::GetIndentString(sal_uInt16 nIncLvl)
1410 {
1411  OString sRet;
1412 
1413  // somewhat cumbersome, but we have only one indent string!
1414  sal_uInt16 nLevel = m_nIndentLvl + nIncLvl;
1415 
1416  if( nLevel && nLevel <= MAX_INDENT_LEVEL)
1417  {
1418  sIndentTabs[nLevel] = 0;
1419  sRet = sIndentTabs;
1420  sIndentTabs[nLevel] = '\t';
1421  }
1422 
1423  return sRet;
1424 }
1425 
1426 void SwHTMLWriter::OutNewLine( bool bCheck )
1427 {
1428  if( !bCheck || (Strm().Tell()-m_nLastLFPos) > m_nIndentLvl )
1429  {
1431  m_nLastLFPos = Strm().Tell();
1432  }
1433 
1435  {
1438  sIndentTabs[m_nIndentLvl] = '\t';
1439  }
1440 }
1441 
1442 sal_uInt16 SwHTMLWriter::GetHTMLFontSize( sal_uInt32 nHeight ) const
1443 {
1444  sal_uInt16 nSize = 1;
1445  for( sal_uInt16 i=6; i>0; i-- )
1446  {
1447  if( nHeight > (m_aFontHeights[i] + m_aFontHeights[i-1])/2 )
1448  {
1449  nSize = i+1;
1450  break;
1451  }
1452  }
1453 
1454  return nSize;
1455 }
1456 
1457 // Paragraphs with Table of Contents and other index styles will be typeset with
1458 // dot leaders at the position of the last tabulator in PrintLayout (CSS2) mode
1459 sal_Int32 SwHTMLWriter::indexOfDotLeaders( sal_uInt16 nPoolId, const OUString& rStr )
1460 {
1461  if (m_bCfgPrintLayout && ((nPoolId >= RES_POOLCOLL_TOX_CNTNT1 && nPoolId <= RES_POOLCOLL_TOX_CNTNT5) ||
1462  (nPoolId >= RES_POOLCOLL_TOX_IDX1 && nPoolId <= RES_POOLCOLL_TOX_IDX3) ||
1463  (nPoolId >= RES_POOLCOLL_TOX_USER1 && nPoolId <= RES_POOLCOLL_TOX_CNTNT10) ||
1464  nPoolId == RES_POOLCOLL_TOX_ILLUS1 || nPoolId == RES_POOLCOLL_TOX_TABLES1 ||
1465  nPoolId == RES_POOLCOLL_TOX_OBJECT1 ||
1466  (nPoolId >= RES_POOLCOLL_TOX_AUTHORITIES1 && nPoolId <= RES_POOLCOLL_TOX_USER10))) {
1467  sal_Int32 i = rStr.lastIndexOf('\t');
1468  // there are only ASCII (Latin-1) characters after the tabulator
1469  if (i > -1 && OUStringToOString(rStr.copy(i + 1), RTL_TEXTENCODING_ASCII_US).indexOf('?') == -1)
1470  return i;
1471  }
1472  return -1;
1473 }
1474 
1476 {
1477  if (maNamespace.isEmpty())
1478  return OString();
1479 
1480  return maNamespace + ":";
1481 }
1482 
1483 // Structure caches the current data of the writer to output a
1484 // other part of the document, like e.g. header/footer
1486  sal_uLong nEnd, bool bSaveNum,
1487  const SwFrameFormat *pFrameFormat)
1488  : rWrt(rWriter)
1489  , pOldPam(rWrt.m_pCurrentPam)
1490  , pOldEnd(rWrt.GetEndPaM())
1491  , nOldDefListLvl(rWrt.m_nDefListLvl)
1492  , nOldDirection(rWrt.m_nDirection)
1493  , bOldOutHeader(rWrt.m_bOutHeader)
1494  , bOldOutFooter(rWrt.m_bOutFooter)
1495  , bOldOutFlyFrame(rWrt.m_bOutFlyFrame)
1496 {
1498 
1500 
1501  // recognize table in special areas
1502  if( nStt != rWrt.m_pCurrentPam->GetMark()->nNode.GetIndex() )
1503  {
1504  const SwNode *pNd = rWrt.m_pDoc->GetNodes()[ nStt ];
1505  if( pNd->IsTableNode() || pNd->IsSectionNode() )
1506  rWrt.m_pCurrentPam->GetMark()->nNode = nStt;
1507  }
1508 
1509  rWrt.SetEndPaM( rWrt.m_pCurrentPam.get() );
1510  rWrt.m_pCurrentPam->Exchange( );
1511  rWrt.m_bWriteAll = true;
1512  rWrt.m_nDefListLvl = 0;
1513  rWrt.m_bOutHeader = rWrt.m_bOutFooter = false;
1514 
1515  // Maybe save the current numbering information, so that it can be started again.
1516  // Only then also the numbering information of the next paragraph will be valid.
1517  if( bSaveNum )
1518  {
1521  }
1522  else
1523  {
1525  }
1526 
1527  // The numbering will be in any case interrupted.
1528  rWrt.GetNumInfo().Clear();
1529 
1530  if( pFrameFormat )
1531  rWrt.m_nDirection = rWrt.GetHTMLDirection( pFrameFormat->GetAttrSet() );
1532 }
1533 
1535 {
1536  rWrt.m_pCurrentPam.reset(); // delete PaM again
1537 
1539  rWrt.SetEndPaM( pOldEnd );
1541  rWrt.m_nBkmkTabPos = bOldWriteAll ? rWrt.FindPos_Bkmk( *pOldPam->GetPoint() ) : -1;
1542  rWrt.m_nLastParaToken = HtmlTokenId::NONE;
1548 
1549  // Maybe continue the numbering from before section. The numbering
1550  // of the next paragraph will be invalid in any case.
1551  if( pOldNumRuleInfo )
1552  {
1554  pOldNumRuleInfo.reset();
1555  rWrt.SetNextNumInfo( std::move(pOldNextNumRuleInfo) );
1556  }
1557  else
1558  {
1559  rWrt.GetNumInfo().Clear();
1561  }
1562 }
1563 
1564 void GetHTMLWriter( const OUString& rFilterOptions, const OUString& rBaseURL, WriterRef& xRet )
1565 {
1566  xRet = new SwHTMLWriter( rBaseURL, rFilterOptions );
1567 }
1568 
1569 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:955
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
bool m_bCfgFormFeed
Definition: wrthtml.hxx:341
Starts a section of nodes in the document model.
Definition: node.hxx:303
bool m_bCfgCpyLinkedGrfs
Definition: wrthtml.hxx:343
std::unique_ptr< SwHTMLPosFlyFrames > m_pHTMLPosFlyFrames
Definition: wrthtml.hxx:258
void OutImplicitMark(const OUString &rMark, const char *pMarkType)
Definition: wrthtml.cxx:1216
URL aURL
sal_uLong GetIndex() const
Definition: node.hxx:282
FieldUnit
const OUString & GetBaseURL() const
Definition: shellio.hxx:445
SwHTMLNumRuleInfo & GetNumInfo()
Definition: wrthtml.hxx:527
#define RES_COL
Definition: hintids.hxx:309
sal_uLong Count() const
Definition: ndarr.hxx:142
virtual ::sw::mark::IFieldmark * getFieldmarkAt(const SwPosition &rPos) const =0
get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
bool mbXHTML
If XHTML markup should be written instead of HTML.
Definition: wrthtml.hxx:394
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
Marks a position in the document model.
Definition: pam.hxx:35
static void lcl_html_OutSectionEndTag(SwHTMLWriter &rHTMLWrt)
Definition: wrthtml.cxx:699
std::vector< OUString > m_aImgMapNames
Definition: wrthtml.hxx:279
bool m_bPreserveForm
Definition: wrthtml.hxx:383
HTMLControls m_aHTMLControls
Definition: wrthtml.hxx:286
void OutBasicBodyEvents()
Definition: htmlbas.cxx:307
bool IsSectionNode() const
Definition: node.hxx:644
#define RES_CHRATR_CJK_LANGUAGE
Definition: hintids.hxx:186
#define RES_HEADER
Definition: hintids.hxx:296
bool IsGrfNode() const
Definition: node.hxx:656
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars=nullptr)
sal_Int32 m_nDfltRightMargin
Definition: wrthtml.hxx:317
sal_uLong StartOfSectionIndex() const
Definition: node.hxx:673
SwPaM * pOldEnd
Definition: wrthtml.hxx:631
bool m_bClearLeft
Definition: wrthtml.hxx:377
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:62
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:172
static bool GraphicToBase64(const Graphic &rGraphic, OUString &rOUString, bool bAddPrefix=true, ConvertDataFormat aTargetFormat=ConvertDataFormat::Unknown)
#define OOO_STRING_SVTOOLS_HTML_IT_checkbox
SwDocShell * GetDocShell()
Definition: doc.hxx:1346
sal_uInt32 m_nLastLFPos
Definition: wrthtml.hxx:307
short m_nDfltFirstLineIndent
Definition: wrthtml.hxx:319
std::string GetValue
Writer & OutCSS1_BodyTagStyleOpt(Writer &rWrt, const SfxItemSet &rItemSet)
Definition: css1atr.cxx:1791
std::vector< OUString > m_aOutlineMarks
Definition: wrthtml.hxx:284
sal_uInt16 m_nTextAttrsToIgnore
Definition: wrthtml.hxx:327
#define OOO_STRING_SVTOOLS_HTML_O_bgcolor
sal_uInt16 m_nExportMode
Definition: wrthtml.hxx:328
bool m_bFirstLine
Definition: wrthtml.hxx:347
void Set(const SwHTMLNumRuleInfo &rInf)
Definition: htmlnum.hxx:93
#define HTMLMODE_BORDER_NONE
Definition: wrthtml.hxx:124
static OUString convertToBcp47(LanguageType nLangID)
LanguageType m_eLang
Definition: wrthtml.hxx:335
sal_uIntPtr sal_uLong
#define RES_FRAMEDIR
Definition: hintids.hxx:320
void OutBookmarks()
Definition: wrthtml.cxx:1130
const sal_Unicode cTokenSeparator
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:399
std::shared_ptr< SvxBrushItem > getSvxBrushItemFromSourceSet(const SfxItemSet &rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack)
SwHTMLWriter & rWrt
Definition: wrthtml.hxx:629
SwHTMLFormatInfos m_TextCollInfos
Definition: wrthtml.hxx:288
#define OOO_STRING_SVTOOLS_HTML_O_dir
Provides access to the marks of a document.
Objects all levels.
Definition: poolfmt.hxx:401
#define ODF_FORMCHECKBOX
void DecIndentLevel()
Definition: wrthtml.hxx:500
Content 1st level.
Definition: poolfmt.hxx:375
OUString m_aNonConvertableCharacters
Definition: wrthtml.hxx:293
#define OOO_STRING_SVTOOLS_HTML_body
#define OOO_STRING_SVTOOLS_HTML_O_gutter
void EndProgress(SwDocShell const *pDocShell)
Definition: mainwn.cxx:92
SvxFrameDirection
Writer & OutHTML_SwTextNode(Writer &rWrt, const SwContentNode &rNode)
Definition: htmlatr.cxx:2012
SwSectionFormat * GetFormat()
Definition: section.hxx:337
SvStream & WriteOString(const OString &rStr)
#define OOO_STRING_SVTOOLS_HTML_O_id
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1625
sal_Int32 m_nDefListMargin
Definition: wrthtml.hxx:325
sal_Int32 m_nLeftMargin
Definition: wrthtml.hxx:315
sal_uInt16 Which() const
Definition: txatbase.hxx:110
bool m_bFirstCSS1Property
Definition: wrthtml.hxx:369
#define OOO_STRING_SVTOOLS_HTML_O_background
OUString const & GetLinkFileName() const
Definition: section.cxx:544
Tables all levels.
Definition: poolfmt.hxx:405
SVL_DLLPUBLIC OUString simpleNormalizedMakeRelative(OUString const &baseUriReference, OUString const &uriReference)
bool m_bOutTable
Definition: wrthtml.hxx:361
SvStream & WriteCharPtr(const char *pBuf)
void OutHiddenForms()
Definition: htmlforw.cxx:338
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:201
OString maNamespace
XML namespace, in case of XHTML.
Definition: wrthtml.hxx:396
static SVT_DLLPUBLIC SvStream & Out_Color(SvStream &, const Color &, bool bXHTML=false)
const SwPageDesc * MakeHeader(sal_uInt16 &rHeaderAtrs)
Definition: wrthtml.cxx:975
#define CSS1_OUTMODE_CJK
Definition: wrthtml.hxx:180
#define HTMLMODE_LSPACE_IN_NUMBER_BULLET
Definition: wrthtml.hxx:118
Content 5th level.
Definition: poolfmt.hxx:379
o3tl::optional< Color > m_xDfltColor
Definition: wrthtml.hxx:299
ErrCode m_nWarn
Definition: wrthtml.hxx:306
static LanguageType nLang
Definition: srtdlg.cxx:60
#define OOO_STRING_SVTOOLS_HTML_O_text
void OutBackground(const SvxBrushItem *pBrushItem, bool bGraphic)
Definition: wrthtml.cxx:1263
const SwSection & GetSection() const
Definition: node.hxx:541
static OutputDevice * GetDefaultDevice()
void OutNewLine(bool bCheck=false)
Definition: wrthtml.cxx:1426
bool m_bWriteAll
Definition: shellio.hxx:412
#define OOO_STRING_SVTOOLS_XHTML_O_lang
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
#define OOO_STRING_SVTOOLS_HTML_O_link
#define MAX_INDENT_LEVEL
Definition: wrthtml.cxx:85
sal_uInt16 sal_Unicode
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
bool m_bLFPossible
Definition: wrthtml.hxx:379
static SVT_DLLPUBLIC SvStream & Out_AsciiTag(SvStream &, const OString &rStr, bool bOn=true)
sal_uInt16 const nOldDefListLvl
Definition: wrthtml.hxx:634
SwTableNode * GetTableNode()
Definition: node.hxx:599
bool mbReqIF
If the ReqIF subset of XHTML should be written.
Definition: wrthtml.hxx:398
bool m_bWriteOnlyFirstTable
Definition: shellio.hxx:415
void StartProgress(const char *pMessResId, long nStartValue, long nEndValue, SwDocShell *pDocShell)
Definition: mainwn.cxx:52
NONE
static void Out_DocInfo(SvStream &rStrm, const OUString &rBaseURL, const css::uno::Reference< css::document::XDocumentProperties > &, const char *pIndent, rtl_TextEncoding eDestEnc=RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars=nullptr)
#define HTMLMODE_FLY_MARGINS
Definition: wrthtml.hxx:123
#define OOO_STRING_SVTOOLS_HTML_O_href
#define SAL_MAX_UINT16
void SetupFilterOptions(const OUString &rFilterOptions)
Definition: wrthtml.cxx:201
#define OOO_STRING_SVTOOLS_HTML_O_lang
std::set< OUString > m_aNumRuleNames
Definition: wrthtml.hxx:281
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:425
#define WARN_SWG_POOR_LOAD
Definition: swerror.h:40
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:650
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
static const SwFormatCol * lcl_html_GetFormatCol(const SwSection &rSection, const SwSectionFormat &rFormat)
Definition: wrthtml.cxx:557
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
Reader * ReadHTML
Definition: fltini.cxx:48
#define HTMLMODE_NO_CONTROL_CENTERING
Definition: wrthtml.hxx:127
OString GetIndentString(sal_uInt16 nIncLvl=0)
Definition: wrthtml.cxx:1409
const SwTable & GetTable() const
Definition: node.hxx:497
std::unique_ptr< utl::TempFile > mpTempBaseURL
Temporary base URL for paste of images.
Definition: wrthtml.hxx:392
const Graphic * GetGraphic(OUString const &referer=OUString()) const
static void lcl_html_OutSectionStartTag(SwHTMLWriter &rHTMLWrt, const SwSection &rSection, const SwSectionFormat &rFormat, const SwFormatCol *pCol, bool bContinued=false)
Definition: wrthtml.cxx:600
bool mbSkipHeaderFooter
If HTML header and footer should be written as well, or just the content itself.
Definition: wrthtml.hxx:389
static SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
Authorities all levels.
Definition: poolfmt.hxx:409
#define HTML_CFG_WRITER
const sal_Unicode cDelim
bool m_bCfgPrintLayout
Definition: wrthtml.hxx:401
sal_uInt16 m_nFormCntrlCnt
Definition: wrthtml.hxx:312
bool IsHTMLMode(sal_uInt32 nMode) const
Definition: wrthtml.hxx:569
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:143
void SetProgressState(long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
#define HTMLMODE_FONT_GENERIC
Definition: wrthtml.hxx:125
void ChangeParaToken(HtmlTokenId nNew)
Definition: htmlatr.cxx:157
bool IsOLENode() const
Definition: node.hxx:652
void OutBasic(SwHTMLWriter &rHTMLWrt)
Definition: htmlbas.cxx:248
void SetBaseURL(const OUString &rURL)
Definition: shellio.hxx:400
Base class for various Writer styles.
Definition: format.hxx:43
static SvxHtmlOptions & Get()
#define OOO_STRING_SVTOOLS_HTML_O_data
std::unique_ptr< SwHTMLNumRuleInfo > pOldNumRuleInfo
Definition: wrthtml.hxx:632
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
std::set< OUString > m_aScriptTextStyles
Definition: wrthtml.hxx:283
#define RES_BACKGROUND
Definition: hintids.hxx:305
css::uno::Sequence< css::beans::PropertyValue > GetArgs() const
virtual const_iterator_t getAllMarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of marks.
const Color & GetColor() const
short m_nFirstLineIndent
Definition: wrthtml.hxx:318
bool m_bWriteClipboardDoc
Definition: shellio.hxx:414
#define RES_CHRATR_COLOR
Definition: hintids.hxx:165
bool IsContentNode() const
Definition: node.hxx:628
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool CopyNextPam(SwPaM **)
Definition: writer.cxx:162
SwPaM * m_pOrigPam
Definition: shellio.hxx:410
#define OOO_STRING_SVTOOLS_HTML_doctype
void OutLanguage(LanguageType eLang)
Definition: wrthtml.cxx:1337
#define OOO_STRING_SVTOOLS_HTML_html
virtual bool IsChecked() const =0
SvtScriptType
Style of a layout element.
Definition: frmfmt.hxx:57
FieldUnit m_eCSS1Unit
Definition: wrthtml.hxx:263
size_t Count() const
Definition: ndhints.hxx:142
bool m_bCfgStarBasic
Definition: wrthtml.hxx:342
rtl_TextEncoding m_eDestEnc
Definition: wrthtml.hxx:334
#define SW_MOD()
Definition: swmodule.hxx:256
sal_Int32 m_nWhishLineLen
Definition: wrthtml.hxx:323
SwTextAttr * Get(size_t nPos) const
Definition: ndhints.hxx:144
css::uno::Reference< css::container::XIndexContainer > mxFormComps
Definition: wrthtml.hxx:296
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
std::shared_ptr< SwUnoCursor > pOldPam
Definition: wrthtml.hxx:630
Internet visited.
Definition: poolfmt.hxx:122
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
const OUString & GetSectionName() const
Definition: section.hxx:169
#define HTMLMODE_FLOAT_FRAME
Definition: wrthtml.hxx:115
std::vector< SwTextFormatColl * >::size_type size_type
Definition: docary.hxx:70
sal_uInt16 m_nHeaderFooterSpace
Definition: wrthtml.hxx:326
Writer & OutHTML_SwTableNode(Writer &rWrt, SwTableNode &rNode, const SwFrameFormat *pFlyFrameFormat, const OUString *pCaption, bool bTopCaption)
Definition: htmltabw.cxx:864
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:878
#define OOO_STRING_SVTOOLS_HTML_O_vlink
Count
sal_uInt16 GetGutterWidth(bool bMin=false) const
Definition: atrfrm.cxx:894
int i
sal_uInt32 m_nHTMLMode
Definition: wrthtml.hxx:261
SwContentNode * GetContentNode()
Definition: node.hxx:615
SwFieldIds
Definition: fldbas.hxx:38
HTMLMODE_ON
void SetNextNumInfo(std::unique_ptr< SwHTMLNumRuleInfo > pNxt)
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:337
Internet normal.
Definition: poolfmt.hxx:121
static const SwFormat * GetTemplateFormat(sal_uInt16 nPoolId, IDocumentStylePoolAccess *pTemplate)
Definition: css1atr.cxx:966
sal_Int32 m_nBkmkTabPos
Definition: wrthtml.hxx:310
sal_uInt32 m_aFontHeights[7]
Definition: wrthtml.hxx:304
#define HTML_CFG_MSIE
void OutCSS1_SectionFormatOptions(const SwFrameFormat &rFrameFormat, const SwFormatCol *pCol)
Definition: css1atr.cxx:2116
#define OOO_STRING_SVTOOLS_HTML_O_name
bool m_bCSS1IgnoreFirstPageDesc
Definition: wrthtml.hxx:372
OUString m_aBulletGrfs[MAXLEVEL]
Definition: wrthtml.hxx:294
#define LANGUAGE_DONTKNOW
bool m_bCfgNetscape4
Definition: wrthtml.hxx:385
SfxItemSet * GetItemSet() const
#define HTMLMODE_PRINT_EXT
Definition: wrthtml.hxx:120
sal_uInt16 GetHTMLFontSize(sal_uInt32 nFontHeight) const
Definition: wrthtml.cxx:1442
void GetControls()
Definition: htmlforw.cxx:1309
sal_uInt16 m_nDfltBottomMargin
Definition: wrthtml.hxx:321
Marks a node in the document model.
Definition: ndindex.hxx:31
void GetHTMLWriter(const OUString &rFilterOptions, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrthtml.cxx:1564
bool mbEmbedImages
Definition: wrthtml.hxx:390
SwpHints & GetSwpHints()
getters for SwpHints
Definition: ndtxt.hxx:808
void SetStream(SvStream *const pStream)
Definition: writer.cxx:221
void OutStyleSheet(const SwPageDesc &rPageDesc)
Definition: css1atr.cxx:503
HTMLSaveData(SwHTMLWriter &, sal_uLong nStt, sal_uLong nEnd, bool bSaveNum=true, const SwFrameFormat *pFrameFormat=nullptr)
Definition: wrthtml.cxx:1485
bool bOldWriteAll
Definition: wrthtml.hxx:636
sal_uInt16 m_nEndNote
Definition: wrthtml.hxx:313
virtual ~SwHTMLWriter() override
Definition: wrthtml.cxx:168
SwNodeIndex * m_pStartNdIdx
Definition: wrthtml.hxx:300
bool m_bOutFooter
Definition: wrthtml.hxx:363
const sal_Unicode cMarkSeparator
Definition: swtypes.hxx:137
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
sal_uInt16 m_nIndentLvl
Definition: wrthtml.hxx:322
SfxItemPool * GetPool() const
ErrCode WriteStream() override
Definition: wrthtml.cxx:237
void Out_SwDoc(SwPaM *)
Definition: wrthtml.cxx:797
bool const bOldOutFlyFrame
Definition: wrthtml.hxx:639
Illustrations all levels.
Definition: poolfmt.hxx:397
const SwFormatFootnote * m_pFormatFootnote
Definition: wrthtml.hxx:302
static bool lcl_html_IsMultiColEnd(const SwHTMLWriter &rHTMLWrt, sal_uLong nIndex)
Definition: wrthtml.cxx:589
void ClearNextNumInfo()
HtmlTokenId
std::set< OUString > m_aScriptParaStyles
Definition: wrthtml.hxx:282
Point LogicToPixel(const Point &rLogicPt) const
OUString m_aRTFOLEMimeType
Definition: wrthtml.hxx:408
#define RES_FOOTER
Definition: hintids.hxx:297
static Writer & OutHTML_Section(Writer &rWrt, const SwSectionNode &rSectNd)
Definition: wrthtml.cxx:708
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
bool m_bClearRight
Definition: wrthtml.hxx:378
const OUString & GetGraphicLink() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
std::set< OUString > m_aImplicitMarks
Definition: wrthtml.hxx:280
#define OOO_STRING_SVTOOLS_HTML_division
sal_uInt16 m_nCSS1OutMode
Definition: wrthtml.hxx:329
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:217
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:677
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
Writer & OutHTML_SwFormatField(Writer &rWrt, const SfxPoolItem &rHt)
Definition: htmlfldw.cxx:443
#define RES_TXTATR_FIELD
Definition: hintids.hxx:244
bool m_bFirstCSS1Rule
Definition: wrthtml.hxx:368
bool const bOldOutHeader
Definition: wrthtml.hxx:637
static std::shared_ptr< SwUnoCursor > NewUnoCursor(SwDoc &rDoc, sal_uLong const nStartIdx, sal_uLong const nEndIdx)
Definition: writer.cxx:191
static SVT_DLLPUBLIC OString ConvertStringToHTML(const OUString &sSrc, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars)
#define HTMLMODE_ABS_POS_FLY
Definition: wrthtml.hxx:121
std::unique_ptr< std::vector< SwTextFootnote * > > m_pFootEndNotes
Definition: wrthtml.hxx:290
HTMLMODE_SOME_STYLES
virtual sal_Int32 getAllMarksCount() const =0
returns the number of marks.
iterator find(const OUString &rKey)
bool m_bOutHeader
Definition: wrthtml.hxx:362
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define ERRCODE_NONE
rtl::Reference< SwDoc > m_xTemplate
Definition: wrthtml.hxx:298
void OutForm(bool bTagOn=true, const SwStartNode *pStNd=nullptr)
Definition: htmlforw.cxx:225
#define HTML_CFG_NS40
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:253
void IncIndentLevel()
Definition: wrthtml.hxx:496
#define CSS1_OUTMODE_WESTERN
Definition: wrthtml.hxx:178
#define RES_TXTATR_ANNOTATION
Definition: hintids.hxx:247
void OutFootEndNotes()
Definition: htmlftn.cxx:300
void CollectFlyFrames()
OUString aName
#define OOO_STRING_SVTOOLS_HTML_doctype40
LanguageType GetAppLanguage()
Definition: init.cxx:729
#define OOO_STRING_SVTOOLS_XHTML_doctype11
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:175
SwNodes & GetNodes()
Definition: doc.hxx:403
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
#define HTMLMODE_BLOCK_SPACER
Definition: wrthtml.hxx:114
SvxFrameDirection GetHTMLDirection(SvxFrameDirection nDir) const
Definition: wrthtml.cxx:1360
const SwPageDesc * m_pCurrPageDesc
Definition: wrthtml.hxx:301
void SetEndPaM(SwPaM *pPam)
Definition: wrthtml.hxx:514
Content 10th level.
Definition: poolfmt.hxx:393
const sal_Int32 * End() const
Definition: txatbase.hxx:148
sal_uInt64 Tell() const
OString GetNamespace() const
Determines the prefix string needed to respect the requested namespace alias.
Definition: wrthtml.cxx:1475
void OutHyperlinkHRefValue(const OUString &rURL)
Definition: wrthtml.cxx:1257
std::unique_ptr< SwHTMLNumRuleInfo > pOldNextNumRuleInfo
Definition: wrthtml.hxx:633
Writer & OutHTML_HeaderFooter(Writer &rWrt, const SwFrameFormat &rFrameFormat, bool bHeader)
#define HTMLMODE_NBSP_IN_TABLES
Definition: wrthtml.hxx:117
sal_uInt16 m_nDfltTopMargin
Definition: wrthtml.hxx:320
SvStream & WriteChar(char nChar)
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
sal_uInt16 m_nFootNote
Definition: wrthtml.hxx:314
IDocumentStylePoolAccess & getIDocumentStylePoolAccess()
Definition: writer.cxx:138
static bool lcl_html_IsMultiColStart(const SwHTMLWriter &rHTMLWrt, sal_uLong nIndex)
Definition: wrthtml.cxx:573
static void OutBodyColor(const char *pTag, const SwFormat *pFormat, SwHTMLWriter &rHWrt)
Definition: wrthtml.cxx:868
sal_Int32 FindPos_Bkmk(const SwPosition &rPos) const
Definition: writer.cxx:181
bool m_bCfgPreferStyles
Definition: wrthtml.hxx:340
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:196
std::shared_ptr< SwUnoCursor > m_pCurrentPam
Definition: shellio.hxx:411
#define OOO_STRING_SVTOOLS_HTML_input
static char sIndentTabs[MAX_INDENT_LEVEL+2]
Definition: wrthtml.cxx:89
void OutAnchor(const OUString &rName)
Definition: wrthtml.cxx:1109
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:159
SwHTMLFormatInfos m_CharFormatInfos
Definition: wrthtml.hxx:287
void OutPointFieldmarks(const SwPosition &rPos)
Definition: wrthtml.cxx:1171
SvStream & Strm()
Definition: writer.cxx:215
#define OOO_STRING_SVTOOLS_HTML_O_type
#define OOO_STRING_SVTOOLS_HTML_O_checked
virtual OUString GetFieldname() const =0
HTMLMODE_FULL_STYLES
void CollectLinkTargets()
bool IsTableNode() const
Definition: node.hxx:640
std::unique_ptr< SwHTMLNumRuleInfo > ReleaseNextNumInfo()
Definition: wrthtml.cxx:172
SwSectionNode * GetSectionNode()
Definition: node.hxx:607
Ends a section of nodes in the document model.
Definition: node.hxx:333
#define OOO_STRING_SVTOOLS_HTML_head
SectionType GetType() const
Definition: section.hxx:171
bool const bOldOutFooter
Definition: wrthtml.hxx:638
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
bool m_bCfgOutStyles
Definition: wrthtml.hxx:339
SwHTMLWriter(const OUString &rBaseURL, const OUString &rFilterOptions="")
Construct an instance of SwHTMLWriter and optionally give it the filter options directly, which can also be set via SetupFilterOptions().
Definition: wrthtml.cxx:92
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:79
void OutDirection(SvxFrameDirection nDir)
Definition: wrthtml.cxx:1379
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
Definition: node.hxx:730
void OutAndSetDefList(sal_uInt16 nNewLvl)
Definition: htmlatr.cxx:119
std::unique_ptr< SwHTMLNumRuleInfo > m_pNextNumRuleInfo
Definition: wrthtml.hxx:260
#define RES_PAGEDESC
Definition: hintids.hxx:293
OUString convertHyperlinkHRefValue(const OUString &rURL)
Definition: wrthtml.cxx:1229
sal_Int32 indexOfDotLeaders(sal_uInt16 nPoolId, const OUString &rText)
Definition: wrthtml.cxx:1459
std::vector< sal_uInt32 > m_aOutlineMarkPoss
Definition: wrthtml.hxx:285
SvxFrameDirection m_nDirection
Definition: wrthtml.hxx:332
static sal_uInt16 GetLangWhichIdFromScript(sal_uInt16 nScript)
Definition: wrthtml.cxx:1319
long GetTextLeft() const
bool IsTextNode() const
Definition: node.hxx:636
#define CSS1_OUTMODE_CTL
Definition: wrthtml.hxx:182
bool mbSkipImages
Definition: wrthtml.hxx:387
static OString convertDirection(SvxFrameDirection nDirection)
Definition: wrthtml.cxx:1391
#define HTMLMODE_ABS_POS_DRAW
Definition: wrthtml.hxx:122
#define OOO_STRING_SVTOOLS_HTML_anchor
void OutFootEndNoteInfo()
Definition: htmlftn.cxx:515
SvxFrameDirection const nOldDirection
Definition: wrthtml.hxx:635
sal_uInt16 Which() const
sal_uInt16 m_nDefListLvl
Definition: wrthtml.hxx:324
sal_Int32 m_nDfltLeftMargin
Definition: wrthtml.hxx:316
OUString convertCommaSeparated(uno::Sequence< OUString > const &i_rSeq)
sal_uInt16 m_nCSS1Script
Definition: wrthtml.hxx:330
#define SAL_NEWLINE_STRING
SwDoc * m_pDoc
Definition: shellio.hxx:409
const Color & GetValue() const
sal_uInt16 nPos
HtmlTokenId m_nLastParaToken
Definition: wrthtml.hxx:309
bool m_bOutFlyFrame
Definition: wrthtml.hxx:364
bool CopyLocalFileToINet(OUString &rFileNm)
Definition: writer.cxx:300
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
bool HasHints() const
Definition: ndtxt.hxx:220
sal_uInt16 OutHeaderAttrs()
Definition: wrthtml.cxx:930
bool m_bShowProgress
Definition: shellio.hxx:413
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
Base class of the Writer document model elements.
Definition: node.hxx:79