24#include <config_java.h>
26#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
27#include <com/sun/star/document/XDocumentProperties.hpp>
28#include <com/sun/star/i18n/ScriptType.hpp>
29#include <com/sun/star/i18n/XBreakIterator.hpp>
32#include <rtl/ustrbuf.hxx>
33#include <svx/svxids.hrc>
34#if OSL_DEBUG_LEVEL > 0
116#include <officecfg/Office/Writer.hxx>
119#include <officecfg/Office/Common.hxx>
127#define FONTSIZE_MASK 7
129#define HTML_ESC_PROP 80
130#define HTML_ESC_SUPER DFLT_ESC_SUPER
131#define HTML_ESC_SUB DFLT_ESC_SUB
133#define HTML_SPTYPE_BLOCK 1
134#define HTML_SPTYPE_HORI 2
135#define HTML_SPTYPE_VERT 3
172 static constexpr OUStringLiteral sTemplateWithoutExt(
u"internal/html");
177 OUString sTemplate( sTemplateWithoutExt +
".oth" );
183 sTemplate = sTemplateWithoutExt +
".stw";
187 OSL_ENSURE(
false,
"The default HTML template cannot be found in the defined template directories!");
194 OSL_ENSURE(
m_pMedium,
"Where is the medium??" );
212 OSL_ENSURE(
m_pStream,
"HTML-Read without stream" );
239 if( SvParserState::Pending == eState )
241 else if( SvParserState::Accepted != eState )
243 const OUString sErr(OUString::number(
static_cast<sal_Int32
>(xParser->GetLineNr()))
244 +
"," + OUString::number(
static_cast<sal_Int32
>(xParser->GetLinePos())));
248 DialogMask::ButtonsOk | DialogMask::MessageError );
259 bool bNoHTMLComments,
260 const OUString& rNamespace )
262 m_aPathToFile(
std::move( aPath )),
263 m_sBaseURL(
std::move( aBaseURL )),
267 m_pActionViewShell( nullptr ),
268 m_pSttNdIdx( nullptr ),
269 m_pFormImpl( nullptr ),
270 m_pImageMap( nullptr ),
271 m_nBaseFontStMin( 0 ),
274 m_nFontStHeadStart( 0 ),
276 m_nMissingImgMaps( 0 ),
279 m_nContextStMin( 0 ),
280 m_nContextStAttrMin( 0 ),
281 m_nSelectEntryCnt( 0 ),
288 m_bDocInitialized( false ),
289 m_bSetModEnabled( false ),
290 m_bInFloatingFrame( false ),
292 m_bKeepUnknown( false ),
293 m_bCallNextToken( false ),
294 m_bIgnoreRawData( false ),
295 m_bLBEntrySelected ( false ),
296 m_bTAIgnoreNewPara ( false ),
297 m_bFixMarqueeWidth ( false ),
298 m_bNoParSpace( false ),
299 m_bInNoEmbed( false ),
301 m_bUpdateDocStat( false ),
302 m_bFixSelectWidth( false ),
303 m_bTextArea( false ),
305 m_bInFootEndNoteAnchor( false ),
306 m_bInFootEndNoteSymbol( false ),
307 m_bIgnoreHTMLComments( bNoHTMLComments ),
308 m_bRemoveHidden( false ),
309 m_bBodySeen( false ),
310 m_bReadingHeaderOrFooter( false ),
311 m_bNotifyMacroEventRead( false ),
312 m_isInTableStructure(false),
314 m_nFloatingFrames( 0 ),
316 m_pTempViewFrame(nullptr)
357 m_xDoc->SetDefault( aFontHeight );
359 m_xDoc->SetDefault( aFontHeightCJK );
361 m_xDoc->SetDefault( aFontHeightCTL );
378 SetSrcEncoding( RTL_TEXTENCODING_UTF8 );
386 SetEncodingByHTTPHeader( pHeaderAttrs );
388 m_pCSS1Parser->SetDfltEncoding( osl_getThreadTextEncoding() );
404 sal_Int32
nPos = nLastPos != -1 ? nLastPos : 0;
412 if( !sCmp.isEmpty() )
414 sCmp = sCmp.toAsciiLowerCase();
415 if( sCmp ==
"region" )
417 else if( sCmp ==
"table" )
419 else if( sCmp ==
"graphic" )
421 else if( sCmp ==
"outline" ||
440 if (!rNamespace.isEmpty())
442 SetNamespace(rNamespace);
444 if (rNamespace ==
"reqif-xhtml")
455 auto it = aLoadMap.
find(
"AllowedRTFOLEMimeTypes");
456 if (it == aLoadMap.
end())
461 uno::Sequence<OUString>
aTypes;
472 OSL_ENSURE(
m_aContexts.empty(),
"There are still contexts on the stack");
477 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
481 bool bAsync =
m_xDoc->IsInLoadAsynchron();
482 m_xDoc->SetInLoadAsynchron(
false );
489 if(
m_xDoc->GetDocShell() )
492 sal_uInt16 nLinkMode =
m_xDoc->getIDocumentSettingAccess().getLinkUpdateMode(
true );
493 if( nLinkMode !=
NEVER && bAsync &&
494 SfxObjectCreateMode::INTERNAL!=
m_xDoc->GetDocShell()->GetCreateMode() )
495 m_xDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks( nLinkMode ==
MANUAL,
false,
nullptr );
497 if (
m_xDoc->GetDocShell()->IsLoading() )
500 m_xDoc->GetDocShell()->LoadingFinished();
508 OSL_ENSURE(
m_aSetAttrTab.empty(),
"There are still attributes on the stack" );
519 OSL_ENSURE(!
m_xTable,
"It exists still an open table");
523 "SwHTMLParser::~SwHTMLParser: Here should not be Pending-Stack anymore" );
534 m_xDoc->GetDocShell()->GetMedium()->GetItemSet().ClearItem( SID_HIDDEN );
544 if( ( m_xDoc->GetDocShell() && m_xDoc->GetDocShell()->IsAbortingImport() )
545 || 1 == m_xDoc->getReferenceCount() )
548 eState = SvParserState::Error;
551 GetAsynchCallLink().Call(
nullptr);
562 m_xDoc->getIDocumentContentOperations().SplitNode( *pPos,
false );
565 m_xDoc->getIDocumentContentOperations().SplitNode( *pPos,
false );
567 SwPaM aInsertionRangePam( *pPos );
575 m_xDoc->getIDocumentRedlineAccess().SplitRedline( aInsertionRangePam );
619 OSL_ENSURE(!
m_nContinue,
"Continue in Continue - not supposed to happen");
625 OSL_ENSURE( SvParserState::Error!=eState,
626 "SwHTMLParser::Continue: already set an error" );
627 if(
m_xDoc->GetDocShell() &&
m_xDoc->GetDocShell()->IsAbortingImport() )
628 eState = SvParserState::Error;
639 eState = SvParserState::Pending;
641 m_xDoc->SetInLoadAsynchron(
true );
651 if(
m_xDoc->GetDocShell() )
656 m_xDoc->GetDocShell()->EnableSetModified(
false );
664 bool bModified =
m_xDoc->getIDocumentState().IsModified();
665 bool const bWasUndo =
m_xDoc->GetIDocumentUndoRedo().DoesUndo();
666 m_xDoc->GetIDocumentUndoRedo().DoUndo(
false);
671 if( SvParserState::Error == eState )
674 "SwHTMLParser::Continue: Pending-Stack without Token" );
678 "SwHTMLParser::Continue: There is again a Pending-Stack" );
688 bool bLFStripped =
false;
689 if( SvParserState::Pending != GetStatus() )
723 for (
int i = 0;
i < 2; ++
i)
727 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
750 if( pTextNode && pTextNode->
CanJoinNext( &aNxtIdx ))
752 const sal_Int32 nStt = pTextNode->
GetText().getLength();
759#if OSL_DEBUG_LEVEL > 0
762 "Pam.Bound1 is still in the node" );
764 "Pam.Bound2 is still in the node" );
770 pTextNode->
GetText().getLength() + nCntPos );
776 pTextNode->
GetText().getLength() + nCntPos );
781 if (pTextNode->
GetText().getLength())
790 if( SvParserState::Accepted == eState )
806 bool bHasFlysOrMarks =
832 m_xDoc->GetNodes().Delete( rDelNode );
836 else if(
nullptr != ( pCurrentNd =
m_xDoc->GetNodes()[ nNodeIdx ]->GetTextNode()) && !bHasFlysOrMarks )
844 else if (pCurrentNd->
GetText().isEmpty())
850 m_xDoc->GetNodes().Delete( rDelNode );
857 else if( !IsNewDoc() )
863 if( pTextNode && pTextNode->
CanJoinPrev( &aPrvIdx ) &&
889 if (!bFuzzing && IsNewDoc())
892 OSL_ENSURE(pDocShell,
"no SwDocShell");
894 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
895 pDocShell->
GetModel(), uno::UNO_QUERY_THROW);
896 uno::Reference<document::XDocumentProperties> xDocProps(
897 xDPS->getDocumentProperties());
898 OSL_ENSURE(xDocProps.is(),
"DocumentProperties is null");
899 if ( xDocProps.is() && (xDocProps->getAutoloadSecs() > 0) &&
900 (xDocProps->getAutoloadURL().isEmpty()) )
909 m_xDoc->getIDocumentStatistics().UpdateDocStat(
false,
true );
913 if( SvParserState::Pending != GetStatus() )
921 if( 1 <
m_xDoc->getReferenceCount() )
925 m_xDoc->GetIDocumentUndoRedo().DelAllUndoObj();
926 m_xDoc->GetIDocumentUndoRedo().DoUndo(
true);
937 m_xDoc->GetIDocumentUndoRedo().DoUndo(
true);
941 m_xDoc->SetOle2Link( aOLELink );
943 m_xDoc->getIDocumentState().ResetModified();
946 m_xDoc->GetDocShell()->EnableSetModified();
963 if(rHint.
GetId() == SfxHintId::Dying)
981 m_xDoc->GetIDocumentUndoRedo().DoUndo(
false);
991 if( (
m_xDoc->GetDocShell() &&
m_xDoc->GetDocShell()->IsAbortingImport() )
992 || 1 ==
m_xDoc->getReferenceCount() )
996 eState = SvParserState::Error;
998 "SwHTMLParser::NextToken: Pending-Stack without token" );
1003#if OSL_DEBUG_LEVEL > 0
1009 case HtmlTokenId::TABLE_ON:
1012 case HtmlTokenId::LINK:
1014 case HtmlTokenId::INPUT:
1015 case HtmlTokenId::TEXTAREA_ON:
1016 case HtmlTokenId::SELECT_ON:
1017 case HtmlTokenId::SELECT_OFF:
1020 OSL_ENSURE(
m_vPendingStack.empty(),
"Unknown token for Pending-Stack" );
1035 case HtmlTokenId::TITLE_OFF:
1037 OUString sTitle =
m_sTitle.makeStringAndClear();
1038 if( IsNewDoc() && !sTitle.isEmpty() )
1040 if(
m_xDoc->GetDocShell() ) {
1041 uno::Reference<document::XDocumentPropertiesSupplier>
1042 xDPS(
m_xDoc->GetDocShell()->GetModel(),
1043 uno::UNO_QUERY_THROW);
1044 uno::Reference<document::XDocumentProperties> xDocProps(
1045 xDPS->getDocumentProperties());
1046 OSL_ENSURE(xDocProps.is(),
"no DocumentProperties");
1047 if (xDocProps.is()) {
1048 xDocProps->setTitle(sTitle);
1051 m_xDoc->GetDocShell()->SetTitle(sTitle);
1058 case HtmlTokenId::NONBREAKSPACE:
1062 case HtmlTokenId::SOFTHYPH:
1066 case HtmlTokenId::TEXTTOKEN:
1075 if( !aToken.isEmpty() )
1094 bool bGetIDOption =
false, bInsertUnknown =
false;
1106 if( HtmlTokenId::IFRAME_OFF ==
nToken )
1118 case HtmlTokenId::NOEMBED_OFF:
1126 case HtmlTokenId::RAWDATA:
1131 OSL_ENSURE(
false,
"SwHTMLParser::NextToken: invalid tag" );
1145 case HtmlTokenId::APPLET_OFF:
1149 case HtmlTokenId::OBJECT_OFF:
1153 case HtmlTokenId::PARAM:
1168 case HtmlTokenId::TEXTAREA_OFF:
1185 case HtmlTokenId::SELECT_OFF:
1190 case HtmlTokenId::OPTION:
1194 case HtmlTokenId::TEXTTOKEN:
1198 case HtmlTokenId::INPUT:
1199 case HtmlTokenId::SCRIPT_ON:
1200 case HtmlTokenId::SCRIPT_OFF:
1201 case HtmlTokenId::NOSCRIPT_ON:
1202 case HtmlTokenId::NOSCRIPT_OFF:
1203 case HtmlTokenId::RAWDATA:
1219 case HtmlTokenId::MARQUEE_OFF:
1224 case HtmlTokenId::TEXTTOKEN:
1236 case HtmlTokenId::SDFIELD_OFF:
1241 case HtmlTokenId::TEXTTOKEN:
1253 case HtmlTokenId::ANCHOR_OFF:
1258 case HtmlTokenId::TEXTTOKEN:
1269 if (!aToken.isEmpty() && !IsInHeader() )
1273 m_xDoc->getIDocumentContentOperations().InsertString( *
m_pPam, aToken.toString());
1287 case HtmlTokenId::UNKNOWNCONTROL_OFF:
1291 case HtmlTokenId::FRAMESET_ON:
1292 case HtmlTokenId::HEAD_OFF:
1293 case HtmlTokenId::BODY_ON:
1294 case HtmlTokenId::IMAGE:
1297 case HtmlTokenId::TEXTTOKEN:
1308 case HtmlTokenId::BODY_ON:
1336 case HtmlTokenId::LINK:
1340 case HtmlTokenId::BASE:
1343 for (
size_t i = rHTMLOptions.size();
i; )
1348 case HtmlOptionId::HREF:
1351 case HtmlOptionId::TARGET:
1355 OSL_ENSURE(pDocShell,
"no SwDocShell");
1357 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1358 pDocShell->
GetModel(), uno::UNO_QUERY_THROW);
1359 uno::Reference<document::XDocumentProperties>
1360 xDocProps(xDPS->getDocumentProperties());
1361 OSL_ENSURE(xDocProps.is(),
"no DocumentProperties");
1362 if (xDocProps.is()) {
1363 xDocProps->setDefaultTarget(
1375 case HtmlTokenId::META:
1385 OSL_ENSURE(pDocShell,
"no SwDocShell");
1388 uno::Reference<document::XDocumentProperties> xDocProps;
1391 const uno::Reference<document::XDocumentPropertiesSupplier>
1392 xDPS( pDocShell->
GetModel(), uno::UNO_QUERY_THROW );
1393 xDocProps = xDPS->getDocumentProperties();
1394 OSL_ENSURE(xDocProps.is(),
"DocumentProperties is null");
1401 case HtmlTokenId::TITLE_ON:
1405 case HtmlTokenId::SCRIPT_ON:
1409 case HtmlTokenId::SCRIPT_OFF:
1413 case HtmlTokenId::NOSCRIPT_ON:
1414 case HtmlTokenId::NOSCRIPT_OFF:
1415 bInsertUnknown =
true;
1418 case HtmlTokenId::STYLE_ON:
1422 case HtmlTokenId::STYLE_OFF:
1426 case HtmlTokenId::RAWDATA:
1429 if( IsReadScript() )
1433 else if( IsReadStyle() )
1442 case HtmlTokenId::OBJECT_ON:
1449#if HAVE_FEATURE_JAVA
1455 case HtmlTokenId::OBJECT_OFF:
1460 case HtmlTokenId::APPLET_ON:
1461#if HAVE_FEATURE_JAVA
1467 case HtmlTokenId::IFRAME_ON:
1469 SAL_WARN(
"sw.html",
"Not importing any more FloatingFrames for fuzzing performance");
1477 case HtmlTokenId::LINEBREAK:
1484 bGetIDOption =
true;
1488 case HtmlTokenId::NEWPARA:
1491 if( HtmlTokenId::NEWPARA==
nToken ||
1504 case HtmlTokenId::NONBREAKSPACE:
1508 case HtmlTokenId::SOFTHYPH:
1512 case HtmlTokenId::LINEFEEDCHAR:
1522 case HtmlTokenId::TEXTTOKEN:
1523 case HtmlTokenId::CDATA:
1525 if( !aToken.isEmpty() &&
' '==aToken[0] && !IsReadPRE() )
1531 const OUString& rText = pTextNode->
GetText();
1533 if(
' ' == cLast ||
'\x0a' == cLast)
1534 aToken.remove(0, 1);
1537 aToken.remove(0, 1);
1539 if( aToken.isEmpty() )
1546 if( !aToken.isEmpty() )
1573 m_xDoc->getIDocumentContentOperations().InsertString( *
m_pPam, aToken.toString());
1584 case HtmlTokenId::HORZRULE:
1588 case HtmlTokenId::IMAGE:
1592 if( 1 ==
m_xDoc->getReferenceCount() )
1594 eState = SvParserState::Error;
1598 case HtmlTokenId::SPACER:
1602 case HtmlTokenId::EMBED:
1606 case HtmlTokenId::NOEMBED_ON:
1612 case HtmlTokenId::DEFLIST_ON:
1617 case HtmlTokenId::DEFLIST_OFF:
1624 case HtmlTokenId::DD_ON:
1625 case HtmlTokenId::DT_ON:
1632 case HtmlTokenId::DD_OFF:
1633 case HtmlTokenId::DT_OFF:
1641 case HtmlTokenId::DIVISION_ON:
1642 case HtmlTokenId::CENTER_ON:
1656 case HtmlTokenId::DIVISION_OFF:
1657 case HtmlTokenId::CENTER_OFF:
1671 case HtmlTokenId::MULTICOL_ON:
1677 case HtmlTokenId::MULTICOL_OFF:
1680 EndTag( HtmlTokenId::MULTICOL_ON );
1683 case HtmlTokenId::MARQUEE_ON:
1688 case HtmlTokenId::FORM_ON:
1691 case HtmlTokenId::FORM_OFF:
1696 case HtmlTokenId::PARABREAK_ON:
1702 case HtmlTokenId::PARABREAK_OFF:
1706 case HtmlTokenId::ADDRESS_ON:
1712 case HtmlTokenId::ADDRESS_OFF:
1718 case HtmlTokenId::BLOCKQUOTE_ON:
1719 case HtmlTokenId::BLOCKQUOTE30_ON:
1725 case HtmlTokenId::BLOCKQUOTE_OFF:
1726 case HtmlTokenId::BLOCKQUOTE30_OFF:
1732 case HtmlTokenId::PREFORMTXT_ON:
1733 case HtmlTokenId::LISTING_ON:
1734 case HtmlTokenId::XMP_ON:
1740 case HtmlTokenId::PREFORMTXT_OFF:
1745 case HtmlTokenId::LISTING_OFF:
1746 case HtmlTokenId::XMP_OFF:
1750 case HtmlTokenId::HEAD1_ON:
1751 case HtmlTokenId::HEAD2_ON:
1752 case HtmlTokenId::HEAD3_ON:
1753 case HtmlTokenId::HEAD4_ON:
1754 case HtmlTokenId::HEAD5_ON:
1755 case HtmlTokenId::HEAD6_ON:
1766 case HtmlTokenId::HEAD1_OFF:
1767 case HtmlTokenId::HEAD2_OFF:
1768 case HtmlTokenId::HEAD3_OFF:
1769 case HtmlTokenId::HEAD4_OFF:
1770 case HtmlTokenId::HEAD5_OFF:
1771 case HtmlTokenId::HEAD6_OFF:
1775 case HtmlTokenId::TABLE_ON:
1782 OSL_ENSURE(!
m_xTable,
"table in table not allowed here");
1785 m_xDoc->GetNodes().GetEndOfExtras().GetIndex() ||
1803 case HtmlTokenId::DIRLIST_ON:
1804 case HtmlTokenId::MENULIST_ON:
1805 case HtmlTokenId::ORDERLIST_ON:
1806 case HtmlTokenId::UNORDERLIST_ON:
1812 case HtmlTokenId::DIRLIST_OFF:
1813 case HtmlTokenId::MENULIST_OFF:
1814 case HtmlTokenId::ORDERLIST_OFF:
1815 case HtmlTokenId::UNORDERLIST_OFF:
1822 case HtmlTokenId::LI_ON:
1823 case HtmlTokenId::LISTHEADER_ON:
1834 SAL_WARN(
"sw.html",
"skipping remaining bullet import for performance during fuzzing");
1845 case HtmlTokenId::LI_OFF:
1846 case HtmlTokenId::LISTHEADER_OFF:
1851 case HtmlTokenId::ITALIC_ON:
1863 case HtmlTokenId::BOLD_ON:
1875 case HtmlTokenId::STRIKE_ON:
1876 case HtmlTokenId::STRIKETHROUGH_ON:
1883 case HtmlTokenId::UNDERLINE_ON:
1890 case HtmlTokenId::SUPERSCRIPT_ON:
1897 case HtmlTokenId::SUBSCRIPT_ON:
1904 case HtmlTokenId::BLINK_ON:
1911 case HtmlTokenId::SPAN_ON:
1915 case HtmlTokenId::ITALIC_OFF:
1916 case HtmlTokenId::BOLD_OFF:
1917 case HtmlTokenId::STRIKE_OFF:
1918 case HtmlTokenId::UNDERLINE_OFF:
1919 case HtmlTokenId::SUPERSCRIPT_OFF:
1920 case HtmlTokenId::SUBSCRIPT_OFF:
1921 case HtmlTokenId::BLINK_OFF:
1922 case HtmlTokenId::SPAN_OFF:
1926 case HtmlTokenId::STRIKETHROUGH_OFF:
1927 EndTag( HtmlTokenId::STRIKE_OFF );
1930 case HtmlTokenId::BASEFONT_ON:
1933 case HtmlTokenId::BASEFONT_OFF:
1936 case HtmlTokenId::FONT_ON:
1937 case HtmlTokenId::BIGPRINT_ON:
1938 case HtmlTokenId::SMALLPRINT_ON:
1941 case HtmlTokenId::FONT_OFF:
1942 case HtmlTokenId::BIGPRINT_OFF:
1943 case HtmlTokenId::SMALLPRINT_OFF:
1947 case HtmlTokenId::EMPHASIS_ON:
1948 case HtmlTokenId::CITATION_ON:
1949 case HtmlTokenId::STRONG_ON:
1950 case HtmlTokenId::CODE_ON:
1951 case HtmlTokenId::SAMPLE_ON:
1952 case HtmlTokenId::KEYBOARD_ON:
1953 case HtmlTokenId::VARIABLE_ON:
1954 case HtmlTokenId::DEFINSTANCE_ON:
1955 case HtmlTokenId::SHORTQUOTE_ON:
1956 case HtmlTokenId::LANGUAGE_ON:
1957 case HtmlTokenId::AUTHOR_ON:
1958 case HtmlTokenId::PERSON_ON:
1959 case HtmlTokenId::ACRONYM_ON:
1960 case HtmlTokenId::ABBREVIATION_ON:
1961 case HtmlTokenId::INSERTEDTEXT_ON:
1962 case HtmlTokenId::DELETEDTEXT_ON:
1964 case HtmlTokenId::TELETYPE_ON:
1968 case HtmlTokenId::SDFIELD_ON:
1973 case HtmlTokenId::EMPHASIS_OFF:
1974 case HtmlTokenId::CITATION_OFF:
1975 case HtmlTokenId::STRONG_OFF:
1976 case HtmlTokenId::CODE_OFF:
1977 case HtmlTokenId::SAMPLE_OFF:
1978 case HtmlTokenId::KEYBOARD_OFF:
1979 case HtmlTokenId::VARIABLE_OFF:
1980 case HtmlTokenId::DEFINSTANCE_OFF:
1981 case HtmlTokenId::SHORTQUOTE_OFF:
1982 case HtmlTokenId::LANGUAGE_OFF:
1983 case HtmlTokenId::AUTHOR_OFF:
1984 case HtmlTokenId::PERSON_OFF:
1985 case HtmlTokenId::ACRONYM_OFF:
1986 case HtmlTokenId::ABBREVIATION_OFF:
1987 case HtmlTokenId::INSERTEDTEXT_OFF:
1988 case HtmlTokenId::DELETEDTEXT_OFF:
1990 case HtmlTokenId::TELETYPE_OFF:
1994 case HtmlTokenId::HEAD_OFF:
2002 case HtmlTokenId::DOCTYPE:
2003 case HtmlTokenId::BODY_OFF:
2004 case HtmlTokenId::HTML_OFF:
2005 case HtmlTokenId::HEAD_ON:
2006 case HtmlTokenId::TITLE_OFF:
2008 case HtmlTokenId::HTML_ON:
2011 for (
size_t i = rHTMLOptions.size();
i; )
2014 if( HtmlOptionId::DIR == rOption.
GetToken() )
2016 const OUString& rDir = rOption.
GetString();
2022 aPropInfo,
nullptr, &rDir );
2031 case HtmlTokenId::INPUT:
2035 case HtmlTokenId::TEXTAREA_ON:
2040 case HtmlTokenId::SELECT_ON:
2045 case HtmlTokenId::ANCHOR_ON:
2049 case HtmlTokenId::ANCHOR_OFF:
2053 case HtmlTokenId::COMMENT:
2059 if(
' ' == aToken[ 3 ] &&
2060 ' ' == aToken[ aToken.getLength()-3 ] )
2062 std::u16string_view aComment( aToken.subView( 3, aToken.getLength()-5 ) );
2067 OUString aComment =
"<" + aToken +
">";
2073 case HtmlTokenId::MAP_ON:
2092 case HtmlTokenId::MAP_OFF:
2098 case HtmlTokenId::AREA:
2101 SvMacroItemId::OnMouseOut );
2104 case HtmlTokenId::FRAMESET_ON:
2108 case HtmlTokenId::NOFRAMES_ON:
2114 case HtmlTokenId::UNKNOWNCONTROL_ON:
2120 !sSaveToken.isEmpty() &&
'!' != sSaveToken[0] &&
2121 '%' != sSaveToken[0] )
2133 if( bInsertUnknown )
2135 OUStringBuffer aComment(
"HTML: <");
2137 aComment.append(
"/");
2138 aComment.append(sSaveToken);
2139 if( !aToken.isEmpty() )
2142 aComment.append(
" " + aToken);
2144 aComment.append(
">");
2155 bool& rScriptDependent,
2156 sal_uInt16& rScriptType )
2165 rScriptType = i18n::ScriptType::LATIN;
2166 rScriptDependent =
true;
2173 rScriptType = i18n::ScriptType::ASIAN;
2174 rScriptDependent =
true;
2181 rScriptType = i18n::ScriptType::COMPLEX;
2182 rScriptDependent =
true;
2185 rScriptDependent =
false;
2247 HTMLAttr *pAttr = *pHTMLAttributes;
2250 bool bWholePara =
false;
2265 bool bScript =
false;
2266 sal_uInt16 nScriptItem;
2267 bool bInsert =
true;
2275 OSL_ENSURE( pTextNd,
"No text node" );
2278 const OUString& rText = pTextNd->
GetText();
2279 sal_uInt16 nScriptText =
2283 ->endOfScript( rText, nStt, nScriptText );
2284 while (nScriptEnd < nEndCnt && nScriptEnd != -1)
2286 if( nScriptItem == nScriptText )
2292 if( !pNext || bWholePara )
2306 ->endOfScript( rText, nStt, nScriptText );
2308 bInsert = nScriptItem == nScriptText;
2321 if( !pNext || bWholePara )
2337 if( !pNext || bWholePara )
2374 OSL_ENSURE( pTextNd,
"There is the txt node" );
2386 sal_Int32 aEndPos[15] =
2387 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
2389 for(
size_t i=0;
i < nCntAttr;
i++ )
2392 sal_uInt16 nWhich = pHt->
Which();
2449 const sal_Int32 nStt = pHt->
GetStart();
2450 if( nStt >= aEndPos[nIdx] )
2453 static_cast<const SwContentNode *
>(pTextNd)->GetAttr( nWhich );
2480 OSL_ENSURE( pHt->
GetEnd() && *pHt->
GetEnd() <= aEndPos[nIdx],
2481 "hints aren't nested properly!" );
2524 bool bIsCJK =
false;
2525 bool bIsCTL =
false;
2530 for(
size_t i = 0;
i < nCntAttr; ++
i)
2533 sal_uInt16
const nWhich = pHt->
Which();
2578 OSL_ENSURE( SvParserState::Working==eState,
"Show not in working state - That can go wrong" );
2583 if( (
m_xDoc->GetDocShell() &&
m_xDoc->GetDocShell()->IsAbortingImport() )
2584 || 1 ==
m_xDoc->getReferenceCount() )
2587 eState = SvParserState::Error;
2608 OSL_ENSURE( SvParserState::Working==eState,
"ShowStatLine not in working state - That can go wrong" );
2620 if( (
m_xDoc->GetDocShell() &&
m_xDoc->GetDocShell()->IsAbortingImport() )
2621 || 1 ==
m_xDoc->getReferenceCount() )
2623 eState = SvParserState::Error;
2638 if( !pVSh || bChkPtr )
2640#if OSL_DEBUG_LEVEL > 0
2643 pVSh =
m_xDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
2644#if OSL_DEBUG_LEVEL > 0
2645 OSL_ENSURE( !pVSh || !pOldVSh || pOldVSh == pVSh,
"CallStartAction: Who swapped the SwViewShell?" );
2646 if( pOldVSh && !pVSh )
2669 "CallEndAction: Who swapped the SwViewShell?" );
2670#if OSL_DEBUG_LEVEL > 0
2686 pEditShell->EndAction();
2695 GetMedium()->GetURLObject().GetMark() );
2704 if( 1 ==
m_xDoc->getReferenceCount() )
2706 eState = SvParserState::Error;
2719 "CheckActionViewShell: Who has swapped SwViewShell?" );
2720#if OSL_DEBUG_LEVEL > 0
2731 : m_pFrameFormat(pFrameFormat)
2738 if (rHint.
GetId() == SfxHintId::Dying)
2743 std::deque<std::unique_ptr<HTMLAttr>> *pPostIts )
2751 std::vector<std::unique_ptr<HTMLAttr>> aFields;
2756 sal_uInt16 nWhich = pAttr->
m_pItem->Which();
2785 nEndParaIdx <= nEndOfIcons;
2795 "SetAttr: Attribute must not yet be set" );
2832 OSL_ENSURE(
false,
"SetAttr: GoNext() failed!" );
2857 OSL_ENSURE(
false,
"SetAttr: GoPrevious() failed!" );
2890 "Content-Position before table not 0???" );
2911 (*ppBkmk)->GetMarkStart() == *aAttrPam.
GetPoint() )
2914 const ::sw::mark::IMark*
const pNewMark = pMarkAccess->
makeMark(
2918 ::sw::mark::InsertMode::New);
2939 pPostIts->emplace_front( pAttr );
2943 aFields.emplace_back( pAttr);
2979 "LRSpace set over multiple paragraphs!" );
3007 SAL_WARN(
"sw.html",
"SwFrameFormat deleted during import");
3014 OSL_ENSURE( RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId(),
3015 "Only At-Para flys need special handling" );
3029 nFlyParaIdx <= nEndOfIcons;
3037 aAnchor.
SetType( RndStdIds::FLY_AT_CHAR );
3042 if( text::HoriOrientation::LEFT == rHoriOri.
GetHoriOrient() )
3049 if( text::VertOrientation::TOP == rVertOri.
GetVertOrient() )
3061 for (
auto & field : aFields)
3069 OSL_ENSURE( !bBeforeTable,
"Aha, the case does occur" );
3071 "Content-Position before table not 0???" );
3076 m_xDoc->getIDocumentContentOperations().InsertPoolItem( aAttrPam, *field->m_pItem );
3106 OSL_ENSURE( ppHead,
"No list header attribute found!" );
3114 if( ppHead && pAttr != *ppHead )
3122 while( pLast && pLast->
GetNext() != pAttr )
3125 OSL_ENSURE( pLast,
"Attribute not found in own list!" );
3128 bool bMoveBack =
false;
3129 sal_uInt16 nWhich = pAttr->
m_pItem->Which();
3142 sal_uInt16 nScriptItem = 0;
3143 bool bScript =
false;
3162 const SwTextNode *pTextNd = (bInsert && bScript) ?
3168 const OUString& rText = pTextNd->
GetText();
3173 while (nScriptEnd < nEndCnt && nScriptEnd != -1)
3175 if( nScriptItem == nScriptText )
3191 rText, nScriptEnd );
3193 ->endOfScript( rText, nScriptEnd, nScriptText );
3195 bInsert = nScriptItem == nScriptText;
3266 "Danger: there are non-final paragraph attributes");
3272 OSL_ENSURE( ppHead,
"no list header attribute found!" );
3276 if( ppHead && pAttr != *ppHead )
3284 while( pLast && pLast->
GetNext() != pAttr )
3287 OSL_ENSURE( pLast,
"Attribute not found in own list!" );
3294 std::shared_ptr<HTMLAttrTable> xKeepAlive(pAttr->
m_xAttrTab);
3324 "Danger: there are non-final paragraph attributes");
3328 HTMLAttr** pSaveAttributes =
reinterpret_cast<HTMLAttr**
>(rNewAttrTab.get());
3330 for (
auto nCnt =
sizeof(
HTMLAttrTable) /
sizeof(
HTMLAttr*); nCnt--; ++pHTMLAttributes, ++pSaveAttributes)
3332 *pSaveAttributes = *pHTMLAttributes;
3334 HTMLAttr *pAttr = *pSaveAttributes;
3337 pAttr->
SetHead(pSaveAttributes, rNewAttrTab);
3341 *pHTMLAttributes =
nullptr;
3351 "Danger: there are non-final paragraph attributes");
3358 HTMLAttr** pSaveAttributes =
reinterpret_cast<HTMLAttr**
>(rNewAttrTab.get());
3359 bool bSetAttr =
true;
3361 sal_Int32 nEndCnt = nSttCnt;
3367 if( ( nTmpIdx =
m_xDoc->GetNodes().GetEndOfExtras().GetIndex()) >= nOldEnd ||
3368 ( nTmpIdx =
m_xDoc->GetNodes().GetEndOfAutotext().GetIndex()) >= nOldEnd )
3370 nTmpIdx =
m_xDoc->GetNodes().GetEndOfInserts().GetIndex();
3375 bSetAttr = pCNd && nTmpIdx < nEndIdx.
GetIndex();
3377 nEndCnt = (bSetAttr ? pCNd->
Len() : 0);
3379 for (
auto nCnt =
sizeof(
HTMLAttrTable) /
sizeof(
HTMLAttr*); nCnt--; (++pHTMLAttributes, ++pSaveAttributes))
3381 HTMLAttr *pAttr = *pHTMLAttributes;
3382 *pSaveAttributes =
nullptr;
3427 if (*pSaveAttributes)
3429 HTMLAttr *pSAttr = *pSaveAttributes;
3435 *pSaveAttributes = pAttr;
3440 *pHTMLAttributes =
nullptr;
3449 "Danger: there are non-final paragraph attributes");
3453 HTMLAttr** pSaveAttributes =
reinterpret_cast<HTMLAttr**
>(rNewAttrTab.get());
3455 for (
auto nCnt =
sizeof(
HTMLAttrTable) /
sizeof(
HTMLAttr*); nCnt--; ++pHTMLAttributes, ++pSaveAttributes)
3457 OSL_ENSURE(!*pHTMLAttributes,
"The attribute table is not empty!");
3459 *pHTMLAttributes = *pSaveAttributes;
3461 HTMLAttr *pAttr = *pHTMLAttributes;
3465 "Previous attribute has still a header" );
3470 *pSaveAttributes =
nullptr;
3485 while( !rAttrs.empty() )
3487 std::unique_ptr<HTMLAttr> pAttr = std::move(rAttrs.front());
3495 OUString aId, aStyle, aLang, aDir;
3499 for (
size_t i = rHTMLOptions.size();
i; )
3504 case HtmlOptionId::ID:
3507 case HtmlOptionId::STYLE:
3510 case HtmlOptionId::CLASS:
3513 case HtmlOptionId::LANG:
3516 case HtmlOptionId::DIR:
3532 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3534 if( HtmlTokenId::SPAN_ON !=
nToken || aClass.isEmpty() ||
3537 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
3550 OUString aId, aStyle, aClass, aLang, aDir;
3553 for (
size_t i = rHTMLOptions.size();
i; )
3558 case HtmlOptionId::ID:
3561 case HtmlOptionId::STYLE:
3564 case HtmlOptionId::CLASS:
3567 case HtmlOptionId::LANG:
3570 case HtmlOptionId::DIR:
3586 aItemSet.
Put( rItem );
3588 aItemSet.
Put( *pItem2 );
3590 aItemSet.
Put( *pItem3 );
3592 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3595 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
3602 OSL_ENSURE( ppAttr2,
"missing table entry for item2" );
3603 InsertAttr( ppAttr2, *pItem2, xCntxt.get() );
3607 OSL_ENSURE( ppAttr3,
"missing table entry for item3" );
3608 InsertAttr( ppAttr3, *pItem3, xCntxt.get() );
3629 OUString aId, aStyle, aClass, aLang, aDir;
3630 sal_uInt16 nSize = 3;
3633 for (
size_t i = rHTMLOptions.size();
i; )
3638 case HtmlOptionId::SIZE:
3639 nSize = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
3641 case HtmlOptionId::ID:
3644 case HtmlOptionId::STYLE:
3647 case HtmlOptionId::CLASS:
3650 case HtmlOptionId::LANG:
3653 case HtmlOptionId::DIR:
3667 std::unique_ptr<HTMLAttrContext> xCntxt(
new HTMLAttrContext(HtmlTokenId::BASEFONT_ON));
3677 aItemSet.
Put( aFontHeight );
3679 aItemSet.
Put( aFontHeightCJK );
3684 aItemSet.
Put( aFontHeightCTL );
3686 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3689 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
3710 EndTag( HtmlTokenId::BASEFONT_ON );
3719 sal_uInt16 nBaseSize =
3723 sal_uInt16 nFontSize =
3728 OUString aFace, aId, aStyle, aClass, aLang, aDir;
3731 sal_uInt16 nSize = 0;
3732 bool bColor =
false;
3735 for (
size_t i = rHTMLOptions.size();
i; )
3740 case HtmlOptionId::SIZE:
3746 nSSize = o3tl::saturating_add<sal_Int32>(nBaseSize, rOption.
GetSNumber());
3748 nSSize =
static_cast<sal_Int32
>(rOption.
GetNumber());
3752 else if( nSSize > 7 )
3755 nSize = o3tl::narrowing<sal_uInt16>(nSSize);
3759 case HtmlOptionId::COLOR:
3760 if( HtmlTokenId::FONT_ON==
nToken )
3766 case HtmlOptionId::FACE:
3767 if( HtmlTokenId::FONT_ON==
nToken )
3770 case HtmlOptionId::ID:
3773 case HtmlOptionId::STYLE:
3776 case HtmlOptionId::CLASS:
3779 case HtmlOptionId::LANG:
3782 case HtmlOptionId::DIR:
3789 if( HtmlTokenId::FONT_ON !=
nToken )
3808 if( HtmlTokenId::BIGPRINT_ON ==
nToken )
3809 nSize = ( nFontSize<7 ? nFontSize+1 : 7 );
3811 nSize = ( nFontSize>1 ? nFontSize-1 : 1 );
3815 if( nPoolId && nSize>=1 && nSize <=6 )
3823 OSL_ENSURE( !nSize == !nFontHeight,
"HTML-Font-Size != Font-Height" );
3826 const OUString aStyleName;
3829 rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
3831 if( !aFace.isEmpty() && !
m_pCSS1Parser->IsIgnoreFontFamily() )
3843 bool bFound =
false;
3844 sal_Int32 nStrPos = 0;
3845 while( nStrPos!= -1 )
3847 OUString aFName = aFace.getToken( 0,
',', nStrPos );
3849 if( !aFName.isEmpty() )
3851 if( !bFound && pFList )
3854 if(
nullptr != hFont )
3857 if( RTL_TEXTENCODING_DONTKNOW != rFMetric.
GetCharSet() )
3860 if( RTL_TEXTENCODING_SYMBOL == rFMetric.
GetCharSet() )
3861 eEnc = RTL_TEXTENCODING_SYMBOL;
3865 if( !aFontName.isEmpty() )
3867 aFontName += aFName;
3884 aItemSet.
Put( aFontHeight );
3886 aItemSet.
Put( aFontHeightCJK );
3888 aItemSet.
Put( aFontHeightCTL );
3892 if( !aFontName.isEmpty() )
3895 aItemSet.
Put( aFont );
3897 aItemSet.
Put( aFontCJK );
3899 aItemSet.
Put( aFontCTL );
3902 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3905 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
3920 if( !aFontName.isEmpty() )
3954 OUString aId, aStyle, aClass, aLang, aDir;
3957 for (
size_t i = rHTMLOptions.size();
i; )
3962 case HtmlOptionId::ID:
3965 case HtmlOptionId::ALIGN:
3968 case HtmlOptionId::STYLE:
3971 case HtmlOptionId::CLASS:
3974 case HtmlOptionId::LANG:
3977 case HtmlOptionId::DIR:
3985 std::unique_ptr<HTMLAttrContext> xCntxt(
3997 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
3999 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4000 "Class is not considered" );
4018 OSL_ENSURE(
m_nOpenParaToken == HtmlTokenId::NONE,
"Now an open paragraph element will be lost." );
4026#if OSL_DEBUG_LEVEL > 0
4028 OSL_ENSURE( pNumRule,
"Where is the NumRule" );
4052 std::unique_ptr<HTMLAttrContext> xCntxt(
4074 OUString aId, aStyle, aClass, aLang, aDir;
4077 for (
size_t i = rHTMLOptions.size();
i; )
4082 case HtmlOptionId::ID:
4085 case HtmlOptionId::ALIGN:
4088 case HtmlOptionId::STYLE:
4091 case HtmlOptionId::CLASS:
4094 case HtmlOptionId::LANG:
4097 case HtmlOptionId::DIR:
4111 sal_uInt16 nTextColl;
4132 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4134 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4135 "Class is not considered" );
4165 std::unique_ptr<HTMLAttrContext> xCntxt;
4171 case HtmlTokenId::HEAD1_ON:
4172 case HtmlTokenId::HEAD2_ON:
4173 case HtmlTokenId::HEAD3_ON:
4174 case HtmlTokenId::HEAD4_ON:
4175 case HtmlTokenId::HEAD5_ON:
4176 case HtmlTokenId::HEAD6_ON:
4200 OUString aId, aStyle, aClass, aLang, aDir;
4203 for (
size_t i = rHTMLOptions.size();
i; )
4208 case HtmlOptionId::ID:
4211 case HtmlOptionId::STYLE:
4214 case HtmlOptionId::CLASS:
4217 case HtmlOptionId::LANG:
4220 case HtmlOptionId::DIR:
4231 case HtmlTokenId::LISTING_ON:
4232 case HtmlTokenId::XMP_ON:
4238 case HtmlTokenId::BLOCKQUOTE_ON:
4239 case HtmlTokenId::BLOCKQUOTE30_ON:
4240 case HtmlTokenId::PREFORMTXT_ON:
4243 case HtmlTokenId::ADDRESS_ON:
4246 case HtmlTokenId::DT_ON:
4247 case HtmlTokenId::DD_ON:
4251 OSL_ENSURE(
false,
"unknown style" );
4268 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4270 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4271 "Class is not considered" );
4291 case HtmlTokenId::BLOCKQUOTE_ON:
4292 case HtmlTokenId::BLOCKQUOTE30_ON:
4293 case HtmlTokenId::PREFORMTXT_ON:
4294 case HtmlTokenId::LISTING_ON:
4295 case HtmlTokenId::XMP_ON:
4298 case HtmlTokenId::ADDRESS_ON:
4299 case HtmlTokenId::DT_ON:
4300 case HtmlTokenId::DD_ON:
4304 OSL_ENSURE(
false,
"unknown style" );
4329 OUString aId, aStyle, aClass, aLang, aDir;
4332 for (
size_t i = rHTMLOptions.size();
i; )
4337 case HtmlOptionId::ID:
4340 case HtmlOptionId::STYLE:
4343 case HtmlOptionId::CLASS:
4346 case HtmlOptionId::LANG:
4349 case HtmlOptionId::DIR:
4366 bool bInDD =
false, bNotInDD =
false;
4371 switch( nCntxtToken )
4373 case HtmlTokenId::DEFLIST_ON:
4374 case HtmlTokenId::DIRLIST_ON:
4375 case HtmlTokenId::MENULIST_ON:
4376 case HtmlTokenId::ORDERLIST_ON:
4377 case HtmlTokenId::UNORDERLIST_ON:
4380 case HtmlTokenId::DD_ON:
4388 std::unique_ptr<HTMLAttrContext> xCntxt(
new HTMLAttrContext(HtmlTokenId::DEFLIST_ON));
4391 sal_uInt16 nLeft=0, nRight=0;
4404 ->GetTextLeftMargin();
4405 nLeft = nLeft +
static_cast<sal_uInt16
>(rTextLeftMargin.
GetTextLeft());
4408 xCntxt->SetMargins( nLeft, nRight, nIndent );
4416 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
4443 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext(HtmlTokenId::DEFLIST_ON));
4460 bool bInDefList =
false, bNotInDefList =
false;
4465 switch( nCntxtToken )
4467 case HtmlTokenId::DEFLIST_ON:
4470 case HtmlTokenId::DIRLIST_ON:
4471 case HtmlTokenId::MENULIST_ON:
4472 case HtmlTokenId::ORDERLIST_ON:
4473 case HtmlTokenId::UNORDERLIST_ON:
4474 bNotInDefList =
true;
4485 "Now an open paragraph element will be lost." );
4501 std::unique_ptr<HTMLAttrContext> xCntxt;
4506 switch( nCntxtToken )
4508 case HtmlTokenId::DD_ON:
4509 case HtmlTokenId::DT_ON:
4510 if(
nToken == HtmlTokenId::NONE ||
nToken == nCntxtToken )
4516 case HtmlTokenId::DEFLIST_ON:
4518 case HtmlTokenId::DIRLIST_ON:
4519 case HtmlTokenId::MENULIST_ON:
4520 case HtmlTokenId::ORDERLIST_ON:
4521 case HtmlTokenId::UNORDERLIST_ON:
4547 bool bSurroundOnly )
const
4552 bool bFound =
false;
4564 ((RndStdIds::FLY_AT_PARA == pAnchor->
GetAnchorId()) ||
4565 (RndStdIds::FLY_AT_CHAR == pAnchor->
GetAnchorId())) &&
4566 *pAnchorNode == rNode )
4568 if( !(bNoSurroundOnly || bSurroundOnly) )
4578 css::text::WrapTextMode eSurround = pFormat->GetSurround().GetSurround();
4579 if( bNoSurroundOnly )
4581 if( css::text::WrapTextMode_NONE==eSurround )
4589 if( css::text::WrapTextMode_NONE==eSurround )
4594 else if( css::text::WrapTextMode_THROUGH!=eSurround )
4621 const OUString rTopClass = pContext ? pContext->
GetClass() : OUString();
4627 short nFirstLineIndent = 0;
4630 if (bFuzzing && nDepth > 128)
4632 SAL_WARN(
"sw.html",
"Not applying any more text collection attributes to a deeply nested node for fuzzing performance");
4645 bool bSetThis =
true;
4685 aItemSet.
Set( rCollSet );
4686 pItemSet->
Put( aItemSet );
4693 pCollToSet = pNewColl;
4705 aItemSet.
Set( rCollSet );
4706 pItemSet->
Put( aItemSet );
4721 sal_uInt16 nLeft=0, nRight=0;
4723 pCntxt->
GetMargins( nLeft, nRight, nFirstLineIndent );
4731 if( pContext && nTopColl )
4737 nTopColl = nDfltColl;
4754 nLeft -= pColl->GetTextLeftMargin().GetTextLeft();
4755 nRight -= pColl->GetRightMargin().GetRight();
4772 pContext->
SetULSpace( pULItem->GetUpper(), pULItem->GetLower() );
4779 pCollToSet =
m_pCSS1Parser->GetTextCollFromPool( nDfltColl );
4788 if( !nFirstLineIndent )
4796 pParaAttr->Invalidate();
4820 pItemSet->
Put(firstLine);
4821 pItemSet->
Put(leftMargin);
4822 pItemSet->
Put(rightMargin);
4851 OUString aId, aStyle, aLang, aDir;
4855 for (
size_t i = rHTMLOptions.size();
i; )
4860 case HtmlOptionId::ID:
4863 case HtmlOptionId::STYLE:
4866 case HtmlOptionId::CLASS:
4869 case HtmlOptionId::LANG:
4872 case HtmlOptionId::DIR:
4884 OSL_ENSURE( pCFormat,
"No character format found for token" );
4892 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4894 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4895 "Class is not considered" );
4897 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
4913 sal_Int16 eVertOri = text::VertOrientation::TOP;
4917 bool bPercentWidth =
false;
4918 bool bPercentHeight =
false;
4922 for (
size_t i = rHTMLOptions.size();
i; )
4927 case HtmlOptionId::TYPE:
4930 case HtmlOptionId::ALIGN:
4938 case HtmlOptionId::WIDTH:
4940 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
4943 case HtmlOptionId::HEIGHT:
4945 bPercentHeight = (rOption.
GetString().indexOf(
'%') != -1);
4948 case HtmlOptionId::SIZE:
4972 Size aSpace( 0, 0 );
4977 SetFixSize( aSize, aDfltSz, bPercentWidth, bPercentHeight,
4978 aDummyPropInfo, aFrameSet );
4979 SetSpace( aSpace, aDummyItemSet, aDummyPropInfo, aFrameSet );
4984 aFrameSet.Put( aProtectItem );
5002 MapMode(MapUnit::MapTwip) ).Height();
5027 aULSpace.
SetLower( aULSpace.
GetLower() + o3tl::narrowing<sal_uInt16>(nSize) );
5028 pTextNode->
SetAttr( aULSpace );
5049 MapMode(MapUnit::MapTwip) ).Width();
5054 sal_uInt16 nLeft=0, nRight=0;
5058 nIndent = nIndent +
static_cast<short>(nSize);
5074 m_xDoc->getIDocumentContentOperations().InsertString( *
m_pPam,
" " );
5122 for (
size_t i = rHTMLOptions.size();
i; )
5125 if( HtmlOptionId::ID==rOption.
GetToken() )
5132 if( !aId.isEmpty() )
5138 OUString aId, aStyle, aClass;
5143 for (
size_t i = rHTMLOptions.size();
i; )
5148 case HtmlOptionId::CLEAR:
5150 const OUString &rClear = rOption.
GetString();
5165 case HtmlOptionId::ID:
5168 case HtmlOptionId::STYLE:
5171 case HtmlOptionId::CLASS:
5179 std::shared_ptr<SvxFormatBreakItem> aBreakItem(std::make_shared<SvxFormatBreakItem>(SvxBreak::NONE,
RES_BREAK));
5180 bool bBreakItem =
false;
5193 if( !aPropInfo.
m_aId.isEmpty() )
5198 if( bBreakItem && SvxBreak::PageAfter == aBreakItem->GetBreak() )
5209 m_xDoc->getIDocumentContentOperations().InsertString(*
m_pPam,
"\x0A");
5232 if( bBreakItem && SvxBreak::PageBefore == aBreakItem->GetBreak() )
5241 sal_uInt16 nSize = 0;
5242 sal_uInt16 nWidth = 0;
5246 bool bPercentWidth =
false;
5247 bool bNoShade =
false;
5248 bool bColor =
false;
5255 for (
size_t i = rHTMLOptions.size();
i; )
5260 case HtmlOptionId::ID:
5263 case HtmlOptionId::SIZE:
5264 nSize = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
5266 case HtmlOptionId::WIDTH:
5267 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
5268 nWidth = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
5269 if( bPercentWidth && nWidth>=100 )
5273 bPercentWidth =
false;
5276 case HtmlOptionId::ALIGN:
5279 case HtmlOptionId::NOSHADE:
5282 case HtmlOptionId::COLOR:
5298 std::unique_ptr<HTMLAttrContext> xCntxt(
5309 if( nSize>0 || bColor || bNoShade )