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