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