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 )
5338 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::BOTTOM );
5352 nWidth = bPercentWidth ? o3tl::narrowing<sal_uInt16>((nWidth*nBrowseWidth) / 100)
5353 :
ToTwips( o3tl::narrowing<sal_uInt16>(nBrowseWidth) );
5361 ::std::optional<SvxTextLeftMarginItem> oLeft;
5362 ::std::optional<SvxRightMarginItem> oRight;
5366 case SvxAdjust::Right:
5369 case SvxAdjust::Left:
5372 case SvxAdjust::Center:
5395 if( !aId.isEmpty() )
5399 std::unique_ptr<HTMLAttrContext> xPoppedContext(
PopContext(HtmlTokenId::HORZRULE));
5400 xPoppedContext.reset();
5410 OUString
aName, aContent;
5411 bool bHTTPEquiv =
false;
5414 for (
size_t i = rHTMLOptions.size();
i; )
5419 case HtmlOptionId::NAME:
5423 case HtmlOptionId::HTTPEQUIV:
5427 case HtmlOptionId::CONTENT:
5444 aContent = aContent.replaceAll(
"\r",
"").replaceAll(
"\n",
"");
5458 OUStringBuffer sText(
5482 HTMLAttr **ppHd, std::shared_ptr<HTMLAttrTable> xAttrTab ) :
5483 m_nStartPara( rPos.
GetNode() ),
5485 m_nStartContent( rPos.GetContentIndex() ),
5486 m_nEndContent(rPos.GetContentIndex() ),
5487 m_bInsAtStart( true ),
5488 m_bLikePara( false ),
5490 m_pItem( rItem.
Clone() ),
5491 m_xAttrTab(
std::move( xAttrTab )),
5499 sal_Int32 nEndCnt,
HTMLAttr **ppHd, std::shared_ptr<HTMLAttrTable> xAttrTab ) :
5500 m_nStartPara( rAttr.m_nStartPara ),
5501 m_nEndPara( rEndPara ),
5502 m_nStartContent( rAttr.m_nStartContent ),
5503 m_nEndContent( nEndCnt ),
5504 m_bInsAtStart( rAttr.m_bInsAtStart ),
5505 m_bLikePara( rAttr.m_bLikePara ),
5506 m_bValid( rAttr.m_bValid ),
5507 m_pItem( rAttr.m_pItem->
Clone() ),
5508 m_xAttrTab(
std::move( xAttrTab )),
5531 HTMLAttr **ppHd,
const std::shared_ptr<HTMLAttrTable>& rAttrTab)
5549 "HTMLAttr::InsertPrev: pNext wrong" );
5553 "HTMLAttr::InsertPrev: ppHead wrong" );
5564 const uno::Reference<document::XDocumentProperties> & i_xDocProps,
5569 if (!ret && IsNewDoc())
5587 (*pName) = i_rMetaName;
5603 OUString aFilterOptions = pItem->GetValue();
5604 static constexpr OUStringLiteral aXhtmlNsKey(
u"xhtmlns=");
5605 if (aFilterOptions.startsWith(aXhtmlNsKey))
5607 OUString aNamespace = aFilterOptions.copy(aXhtmlNsKey.getLength());
5614 class FontCacheGuard
5626 FontCacheGuard aFontCacheGuard;
5643 catch (
const std::runtime_error&)
5646 catch (
const std::out_of_range&)
static OutputDevice * GetDefaultDevice()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
static bool Reschedule(bool bHandleAllCurrentEvents=false)
const OUString & GetValue() const
static const FontMetric & GetFontMetric(sal_Handle hFontMetric)
sal_Handle GetFirstFontMetric(std::u16string_view rName) const
void SetULSpace(sal_uInt16 nUpper, sal_uInt16 nLower)
sal_uInt16 GetDefaultTextFormatColl() const
sal_uInt16 GetTextFormatColl() const
void SetMargins(sal_uInt16 nLeft, sal_uInt16 nRight, short nIndent)
bool IsLRSpaceChanged() const
const OUString & GetClass() const
void GetMargins(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent) const
sal_Int32 GetEndContent() const
sal_Int32 m_nStartContent
SwNodeOffset GetEndParagraphIdx() const
HTMLAttr(const SwPosition &rPos, const SfxPoolItem &rItem, HTMLAttr **pHd, std::shared_ptr< HTMLAttrTable > xAttrTab)
void SetStart(const SwPosition &rPos)
HTMLAttr * GetPrev() const
void SetHead(HTMLAttr **ppHd, const std::shared_ptr< HTMLAttrTable > &rAttrTab)
void Reset(const SwNode &rSttPara, sal_Int32 nSttCnt, HTMLAttr **pHd, const std::shared_ptr< HTMLAttrTable > &rAttrTab)
HTMLAttr * GetNext() const
const SwNodeIndex & GetEndParagraph() const
SwNodeOffset GetStartParagraphIdx() const
void InsertNext(HTMLAttr *pNxt)
std::unique_ptr< SfxPoolItem > m_pItem
const SwNodeIndex & GetStartParagraph() const
void InsertPrev(HTMLAttr *pPrv)
sal_Int32 GetStartContent() const
HTMLAttr * Clone(const SwNode &rEndPara, sal_Int32 nEndCnt) const
std::shared_ptr< HTMLAttrTable > m_xAttrTab
HtmlOptionId GetToken() const
const OUString & GetString() const
sal_Int32 GetSNumber() const
EnumT GetEnum(const HTMLOptionEnum< EnumT > *pOptEnums, EnumT nDflt=static_cast< EnumT >(0)) const
void GetColor(Color &) const
sal_uInt32 GetNumber() const
virtual SvParserState CallParser() override
virtual bool ParseMetaOptions(const css::uno::Reference< css::document::XDocumentProperties > &, SvKeyValueIterator *)
virtual void Continue(HtmlTokenId nToken) override
virtual ErrCode Read(SwDoc &, const OUString &rBaseURL, SwPaM &, const OUString &) override
virtual bool SetStrmStgPtr() override
void SetupFilterOptions()
Parse FilterOptions passed to the importer.
virtual OUString GetTemplateName(SwDoc &rDoc) const override
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
virtual ::sw::mark::IMark * makeMark(const SwPaM &rPaM, const OUString &rProposedName, MarkType eMark, ::sw::mark::InsertMode eMode, SwPosition const *pSepPos=nullptr)=0
Generates a new mark in the document for a certain selection.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
OUString GetMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
static void ResetFrameFormats(SwDoc &rDoc)
bool m_bTemplateBrowseMode
bool m_bIgnoreHTMLComments
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
bool ParseAreaOptions(ImageMap *pImageMap, std::u16string_view rBaseURL, SvMacroItemId nEventMouseOver, SvMacroItemId nEventMouseOut)
bool ParseMapOptions(ImageMap *pImageMap)
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool Set(const SfxItemSet &, bool bDeep=true)
void Differentiate(const SfxItemSet &rSet)
const INetURLObject & GetURLObject() const
SfxItemSet & GetItemSet() const
const css::uno::Sequence< css::beans::PropertyValue > & GetArgs() const
SvKeyValueIterator * GetHeaderAttributes()
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
virtual void ResetError()
bool StartListening(SvtBroadcaster &rBroadcaster)
bool SearchFile(OUString &rIniFile, Paths ePath=Paths::UserConfig)
static const sal_Int16 Medium
static const sal_Int16 Hairline
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
static void PixelToTwip(tools::Long &nWidth, tools::Long &nHeight)
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
short GetTextFirstLineOffset() const
const FontList * GetFontList() const
tools::Long GetRight() const
tools::Long GetLeft() const
void SetContentProtect(bool bNew)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
tools::Long GetRight() const
tools::Long GetHeight() const
tools::Long GetWidth() const
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
tools::Long GetTextLeft() const
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
SwContentIndex & Assign(const SwContentNode *, sal_Int32)
bool HasSwAttrSet() const
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
virtual bool SetAttr(const SfxPoolItem &)
made virtual
bool CanJoinPrev(SwNodeIndex *pIdx=nullptr) const
Can we join two Nodes? We can return the 2nd position in pIdx.
virtual sal_Int32 Len() const
const SwAttrSet * GetpSwAttrSet() const
SwFormatColl & GetAnyFormatColl() const
bool MovePara(SwWhichPara, SwMoveFnCollection const &)
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
SwDoc * GetDoc()
returns Doc. But be careful!
void SetInReading(bool bNew)
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentSettingAccess const & getIDocumentSettingAccess() const
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
sal_uInt8 GetLevel() const
sal_uInt16 GetDepth() const
virtual SvParserState CallParser() override
std::shared_ptr< HTMLTable > m_xTable
SwViewShell * CheckActionViewShell()
void PushContext(std::unique_ptr< HTMLAttrContext > &rCntxt)
const SwFormatColl * GetCurrFormatColl() const
bool CanRemoveNode(SwNodeOffset nNodeIdx) const
void FillFootNoteInfo(std::u16string_view aContent)
sal_uInt16 m_nDefListDeep
std::stack< SwOLENode * > m_aEmbeds
Non-owning pointers to already inserted OLE nodes, matching opened <object> XHTML elements.
void NewDivision(HtmlTokenId nToken)
void NewDefListItem(HtmlTokenId nToken)
void NewFontAttr(HtmlTokenId nToken)
void NewMarquee(HTMLTable *pCurTable=nullptr)
size_t m_nContextStAttrMin
std::unique_ptr< HTMLAttrContext > PopContext(HtmlTokenId nToken=HtmlTokenId::NONE)
void SetAnchorAndAdjustment(sal_Int16 eVertOri, sal_Int16 eHoriOri, const SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFrameSet)
static sal_uInt16 ToTwips(sal_uInt16 nPixel)
void NewCharFormat(HtmlTokenId nToken)
void InsertAttrs(std::deque< std::unique_ptr< HTMLAttr > > rAttrs)
void InsertBookmark(const OUString &rName)
bool CreateContainer(std::u16string_view rClass, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, HTMLAttrContext *pContext)
HtmlTokenId m_nOpenParaToken
std::unique_ptr< ImportProgress > m_xProgress
HTMLAttrContexts m_aContexts
std::unique_ptr< SwHTMLNumRuleInfo > m_pNumRuleInfo
void InsertComment(const OUString &rName, std::string_view pTag={})
void InsertAttr(const SfxPoolItem &rItem, bool bInsAtStart)
static void SetSpace(const Size &rPixSpace, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFlyItemSet)
virtual void NextToken(HtmlTokenId nToken) override
void ParseMoreMetaOptions()
void EndForm(bool bAppend=true)
void SaveAttrTab(std::shared_ptr< HTMLAttrTable > const &rNewAttrTab)
void NewMultiCol(sal_uInt16 columnsFromCss=0)
sal_uInt16 m_nMissingImgMaps
std::shared_ptr< HTMLAttrTable > m_xAttrTab
void SetAttr(bool bChkEnd=true, bool bBeforeTable=false, std::deque< std::unique_ptr< HTMLAttr > > *pPostIts=nullptr)
sal_uInt32 m_aFontHeights[7]
virtual void Notify(const SfxHint &) override
void EndTag(HtmlTokenId nToken)
void ClearContext(HTMLAttrContext *pContext)
void NewTextFormatColl(HtmlTokenId nToken, sal_uInt16 nPoolId)
std::shared_ptr< HTMLTable > BuildTable(SvxAdjust eCellAdjust, bool bIsParentHead=false, bool bHasParentSection=true, bool bHasToFlow=false)
void FillEndNoteInfo(std::u16string_view aContent)
bool m_bIgnoreHTMLComments
void EndNumberBulletListItem(HtmlTokenId nToken, bool bSetColl)
std::set< OUString > m_aAllowedRTFOLEMimeTypes
bool DoPositioning(SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, HTMLAttrContext *pContext)
SwViewShell * CallStartAction(SwViewShell *pVSh=nullptr, bool bChkPtr=true)
void DeleteAttr(HTMLAttr *pAttr)
static bool HasStyleOptions(std::u16string_view rStyle, std::u16string_view rId, std::u16string_view rClass, const OUString *pLang=nullptr, const OUString *pDir=nullptr)
std::vector< sal_uInt16 > m_aFontStack
virtual ~SwHTMLParser() override
virtual void Continue(HtmlTokenId nToken) override
SwHTMLNumRuleInfo & GetNumInfo()
void SetTextCollAttrs(HTMLAttrContext *pContext=nullptr)
bool m_isInTableStructure
static void SetFixSize(const Size &rPixSize, const Size &rTwipDfltSize, bool bPercentWidth, bool bPercentHeight, SvxCSS1PropertyInfo const &rPropInfo, SfxItemSet &rFlyItemSet)
void NewAttr(const std::shared_ptr< HTMLAttrTable > &rAttrTab, HTMLAttr **ppAttr, const SfxPoolItem &rItem)
SwNodeIndex * m_pSttNdIdx
rtl::Reference< SwDoc > m_xDoc
bool ParseStyleOptions(const OUString &rStyle, const OUString &rId, const OUString &rClass, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const OUString *pLang=nullptr, const OUString *pDir=nullptr)
virtual void AddMetaUserDefined(OUString const &i_rMetaName) override
HTMLScriptLanguage m_eScriptLang
void SetAttr_(bool bChkEnd, bool bBeforeTable, std::deque< std::unique_ptr< HTMLAttr > > *pPostIts)
void InsertFootEndNoteText()
void EndDefListItem(HtmlTokenId nToken=HtmlTokenId::NONE)
void InsertSelectOption()
sal_Int32 StripTrailingLF()
std::vector< sal_uInt16 > m_aBaseFontStack
rtl::Reference< SdrObject > m_pMarquee
std::unique_ptr< SwCSS1Parser > m_pCSS1Parser
SwTwips GetCurrentBrowseWidth()
std::unique_ptr< SwApplet_Impl > m_pAppletImpl
void EndNumberBulletList(HtmlTokenId nToken=HtmlTokenId::NONE)
sal_uInt16 m_nFontStHeadStart
std::vector< SwPending > m_vPendingStack
std::unique_ptr< ImageMaps > m_pImageMaps
all Image-Maps that have been read
void InsertParaAttrs(const SfxItemSet &rItemSet)
SfxViewFrame * m_pTempViewFrame
bool AppendTextNode(SwHTMLAppendMode eMode=AM_NORMAL, bool bUpdateNum=true)
void NewStdAttr(HtmlTokenId nToken)
OUString m_InfoNames[4]
the names corresponding to the DOCINFO field subtypes INFO[1-4]
void InsertTextAreaText(HtmlTokenId nToken)
void NewNumberBulletList(HtmlTokenId nToken)
void RegisterFlyFrame(SwFrameFormat *pFlyFrame)
void NewNumberBulletListItem(HtmlTokenId nToken)
void GetMarginsFromContext(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent, bool bIgnoreCurrent=false) const
void EndContext(HTMLAttrContext *pContext)
void GetMarginsFromContextWithNumberBullet(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent) const
void NewHeading(HtmlTokenId nToken)
void EndPara(bool bReal=false)
bool m_bInFootEndNoteAnchor
void EndTextFormatColl(HtmlTokenId nToken)
sal_uInt16 m_nBaseFontStMin
void EndFontAttr(HtmlTokenId nToken)
void SplitAttrTab(const SwPosition &rNewPos)
bool HasCurrentParaBookmarks(bool bIgnoreStack=false) const
bool m_bInFootEndNoteSymbol
void SetNodeNum(sal_uInt8 nLevel)
SwHTMLParser(SwDoc *pD, SwPaM &rCursor, SvStream &rIn, OUString aFileName, OUString aBaseURL, bool bReadNewDoc, SfxMedium *pMed, bool bReadUTF8, bool bIgnoreHTMLComments, const OUString &rNamespace)
void InsertCommentText(std::string_view pTag)
std::vector< std::unique_ptr< SwHTMLFrameFormatListener > > m_aMoveFlyFrames
bool EndAttr(HTMLAttr *pAttr, bool bChkEmpty=true)
std::unique_ptr< SwHTMLFootEndNote_Impl > m_pFootEndNoteImpl
virtual bool ParseMetaOptions(const css::uno::Reference< css::document::XDocumentProperties > &, SvKeyValueIterator *) override
void RestoreAttrTab(std::shared_ptr< HTMLAttrTable > const &rNewAttrTab)
SwViewShell * CallEndAction(bool bChkAction=false, bool bChkPtr=true)
std::deque< sal_Int32 > m_aMoveFlyCnts
bool HasCurrentParaFlys(bool bNoSurroundOnly=false, bool bSurroundOnly=false) const
void InsertFloatingFrame()
SwViewShell * m_pActionViewShell
void NewForm(bool bAppend=true)
static sal_uInt16 GetBrowseWidth(const SwDoc &rDoc)
Calculate available width.
Marks a node in the document model.
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
bool IsContentNode() const
SwNodeOffset StartOfSectionIndex() const
bool IsSectionNode() const
const SwStartNode * FindFootnoteStartNode() const
SwTableNode * FindTableNode()
Search table node, in which it is.
const SwStartNode * StartOfSectionNode() const
SwNodeOffset EndOfSectionIndex() const
SwContentNode * GetContentNode()
bool IsInVisibleArea(SwViewShell const *pSh) const
Is node in the visible area of the Shell?
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
static SwContentNode * GoPrevious(SwNodeIndex *)
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwNode & GetPointNode() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
SwContentNode * GetPointContentNode() const
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
SwPosition & GetBound(bool bOne=true)
const SwPosition * GetPoint() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
void Pos(const Point &rNew)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
const SfxPoolItem & GetAttr() const
virtual const sal_Int32 * GetEnd() const
end position
sal_Int32 GetStart() const
Represents the style of a paragraph.
SwTextNode is a paragraph in the document model.
virtual SwContentNode * JoinNext() override
void DeleteAttribute(SwTextAttr *const pTextAttr)
delete the attribute pTextAttr
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
SwpHints & GetSwpHints()
getters for SwpHints
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
SwpHints * GetpSwpHints()
const OUString & GetText() const
SwTextFormatColl * GetTextColl() const
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
virtual sal_uInt16 ResetAllAttr() override
bool IsViewLocked() const
void EndAction(const bool bIdleEnd=false)
const SwRect & VisArea() const
bool HasInvalidRect() const
An SwTextAttr container, stores all directly formatted text portions for a text node.
SwTextAttr * Get(size_t nPos) const
iterator find(const OUString &rKey)
void SetWidth(tools::Long nWidth)
void SetBorderLineStyle(SvxBorderLineStyle nNew)
rtl_TextEncoding GetCharSet() const
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
bool swhtml_css1atr_equalFontItems(const SfxPoolItem &r1, const SfxPoolItem &r2)
bool JumpToSwMark(SwViewShell const *pVwSh, std::u16string_view rMark)
EmbeddedObjectRef * pObject
@ Database
For old documents the Field-Which IDs must be preserved !!!
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
bool isTXTATR_WITHEND(const sal_uInt16 nWhich)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
bool isCHRATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr TypedWhichId< SvxFirstLineIndentItem > RES_MARGIN_FIRSTLINE(91)
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)
bool isTXTATR_NOEND(const sal_uInt16 nWhich)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SfxStringItem > RES_FLTR_BOOKMARK(RES_FLTRATTR_BEGIN)
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(106)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
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< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SvxRightMarginItem > RES_MARGIN_RIGHT(93)
constexpr TypedWhichId< SvxTextLeftMarginItem > RES_MARGIN_TEXTLEFT(92)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
constexpr TypedWhichId< SvxKerningItem > RES_CHRATR_KERNING(9)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
HTMLOptionEnum< sal_Int16 > const aHTMLImgVAlignTable[]
HTMLOptionEnum< sal_Int16 > const aHTMLImgHAlignTable[]
#define OOO_STRING_SVTOOLS_HTML_O_httpequiv
#define OOO_STRING_SVTOOLS_HTML_SPTYPE_vertical
#define OOO_STRING_SVTOOLS_HTML_meta
#define OOO_STRING_SVTOOLS_HTML_AL_left
#define OOO_STRING_SVTOOLS_HTML_AL_char
#define OOO_STRING_SVTOOLS_HTML_META_sdfootnote
#define OOO_STRING_SVTOOLS_HTML_META_sdendnote
#define OOO_STRING_SVTOOLS_HTML_SPTYPE_block
#define OOO_STRING_SVTOOLS_HTML_META_refresh
#define OOO_STRING_SVTOOLS_HTML_AL_all
#define OOO_STRING_SVTOOLS_HTML_AL_center
#define OOO_STRING_SVTOOLS_HTML_META_content_script_type
#define OOO_STRING_SVTOOLS_HTML_O_content
#define OOO_STRING_SVTOOLS_HTML_SPTYPE_horizontal
#define OOO_STRING_SVTOOLS_HTML_AL_right
#define OOO_STRING_SVTOOLS_HTML_AL_justify
#define OOO_STRING_SVTOOLS_HTML_O_name
#define OOO_STRING_SVTOOLS_HTML_META_content_type
#define OOO_STRING_SVTOOLS_HTML_META_generator
#define OOO_STRING_SVTOOLS_HTML_noembed
#define OOO_STRING_SVTOOLS_HTML_AL_middle
constexpr HtmlTokenId getOnToken(HtmlTokenId nToken)
constexpr bool isOffToken(HtmlTokenId nToken)
LineEnd GetSystemLineEnd()
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
tools::Long const nRightMargin
tools::Long const nLeftMargin
OString strip(const OString &rIn, char c)
std::shared_ptr< T > make_shared(Args &&... args)
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
bool GoPrevPara(SwPaM &rPam, SwMoveFnCollection const &aPosPara)
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
SwMoveFnCollection const & fnParaEnd
SwMoveFnCollection const & fnMoveBackward
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
::std::vector< HTMLOption > HTMLOptions
@ RES_POOLCOLL_HEADLINE5
Heading 5.
@ RES_POOLCOLL_TEXT
Text body.
@ RES_POOLCOLL_STANDARD
Standard.
@ RES_POOLCOLL_HEADLINE6
Heading 6.
@ RES_POOLCOLL_HTML_BLOCKQUOTE
@ RES_POOLCOLL_TABLE
Subgroup table.
@ RES_POOLCOLL_SEND_ADDRESS
Sender.
@ RES_POOLCOLL_HEADLINE2
Heading 2.
@ RES_POOLCOLL_HEADLINE4
Heading 4.
@ RES_POOLCOLL_HEADLINE1
Heading 1.
@ RES_POOLCOLL_TABLE_HDLN
Table of Contents - heading.
@ RES_POOLCOLL_HEADLINE3
Heading 3.
#define STREAM_SEEK_TO_END
#define STREAM_SEEK_TO_BEGIN
Marks a position in the document model.
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
SwNodeOffset GetNodeIndex() const
sal_Int32 GetContentIndex() const
#define ERR_FORMAT_ROWCOL
#define ERR_SWG_READ_ERROR
SAL_DLLPUBLIC_EXPORT void FlushFontCache()
#define HTML_SPTYPE_BLOCK
HTMLOptionEnum< SvxAdjust > const aHTMLPAlignTable[]
IMPL_LINK_NOARG(SwHTMLParser, AsyncCallback, void *, void)
static void lcl_swhtml_getItemInfo(const HTMLAttr &rAttr, bool &rScriptDependent, sal_uInt16 &rScriptType)
HTMLOptionEnum< sal_uInt16 > const aHTMLSpacerTypeTable[]
bool TestImportHTML(SvStream &rStream)
std::vector< std::unique_ptr< ImageMap > > ImageMaps
constexpr tools::Long HTML_CJK_PARSPACE
constexpr tools::Long HTML_CTL_PARSPACE
constexpr SwTwips DOCUMENTBORDER
const sal_Unicode cMarkSeparator
SVXCORE_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)