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