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 const 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
2698 GetMedium()->GetURLObject().GetMark() );
2707 if( 1 ==
m_xDoc->getReferenceCount() )
2709 eState = SvParserState::Error;
2722 "CheckActionViewShell: Who has swapped SwViewShell?" );
2723#if OSL_DEBUG_LEVEL > 0
2734 : m_pFrameFormat(pFrameFormat)
2741 if (rHint.
GetId() == SfxHintId::Dying)
2746 std::deque<std::unique_ptr<HTMLAttr>> *pPostIts )
2754 std::vector<std::unique_ptr<HTMLAttr>> aFields;
2759 sal_uInt16 nWhich = pAttr->
m_pItem->Which();
2788 nEndParaIdx <= nEndOfIcons;
2798 "SetAttr: Attribute must not yet be set" );
2835 OSL_ENSURE(
false,
"SetAttr: GoNext() failed!" );
2860 OSL_ENSURE(
false,
"SetAttr: GoPrevious() failed!" );
2893 "Content-Position before table not 0???" );
2914 (*ppBkmk)->GetMarkStart() == *aAttrPam.
GetPoint() )
2917 const ::sw::mark::IMark*
const pNewMark = pMarkAccess->
makeMark(
2921 ::sw::mark::InsertMode::New);
2942 pPostIts->emplace_front( pAttr );
2946 aFields.emplace_back( pAttr);
2982 "LRSpace set over multiple paragraphs!" );
3010 SAL_WARN(
"sw.html",
"SwFrameFormat deleted during import");
3017 OSL_ENSURE( RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId(),
3018 "Only At-Para flys need special handling" );
3032 nFlyParaIdx <= nEndOfIcons;
3040 aAnchor.
SetType( RndStdIds::FLY_AT_CHAR );
3045 if( text::HoriOrientation::LEFT == rHoriOri.
GetHoriOrient() )
3052 if( text::VertOrientation::TOP == rVertOri.
GetVertOrient() )
3064 for (
auto & field : aFields)
3072 OSL_ENSURE( !bBeforeTable,
"Aha, the case does occur" );
3074 "Content-Position before table not 0???" );
3079 m_xDoc->getIDocumentContentOperations().InsertPoolItem( aAttrPam, *field->m_pItem );
3109 OSL_ENSURE( ppHead,
"No list header attribute found!" );
3117 if( ppHead && pAttr != *ppHead )
3125 while( pLast && pLast->
GetNext() != pAttr )
3128 OSL_ENSURE( pLast,
"Attribute not found in own list!" );
3131 bool bMoveBack =
false;
3132 sal_uInt16 nWhich = pAttr->
m_pItem->Which();
3145 sal_uInt16 nScriptItem = 0;
3146 bool bScript =
false;
3165 const SwTextNode *pTextNd = (bInsert && bScript) ?
3171 const OUString& rText = pTextNd->
GetText();
3176 while (nScriptEnd < nEndCnt && nScriptEnd != -1)
3178 if( nScriptItem == nScriptText )
3194 rText, nScriptEnd );
3196 ->endOfScript( rText, nScriptEnd, nScriptText );
3198 bInsert = nScriptItem == nScriptText;
3269 "Danger: there are non-final paragraph attributes");
3275 OSL_ENSURE( ppHead,
"no list header attribute found!" );
3279 if( ppHead && pAttr != *ppHead )
3287 while( pLast && pLast->
GetNext() != pAttr )
3290 OSL_ENSURE( pLast,
"Attribute not found in own list!" );
3297 std::shared_ptr<HTMLAttrTable> xKeepAlive(pAttr->
m_xAttrTab);
3327 "Danger: there are non-final paragraph attributes");
3331 HTMLAttr** pSaveAttributes =
reinterpret_cast<HTMLAttr**
>(rNewAttrTab.get());
3333 for (
auto nCnt =
sizeof(
HTMLAttrTable) /
sizeof(
HTMLAttr*); nCnt--; ++pHTMLAttributes, ++pSaveAttributes)
3335 *pSaveAttributes = *pHTMLAttributes;
3337 HTMLAttr *pAttr = *pSaveAttributes;
3340 pAttr->
SetHead(pSaveAttributes, rNewAttrTab);
3344 *pHTMLAttributes =
nullptr;
3354 "Danger: there are non-final paragraph attributes");
3361 HTMLAttr** pSaveAttributes =
reinterpret_cast<HTMLAttr**
>(rNewAttrTab.get());
3362 bool bSetAttr =
true;
3364 sal_Int32 nEndCnt = nSttCnt;
3370 if( ( nTmpIdx =
m_xDoc->GetNodes().GetEndOfExtras().GetIndex()) >= nOldEnd ||
3371 ( nTmpIdx =
m_xDoc->GetNodes().GetEndOfAutotext().GetIndex()) >= nOldEnd )
3373 nTmpIdx =
m_xDoc->GetNodes().GetEndOfInserts().GetIndex();
3378 bSetAttr = pCNd && nTmpIdx < nEndIdx.
GetIndex();
3380 nEndCnt = (bSetAttr ? pCNd->
Len() : 0);
3382 for (
auto nCnt =
sizeof(
HTMLAttrTable) /
sizeof(
HTMLAttr*); nCnt--; (++pHTMLAttributes, ++pSaveAttributes))
3384 HTMLAttr *pAttr = *pHTMLAttributes;
3385 *pSaveAttributes =
nullptr;
3430 if (*pSaveAttributes)
3432 HTMLAttr *pSAttr = *pSaveAttributes;
3438 *pSaveAttributes = pAttr;
3443 *pHTMLAttributes =
nullptr;
3452 "Danger: there are non-final paragraph attributes");
3456 HTMLAttr** pSaveAttributes =
reinterpret_cast<HTMLAttr**
>(rNewAttrTab.get());
3458 for (
auto nCnt =
sizeof(
HTMLAttrTable) /
sizeof(
HTMLAttr*); nCnt--; ++pHTMLAttributes, ++pSaveAttributes)
3460 OSL_ENSURE(!*pHTMLAttributes,
"The attribute table is not empty!");
3462 *pHTMLAttributes = *pSaveAttributes;
3464 HTMLAttr *pAttr = *pHTMLAttributes;
3468 "Previous attribute has still a header" );
3473 *pSaveAttributes =
nullptr;
3488 while( !rAttrs.empty() )
3490 std::unique_ptr<HTMLAttr> pAttr = std::move(rAttrs.front());
3498 OUString aId, aStyle, aLang, aDir;
3502 for (
size_t i = rHTMLOptions.size();
i; )
3507 case HtmlOptionId::ID:
3510 case HtmlOptionId::STYLE:
3513 case HtmlOptionId::CLASS:
3516 case HtmlOptionId::LANG:
3519 case HtmlOptionId::DIR:
3535 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3537 if( HtmlTokenId::SPAN_ON !=
nToken || aClass.isEmpty() ||
3540 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
3553 OUString aId, aStyle, aClass, aLang, aDir;
3556 for (
size_t i = rHTMLOptions.size();
i; )
3561 case HtmlOptionId::ID:
3564 case HtmlOptionId::STYLE:
3567 case HtmlOptionId::CLASS:
3570 case HtmlOptionId::LANG:
3573 case HtmlOptionId::DIR:
3589 aItemSet.
Put( rItem );
3591 aItemSet.
Put( *pItem2 );
3593 aItemSet.
Put( *pItem3 );
3595 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3598 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
3605 OSL_ENSURE( ppAttr2,
"missing table entry for item2" );
3606 InsertAttr( ppAttr2, *pItem2, xCntxt.get() );
3610 OSL_ENSURE( ppAttr3,
"missing table entry for item3" );
3611 InsertAttr( ppAttr3, *pItem3, xCntxt.get() );
3632 OUString aId, aStyle, aClass, aLang, aDir;
3633 sal_uInt16 nSize = 3;
3636 for (
size_t i = rHTMLOptions.size();
i; )
3641 case HtmlOptionId::SIZE:
3642 nSize = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
3644 case HtmlOptionId::ID:
3647 case HtmlOptionId::STYLE:
3650 case HtmlOptionId::CLASS:
3653 case HtmlOptionId::LANG:
3656 case HtmlOptionId::DIR:
3670 std::unique_ptr<HTMLAttrContext> xCntxt(
new HTMLAttrContext(HtmlTokenId::BASEFONT_ON));
3680 aItemSet.
Put( aFontHeight );
3682 aItemSet.
Put( aFontHeightCJK );
3687 aItemSet.
Put( aFontHeightCTL );
3689 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3692 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
3713 EndTag( HtmlTokenId::BASEFONT_ON );
3722 sal_uInt16 nBaseSize =
3726 sal_uInt16 nFontSize =
3731 OUString aFace, aId, aStyle, aClass, aLang, aDir;
3734 sal_uInt16 nSize = 0;
3735 bool bColor =
false;
3738 for (
size_t i = rHTMLOptions.size();
i; )
3743 case HtmlOptionId::SIZE:
3749 nSSize = o3tl::saturating_add<sal_Int32>(nBaseSize, rOption.
GetSNumber());
3751 nSSize =
static_cast<sal_Int32
>(rOption.
GetNumber());
3755 else if( nSSize > 7 )
3758 nSize = o3tl::narrowing<sal_uInt16>(nSSize);
3762 case HtmlOptionId::COLOR:
3763 if( HtmlTokenId::FONT_ON==
nToken )
3769 case HtmlOptionId::FACE:
3770 if( HtmlTokenId::FONT_ON==
nToken )
3773 case HtmlOptionId::ID:
3776 case HtmlOptionId::STYLE:
3779 case HtmlOptionId::CLASS:
3782 case HtmlOptionId::LANG:
3785 case HtmlOptionId::DIR:
3792 if( HtmlTokenId::FONT_ON !=
nToken )
3811 if( HtmlTokenId::BIGPRINT_ON ==
nToken )
3812 nSize = ( nFontSize<7 ? nFontSize+1 : 7 );
3814 nSize = ( nFontSize>1 ? nFontSize-1 : 1 );
3818 if( nPoolId && nSize>=1 && nSize <=6 )
3826 OSL_ENSURE( !nSize == !nFontHeight,
"HTML-Font-Size != Font-Height" );
3829 const OUString aStyleName;
3832 rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
3834 if( !aFace.isEmpty() && !
m_pCSS1Parser->IsIgnoreFontFamily() )
3846 bool bFound =
false;
3847 sal_Int32 nStrPos = 0;
3848 while( nStrPos!= -1 )
3850 OUString aFName = aFace.getToken( 0,
',', nStrPos );
3852 if( !aFName.isEmpty() )
3854 if( !bFound && pFList )
3857 if(
nullptr != hFont )
3860 if( RTL_TEXTENCODING_DONTKNOW != rFMetric.
GetCharSet() )
3863 if( RTL_TEXTENCODING_SYMBOL == rFMetric.
GetCharSet() )
3864 eEnc = RTL_TEXTENCODING_SYMBOL;
3868 if( !aFontName.isEmpty() )
3870 aFontName += aFName;
3887 aItemSet.
Put( aFontHeight );
3889 aItemSet.
Put( aFontHeightCJK );
3891 aItemSet.
Put( aFontHeightCTL );
3895 if( !aFontName.isEmpty() )
3898 aItemSet.
Put( aFont );
3900 aItemSet.
Put( aFontCJK );
3902 aItemSet.
Put( aFontCTL );
3905 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3908 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
3923 if( !aFontName.isEmpty() )
3957 OUString aId, aStyle, aClass, aLang, aDir;
3960 for (
size_t i = rHTMLOptions.size();
i; )
3965 case HtmlOptionId::ID:
3968 case HtmlOptionId::ALIGN:
3971 case HtmlOptionId::STYLE:
3974 case HtmlOptionId::CLASS:
3977 case HtmlOptionId::LANG:
3980 case HtmlOptionId::DIR:
3988 std::unique_ptr<HTMLAttrContext> xCntxt(
4000 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4002 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4003 "Class is not considered" );
4021 OSL_ENSURE(
m_nOpenParaToken == HtmlTokenId::NONE,
"Now an open paragraph element will be lost." );
4029#if OSL_DEBUG_LEVEL > 0
4031 OSL_ENSURE( pNumRule,
"Where is the NumRule" );
4055 std::unique_ptr<HTMLAttrContext> xCntxt(
4077 OUString aId, aStyle, aClass, aLang, aDir;
4080 for (
size_t i = rHTMLOptions.size();
i; )
4085 case HtmlOptionId::ID:
4088 case HtmlOptionId::ALIGN:
4091 case HtmlOptionId::STYLE:
4094 case HtmlOptionId::CLASS:
4097 case HtmlOptionId::LANG:
4100 case HtmlOptionId::DIR:
4114 sal_uInt16 nTextColl;
4135 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4137 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4138 "Class is not considered" );
4168 std::unique_ptr<HTMLAttrContext> xCntxt;
4174 case HtmlTokenId::HEAD1_ON:
4175 case HtmlTokenId::HEAD2_ON:
4176 case HtmlTokenId::HEAD3_ON:
4177 case HtmlTokenId::HEAD4_ON:
4178 case HtmlTokenId::HEAD5_ON:
4179 case HtmlTokenId::HEAD6_ON:
4203 OUString aId, aStyle, aClass, aLang, aDir;
4206 for (
size_t i = rHTMLOptions.size();
i; )
4211 case HtmlOptionId::ID:
4214 case HtmlOptionId::STYLE:
4217 case HtmlOptionId::CLASS:
4220 case HtmlOptionId::LANG:
4223 case HtmlOptionId::DIR:
4234 case HtmlTokenId::LISTING_ON:
4235 case HtmlTokenId::XMP_ON:
4241 case HtmlTokenId::BLOCKQUOTE_ON:
4242 case HtmlTokenId::BLOCKQUOTE30_ON:
4243 case HtmlTokenId::PREFORMTXT_ON:
4246 case HtmlTokenId::ADDRESS_ON:
4249 case HtmlTokenId::DT_ON:
4250 case HtmlTokenId::DD_ON:
4254 OSL_ENSURE(
false,
"unknown style" );
4271 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4273 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4274 "Class is not considered" );
4294 case HtmlTokenId::BLOCKQUOTE_ON:
4295 case HtmlTokenId::BLOCKQUOTE30_ON:
4296 case HtmlTokenId::PREFORMTXT_ON:
4297 case HtmlTokenId::LISTING_ON:
4298 case HtmlTokenId::XMP_ON:
4301 case HtmlTokenId::ADDRESS_ON:
4302 case HtmlTokenId::DT_ON:
4303 case HtmlTokenId::DD_ON:
4307 OSL_ENSURE(
false,
"unknown style" );
4332 OUString aId, aStyle, aClass, aLang, aDir;
4335 for (
size_t i = rHTMLOptions.size();
i; )
4340 case HtmlOptionId::ID:
4343 case HtmlOptionId::STYLE:
4346 case HtmlOptionId::CLASS:
4349 case HtmlOptionId::LANG:
4352 case HtmlOptionId::DIR:
4369 bool bInDD =
false, bNotInDD =
false;
4374 switch( nCntxtToken )
4376 case HtmlTokenId::DEFLIST_ON:
4377 case HtmlTokenId::DIRLIST_ON:
4378 case HtmlTokenId::MENULIST_ON:
4379 case HtmlTokenId::ORDERLIST_ON:
4380 case HtmlTokenId::UNORDERLIST_ON:
4383 case HtmlTokenId::DD_ON:
4391 std::unique_ptr<HTMLAttrContext> xCntxt(
new HTMLAttrContext(HtmlTokenId::DEFLIST_ON));
4394 sal_uInt16 nLeft=0, nRight=0;
4407 ->GetTextLeftMargin();
4408 nLeft = nLeft +
static_cast<sal_uInt16
>(rTextLeftMargin.
GetTextLeft());
4411 xCntxt->SetMargins( nLeft, nRight, nIndent );
4419 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
4446 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext(HtmlTokenId::DEFLIST_ON));
4463 bool bInDefList =
false, bNotInDefList =
false;
4468 switch( nCntxtToken )
4470 case HtmlTokenId::DEFLIST_ON:
4473 case HtmlTokenId::DIRLIST_ON:
4474 case HtmlTokenId::MENULIST_ON:
4475 case HtmlTokenId::ORDERLIST_ON:
4476 case HtmlTokenId::UNORDERLIST_ON:
4477 bNotInDefList =
true;
4488 "Now an open paragraph element will be lost." );
4504 std::unique_ptr<HTMLAttrContext> xCntxt;
4509 switch( nCntxtToken )
4511 case HtmlTokenId::DD_ON:
4512 case HtmlTokenId::DT_ON:
4513 if(
nToken == HtmlTokenId::NONE ||
nToken == nCntxtToken )
4519 case HtmlTokenId::DEFLIST_ON:
4521 case HtmlTokenId::DIRLIST_ON:
4522 case HtmlTokenId::MENULIST_ON:
4523 case HtmlTokenId::ORDERLIST_ON:
4524 case HtmlTokenId::UNORDERLIST_ON:
4550 bool bSurroundOnly )
const
4556 bool bFound =
false;
4557 for (
size_t i=0;
i<rFrameFormatTable.
size();
i++ )
4569 ((RndStdIds::FLY_AT_PARA == pAnchor->
GetAnchorId()) ||
4570 (RndStdIds::FLY_AT_CHAR == pAnchor->
GetAnchorId())) &&
4571 *pAnchorNode == rNode )
4573 if( !(bNoSurroundOnly || bSurroundOnly) )
4584 if( bNoSurroundOnly )
4586 if( css::text::WrapTextMode_NONE==eSurround )
4594 if( css::text::WrapTextMode_NONE==eSurround )
4599 else if( css::text::WrapTextMode_THROUGH!=eSurround )
4626 const OUString rTopClass = pContext ? pContext->
GetClass() : OUString();
4632 short nFirstLineIndent = 0;
4635 if (bFuzzing && nDepth > 128)
4637 SAL_WARN(
"sw.html",
"Not applying any more text collection attributes to a deeply nested node for fuzzing performance");
4650 bool bSetThis =
true;
4690 aItemSet.
Set( rCollSet );
4691 pItemSet->
Put( aItemSet );
4698 pCollToSet = pNewColl;
4710 aItemSet.
Set( rCollSet );
4711 pItemSet->
Put( aItemSet );
4726 sal_uInt16 nLeft=0, nRight=0;
4728 pCntxt->
GetMargins( nLeft, nRight, nFirstLineIndent );
4736 if( pContext && nTopColl )
4742 nTopColl = nDfltColl;
4759 nLeft -= pColl->GetTextLeftMargin().GetTextLeft();
4760 nRight -= pColl->GetRightMargin().GetRight();
4777 pContext->
SetULSpace( pULItem->GetUpper(), pULItem->GetLower() );
4784 pCollToSet =
m_pCSS1Parser->GetTextCollFromPool( nDfltColl );
4793 if( !nFirstLineIndent )
4801 pParaAttr->Invalidate();
4825 pItemSet->
Put(firstLine);
4826 pItemSet->
Put(leftMargin);
4827 pItemSet->
Put(rightMargin);
4856 OUString aId, aStyle, aLang, aDir;
4860 for (
size_t i = rHTMLOptions.size();
i; )
4865 case HtmlOptionId::ID:
4868 case HtmlOptionId::STYLE:
4871 case HtmlOptionId::CLASS:
4874 case HtmlOptionId::LANG:
4877 case HtmlOptionId::DIR:
4889 OSL_ENSURE( pCFormat,
"No character format found for token" );
4897 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4899 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4900 "Class is not considered" );
4902 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(),
true );
4918 sal_Int16 eVertOri = text::VertOrientation::TOP;
4922 bool bPercentWidth =
false;
4923 bool bPercentHeight =
false;
4927 for (
size_t i = rHTMLOptions.size();
i; )
4932 case HtmlOptionId::TYPE:
4935 case HtmlOptionId::ALIGN:
4943 case HtmlOptionId::WIDTH:
4945 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
4948 case HtmlOptionId::HEIGHT:
4950 bPercentHeight = (rOption.
GetString().indexOf(
'%') != -1);
4953 case HtmlOptionId::SIZE:
4977 Size aSpace( 0, 0 );
4982 SetFixSize( aSize, aDfltSz, bPercentWidth, bPercentHeight,
4983 aDummyPropInfo, aFrameSet );
4984 SetSpace( aSpace, aDummyItemSet, aDummyPropInfo, aFrameSet );
4989 aFrameSet.Put( aProtectItem );
5007 MapMode(MapUnit::MapTwip) ).Height();
5032 aULSpace.
SetLower( aULSpace.
GetLower() + o3tl::narrowing<sal_uInt16>(nSize) );
5033 pTextNode->
SetAttr( aULSpace );
5054 MapMode(MapUnit::MapTwip) ).Width();
5059 sal_uInt16 nLeft=0, nRight=0;
5063 nIndent = nIndent +
static_cast<short>(nSize);
5079 m_xDoc->getIDocumentContentOperations().InsertString( *
m_pPam,
" " );
5127 for (
size_t i = rHTMLOptions.size();
i; )
5130 if( HtmlOptionId::ID==rOption.
GetToken() )
5137 if( !aId.isEmpty() )
5143 OUString aId, aStyle, aClass;
5148 for (
size_t i = rHTMLOptions.size();
i; )
5153 case HtmlOptionId::CLEAR:
5155 const OUString &rClear = rOption.
GetString();
5170 case HtmlOptionId::ID:
5173 case HtmlOptionId::STYLE:
5176 case HtmlOptionId::CLASS:
5184 std::shared_ptr<SvxFormatBreakItem> aBreakItem(std::make_shared<SvxFormatBreakItem>(SvxBreak::NONE,
RES_BREAK));
5185 bool bBreakItem =
false;
5198 if( !aPropInfo.
m_aId.isEmpty() )
5203 if( bBreakItem && SvxBreak::PageAfter == aBreakItem->GetBreak() )
5214 m_xDoc->getIDocumentContentOperations().InsertString(*
m_pPam,
"\x0A");
5237 if( bBreakItem && SvxBreak::PageBefore == aBreakItem->GetBreak() )
5246 sal_uInt16 nSize = 0;
5247 sal_uInt16 nWidth = 0;
5251 bool bPercentWidth =
false;
5252 bool bNoShade =
false;
5253 bool bColor =
false;
5260 for (
size_t i = rHTMLOptions.size();
i; )
5265 case HtmlOptionId::ID:
5268 case HtmlOptionId::SIZE:
5269 nSize = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
5271 case HtmlOptionId::WIDTH:
5272 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
5273 nWidth = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
5274 if( bPercentWidth && nWidth>=100 )
5278 bPercentWidth =
false;
5281 case HtmlOptionId::ALIGN:
5284 case HtmlOptionId::NOSHADE:
5287 case HtmlOptionId::COLOR:
5303 std::unique_ptr<HTMLAttrContext> xCntxt(
5314 if( nSize>0 || bColor || bNoShade )