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
101 #include <editsh.hxx>
117 #include <officecfg/Office/Writer.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 const OUString sTemplateWithoutExt(
"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 );
255 const OUString& rPath,
256 const OUString& rBaseURL,
259 bool bNoHTMLComments,
260 const OUString& rNamespace )
262 m_aPathToFile( rPath ),
263 m_sBaseURL( rBaseURL ),
267 m_pActionViewShell( nullptr ),
268 m_pSttNdIdx( nullptr ),
269 m_pFormImpl( nullptr ),
270 m_pMarquee( nullptr ),
271 m_pImageMap( nullptr ),
272 m_nBaseFontStMin( 0 ),
275 m_nFontStHeadStart( 0 ),
277 m_nMissingImgMaps( 0 ),
280 m_nContextStMin( 0 ),
281 m_nContextStAttrMin( 0 ),
282 m_nSelectEntryCnt( 0 ),
289 m_bDocInitalized( false ),
290 m_bSetModEnabled( false ),
291 m_bInFloatingFrame( 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_pTempViewFrame(nullptr)
346 m_xDoc->SetDefault( aFontHeight );
348 m_xDoc->SetDefault( aFontHeightCJK );
350 m_xDoc->SetDefault( aFontHeightCTL );
366 SetSrcEncoding( RTL_TEXTENCODING_UTF8 );
374 SetEncodingByHTTPHeader( pHeaderAttrs );
376 m_pCSS1Parser->SetDfltEncoding( osl_getThreadTextEncoding() );
392 sal_Int32
nPos = nLastPos != -1 ? nLastPos : 0;
397 sCmp =
m_sJmpMark.copy(nPos + 1).replaceAll(
" ",
"");
400 if( !sCmp.isEmpty() )
402 sCmp = sCmp.toAsciiLowerCase();
403 if( sCmp ==
"region" )
405 else if( sCmp ==
"table" )
407 else if( sCmp ==
"graphic" )
409 else if( sCmp ==
"outline" ||
428 if (!rNamespace.isEmpty())
430 SetNamespace(rNamespace);
432 if (rNamespace ==
"reqif-xhtml")
443 auto it = aLoadMap.
find(
"AllowedRTFOLEMimeTypes");
444 if (it == aLoadMap.end())
449 uno::Sequence<OUString>
aTypes;
450 it->second >>= aTypes;
460 OSL_ENSURE(
m_aContexts.empty(),
"There are still contexts on the stack");
465 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
469 bool bAsync =
m_xDoc->IsInLoadAsynchron();
470 m_xDoc->SetInLoadAsynchron(
false );
477 if(
m_xDoc->GetDocShell() )
480 sal_uInt16 nLinkMode =
m_xDoc->getIDocumentSettingAccess().getLinkUpdateMode(
true );
481 if( nLinkMode !=
NEVER && bAsync &&
482 SfxObjectCreateMode::INTERNAL!=
m_xDoc->GetDocShell()->GetCreateMode() )
483 m_xDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks( nLinkMode ==
MANUAL,
false,
nullptr );
485 if (
m_xDoc->GetDocShell()->IsLoading() )
488 m_xDoc->GetDocShell()->LoadingFinished();
496 OSL_ENSURE(
m_aSetAttrTab.empty(),
"There are still attributes on the stack" );
499 m_aSetAttrTab.clear();
507 OSL_ENSURE(!
m_xTable,
"It exists still an open table");
511 "SwHTMLParser::~SwHTMLParser: Here should not be Pending-Stack anymore" );
522 m_xDoc->GetDocShell()->GetMedium()->GetItemSet()->ClearItem( SID_HIDDEN );
532 if( ( m_xDoc->GetDocShell() && m_xDoc->GetDocShell()->IsAbortingImport() )
533 || 1 == m_xDoc->getReferenceCount() )
536 eState = SvParserState::Error;
539 GetAsynchCallLink().Call(
nullptr);
550 m_xDoc->getIDocumentContentOperations().SplitNode( *pPos,
false );
553 m_xDoc->getIDocumentContentOperations().SplitNode( *pPos,
false );
555 SwPaM aInsertionRangePam( *pPos );
563 m_xDoc->getIDocumentRedlineAccess().SplitRedline( aInsertionRangePam );
607 OSL_ENSURE(!
m_nContinue,
"Continue in Continue - not supposed to happen");
613 OSL_ENSURE( SvParserState::Error!=eState,
614 "SwHTMLParser::Continue: already set an error" );
615 if(
m_xDoc->GetDocShell() &&
m_xDoc->GetDocShell()->IsAbortingImport() )
616 eState = SvParserState::Error;
627 eState = SvParserState::Pending;
629 m_xDoc->SetInLoadAsynchron(
true );
639 if(
m_xDoc->GetDocShell() )
644 m_xDoc->GetDocShell()->EnableSetModified(
false );
652 bool bModified =
m_xDoc->getIDocumentState().IsModified();
653 bool const bWasUndo =
m_xDoc->GetIDocumentUndoRedo().DoesUndo();
654 m_xDoc->GetIDocumentUndoRedo().DoUndo(
false);
659 if( SvParserState::Error == eState )
662 "SwHTMLParser::Continue: Pending-Stack without Token" );
666 "SwHTMLParser::Continue: There is again a Pending-Stack" );
676 bool bLFStripped =
false;
677 if( SvParserState::Pending != GetStatus() )
711 for (
int i = 0;
i < 2; ++
i)
715 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
738 if( pTextNode && pTextNode->
CanJoinNext( &aNxtIdx ))
740 const sal_Int32 nStt = pTextNode->
GetText().getLength();
748 #if OSL_DEBUG_LEVEL > 0
751 "Pam.Bound1 is still in the node" );
753 "Pam.Bound2 is still in the node" );
759 pTextNode->
GetText().getLength() + nCntPos );
765 pTextNode->
GetText().getLength() + nCntPos );
770 if (pTextNode->
GetText().getLength())
779 if( SvParserState::Accepted == eState )
795 bool bHasFlysOrMarks =
822 else if(
nullptr != ( pCurrentNd =
m_xDoc->GetNodes()[ nNodeIdx ]->GetTextNode()) && !bHasFlysOrMarks )
831 else if (pCurrentNd->
GetText().isEmpty())
842 else if( !IsNewDoc() )
848 if( pTextNode && pTextNode->
CanJoinPrev( &aPrvIdx ) &&
877 OSL_ENSURE(pDocShell,
"no SwDocShell");
879 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
880 pDocShell->GetModel(), uno::UNO_QUERY_THROW);
881 uno::Reference<document::XDocumentProperties> xDocProps(
882 xDPS->getDocumentProperties());
883 OSL_ENSURE(xDocProps.is(),
"DocumentProperties is null");
884 if ( xDocProps.is() && (xDocProps->getAutoloadSecs() > 0) &&
885 (xDocProps->getAutoloadURL().isEmpty()) )
894 m_xDoc->getIDocumentStatistics().UpdateDocStat(
false,
true );
898 if( SvParserState::Pending != GetStatus() )
906 if( 1 <
m_xDoc->getReferenceCount() )
910 m_xDoc->GetIDocumentUndoRedo().DelAllUndoObj();
911 m_xDoc->GetIDocumentUndoRedo().DoUndo(
true);
922 m_xDoc->GetIDocumentUndoRedo().DoUndo(
true);
926 m_xDoc->SetOle2Link( aOLELink );
928 m_xDoc->getIDocumentState().ResetModified();
931 m_xDoc->GetDocShell()->EnableSetModified();
948 if(rHint.
GetId() == SfxHintId::Dying)
966 m_xDoc->GetIDocumentUndoRedo().DoUndo(
false);
976 if( (
m_xDoc->GetDocShell() &&
m_xDoc->GetDocShell()->IsAbortingImport() )
977 || 1 ==
m_xDoc->getReferenceCount() )
981 eState = SvParserState::Error;
983 "SwHTMLParser::NextToken: Pending-Stack without token" );
988 #if OSL_DEBUG_LEVEL > 0
994 case HtmlTokenId::TABLE_ON:
997 case HtmlTokenId::LINK:
999 case HtmlTokenId::INPUT:
1000 case HtmlTokenId::TEXTAREA_ON:
1001 case HtmlTokenId::SELECT_ON:
1002 case HtmlTokenId::SELECT_OFF:
1005 OSL_ENSURE(
m_vPendingStack.empty(),
"Unknown token for Pending-Stack" );
1020 case HtmlTokenId::TITLE_OFF:
1022 OUString sTitle =
m_sTitle.makeStringAndClear();
1023 if( IsNewDoc() && !sTitle.isEmpty() )
1025 if(
m_xDoc->GetDocShell() ) {
1026 uno::Reference<document::XDocumentPropertiesSupplier>
1027 xDPS(
m_xDoc->GetDocShell()->GetModel(),
1028 uno::UNO_QUERY_THROW);
1029 uno::Reference<document::XDocumentProperties> xDocProps(
1030 xDPS->getDocumentProperties());
1031 OSL_ENSURE(xDocProps.is(),
"no DocumentProperties");
1032 if (xDocProps.is()) {
1033 xDocProps->setTitle(sTitle);
1036 m_xDoc->GetDocShell()->SetTitle(sTitle);
1043 case HtmlTokenId::NONBREAKSPACE:
1047 case HtmlTokenId::SOFTHYPH:
1051 case HtmlTokenId::TEXTTOKEN:
1057 if( (nToken >= HtmlTokenId::ONOFF_START) &&
isOffToken(nToken) )
1060 if( !aToken.isEmpty() )
1079 bool bGetIDOption =
false, bInsertUnknown =
false;
1091 if( HtmlTokenId::IFRAME_OFF == nToken )
1103 case HtmlTokenId::NOEMBED_OFF:
1111 case HtmlTokenId::RAWDATA:
1116 OSL_ENSURE(
false,
"SwHTMLParser::NextToken: invalid tag" );
1130 case HtmlTokenId::APPLET_OFF:
1134 case HtmlTokenId::OBJECT_OFF:
1138 case HtmlTokenId::PARAM:
1153 case HtmlTokenId::TEXTAREA_OFF:
1170 case HtmlTokenId::SELECT_OFF:
1175 case HtmlTokenId::OPTION:
1179 case HtmlTokenId::TEXTTOKEN:
1183 case HtmlTokenId::INPUT:
1184 case HtmlTokenId::SCRIPT_ON:
1185 case HtmlTokenId::SCRIPT_OFF:
1186 case HtmlTokenId::NOSCRIPT_ON:
1187 case HtmlTokenId::NOSCRIPT_OFF:
1188 case HtmlTokenId::RAWDATA:
1204 case HtmlTokenId::MARQUEE_OFF:
1209 case HtmlTokenId::TEXTTOKEN:
1221 case HtmlTokenId::SDFIELD_OFF:
1226 case HtmlTokenId::TEXTTOKEN:
1238 case HtmlTokenId::ANCHOR_OFF:
1243 case HtmlTokenId::TEXTTOKEN:
1254 if (!aToken.isEmpty() && !IsInHeader() )
1258 m_xDoc->getIDocumentContentOperations().InsertString( *
m_pPam, aToken );
1272 case HtmlTokenId::UNKNOWNCONTROL_OFF:
1276 case HtmlTokenId::FRAMESET_ON:
1277 case HtmlTokenId::HEAD_OFF:
1278 case HtmlTokenId::BODY_ON:
1279 case HtmlTokenId::IMAGE:
1282 case HtmlTokenId::TEXTTOKEN:
1293 case HtmlTokenId::BODY_ON:
1321 case HtmlTokenId::LINK:
1325 case HtmlTokenId::BASE:
1328 for (
size_t i = rHTMLOptions.size();
i; )
1333 case HtmlOptionId::HREF:
1336 case HtmlOptionId::TARGET:
1340 OSL_ENSURE(pDocShell,
"no SwDocShell");
1342 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1343 pDocShell->GetModel(), uno::UNO_QUERY_THROW);
1344 uno::Reference<document::XDocumentProperties>
1345 xDocProps(xDPS->getDocumentProperties());
1346 OSL_ENSURE(xDocProps.is(),
"no DocumentProperties");
1347 if (xDocProps.is()) {
1348 xDocProps->setDefaultTarget(
1360 case HtmlTokenId::META:
1370 OSL_ENSURE(pDocShell,
"no SwDocShell");
1373 uno::Reference<document::XDocumentProperties> xDocProps;
1376 const uno::Reference<document::XDocumentPropertiesSupplier>
1377 xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
1378 xDocProps = xDPS->getDocumentProperties();
1379 OSL_ENSURE(xDocProps.is(),
"DocumentProperties is null");
1386 case HtmlTokenId::TITLE_ON:
1390 case HtmlTokenId::SCRIPT_ON:
1394 case HtmlTokenId::SCRIPT_OFF:
1398 case HtmlTokenId::NOSCRIPT_ON:
1399 case HtmlTokenId::NOSCRIPT_OFF:
1400 bInsertUnknown =
true;
1403 case HtmlTokenId::STYLE_ON:
1407 case HtmlTokenId::STYLE_OFF:
1411 case HtmlTokenId::RAWDATA:
1414 if( IsReadScript() )
1418 else if( IsReadStyle() )
1427 case HtmlTokenId::OBJECT_ON:
1434 #if HAVE_FEATURE_JAVA
1440 case HtmlTokenId::OBJECT_OFF:
1445 case HtmlTokenId::APPLET_ON:
1446 #if HAVE_FEATURE_JAVA
1452 case HtmlTokenId::IFRAME_ON:
1457 case HtmlTokenId::LINEBREAK:
1464 bGetIDOption =
true;
1468 case HtmlTokenId::NEWPARA:
1471 if( HtmlTokenId::NEWPARA==nToken ||
1484 case HtmlTokenId::NONBREAKSPACE:
1488 case HtmlTokenId::SOFTHYPH:
1492 case HtmlTokenId::LINEFEEDCHAR:
1502 case HtmlTokenId::TEXTTOKEN:
1504 if( !aToken.isEmpty() &&
' '==aToken[0] && !IsReadPRE() )
1510 const OUString& rText = pTextNode->
GetText();
1512 if(
' ' == cLast ||
'\x0a' == cLast)
1513 aToken = aToken.copy(1);
1516 aToken = aToken.copy(1);
1518 if( aToken.isEmpty() )
1525 if( !aToken.isEmpty() )
1536 = dynamic_cast<SwFlyFrameFormat*>(pOLENode->
GetFlyFormat()))
1546 m_xDoc->getIDocumentContentOperations().InsertString( *
m_pPam, aToken );
1557 case HtmlTokenId::HORZRULE:
1561 case HtmlTokenId::IMAGE:
1565 if( 1 ==
m_xDoc->getReferenceCount() )
1567 eState = SvParserState::Error;
1571 case HtmlTokenId::SPACER:
1575 case HtmlTokenId::EMBED:
1579 case HtmlTokenId::NOEMBED_ON:
1585 case HtmlTokenId::DEFLIST_ON:
1590 case HtmlTokenId::DEFLIST_OFF:
1597 case HtmlTokenId::DD_ON:
1598 case HtmlTokenId::DT_ON:
1605 case HtmlTokenId::DD_OFF:
1606 case HtmlTokenId::DT_OFF:
1614 case HtmlTokenId::DIVISION_ON:
1615 case HtmlTokenId::CENTER_ON:
1629 case HtmlTokenId::DIVISION_OFF:
1630 case HtmlTokenId::CENTER_OFF:
1644 case HtmlTokenId::MULTICOL_ON:
1650 case HtmlTokenId::MULTICOL_OFF:
1653 EndTag( HtmlTokenId::MULTICOL_ON );
1656 case HtmlTokenId::MARQUEE_ON:
1661 case HtmlTokenId::FORM_ON:
1664 case HtmlTokenId::FORM_OFF:
1669 case HtmlTokenId::PARABREAK_ON:
1675 case HtmlTokenId::PARABREAK_OFF:
1679 case HtmlTokenId::ADDRESS_ON:
1685 case HtmlTokenId::ADDRESS_OFF:
1691 case HtmlTokenId::BLOCKQUOTE_ON:
1692 case HtmlTokenId::BLOCKQUOTE30_ON:
1698 case HtmlTokenId::BLOCKQUOTE_OFF:
1699 case HtmlTokenId::BLOCKQUOTE30_OFF:
1705 case HtmlTokenId::PREFORMTXT_ON:
1706 case HtmlTokenId::LISTING_ON:
1707 case HtmlTokenId::XMP_ON:
1713 case HtmlTokenId::PREFORMTXT_OFF:
1718 case HtmlTokenId::LISTING_OFF:
1719 case HtmlTokenId::XMP_OFF:
1723 case HtmlTokenId::HEAD1_ON:
1724 case HtmlTokenId::HEAD2_ON:
1725 case HtmlTokenId::HEAD3_ON:
1726 case HtmlTokenId::HEAD4_ON:
1727 case HtmlTokenId::HEAD5_ON:
1728 case HtmlTokenId::HEAD6_ON:
1739 case HtmlTokenId::HEAD1_OFF:
1740 case HtmlTokenId::HEAD2_OFF:
1741 case HtmlTokenId::HEAD3_OFF:
1742 case HtmlTokenId::HEAD4_OFF:
1743 case HtmlTokenId::HEAD5_OFF:
1744 case HtmlTokenId::HEAD6_OFF:
1748 case HtmlTokenId::TABLE_ON:
1755 OSL_ENSURE(!m_xTable,
"table in table not allowed here");
1758 m_xDoc->GetNodes().GetEndOfExtras().GetIndex() ||
1776 case HtmlTokenId::DIRLIST_ON:
1777 case HtmlTokenId::MENULIST_ON:
1778 case HtmlTokenId::ORDERLIST_ON:
1779 case HtmlTokenId::UNORDERLIST_ON:
1785 case HtmlTokenId::DIRLIST_OFF:
1786 case HtmlTokenId::MENULIST_OFF:
1787 case HtmlTokenId::ORDERLIST_OFF:
1788 case HtmlTokenId::UNORDERLIST_OFF:
1795 case HtmlTokenId::LI_ON:
1796 case HtmlTokenId::LISTHEADER_ON:
1809 case HtmlTokenId::LI_OFF:
1810 case HtmlTokenId::LISTHEADER_OFF:
1815 case HtmlTokenId::ITALIC_ON:
1827 case HtmlTokenId::BOLD_ON:
1839 case HtmlTokenId::STRIKE_ON:
1840 case HtmlTokenId::STRIKETHROUGH_ON:
1847 case HtmlTokenId::UNDERLINE_ON:
1854 case HtmlTokenId::SUPERSCRIPT_ON:
1861 case HtmlTokenId::SUBSCRIPT_ON:
1868 case HtmlTokenId::BLINK_ON:
1875 case HtmlTokenId::SPAN_ON:
1879 case HtmlTokenId::ITALIC_OFF:
1880 case HtmlTokenId::BOLD_OFF:
1881 case HtmlTokenId::STRIKE_OFF:
1882 case HtmlTokenId::UNDERLINE_OFF:
1883 case HtmlTokenId::SUPERSCRIPT_OFF:
1884 case HtmlTokenId::SUBSCRIPT_OFF:
1885 case HtmlTokenId::BLINK_OFF:
1886 case HtmlTokenId::SPAN_OFF:
1890 case HtmlTokenId::STRIKETHROUGH_OFF:
1891 EndTag( HtmlTokenId::STRIKE_OFF );
1894 case HtmlTokenId::BASEFONT_ON:
1897 case HtmlTokenId::BASEFONT_OFF:
1900 case HtmlTokenId::FONT_ON:
1901 case HtmlTokenId::BIGPRINT_ON:
1902 case HtmlTokenId::SMALLPRINT_ON:
1905 case HtmlTokenId::FONT_OFF:
1906 case HtmlTokenId::BIGPRINT_OFF:
1907 case HtmlTokenId::SMALLPRINT_OFF:
1911 case HtmlTokenId::EMPHASIS_ON:
1912 case HtmlTokenId::CITIATION_ON:
1913 case HtmlTokenId::STRONG_ON:
1914 case HtmlTokenId::CODE_ON:
1915 case HtmlTokenId::SAMPLE_ON:
1916 case HtmlTokenId::KEYBOARD_ON:
1917 case HtmlTokenId::VARIABLE_ON:
1918 case HtmlTokenId::DEFINSTANCE_ON:
1919 case HtmlTokenId::SHORTQUOTE_ON:
1920 case HtmlTokenId::LANGUAGE_ON:
1921 case HtmlTokenId::AUTHOR_ON:
1922 case HtmlTokenId::PERSON_ON:
1923 case HtmlTokenId::ACRONYM_ON:
1924 case HtmlTokenId::ABBREVIATION_ON:
1925 case HtmlTokenId::INSERTEDTEXT_ON:
1926 case HtmlTokenId::DELETEDTEXT_ON:
1928 case HtmlTokenId::TELETYPE_ON:
1932 case HtmlTokenId::SDFIELD_ON:
1937 case HtmlTokenId::EMPHASIS_OFF:
1938 case HtmlTokenId::CITIATION_OFF:
1939 case HtmlTokenId::STRONG_OFF:
1940 case HtmlTokenId::CODE_OFF:
1941 case HtmlTokenId::SAMPLE_OFF:
1942 case HtmlTokenId::KEYBOARD_OFF:
1943 case HtmlTokenId::VARIABLE_OFF:
1944 case HtmlTokenId::DEFINSTANCE_OFF:
1945 case HtmlTokenId::SHORTQUOTE_OFF:
1946 case HtmlTokenId::LANGUAGE_OFF:
1947 case HtmlTokenId::AUTHOR_OFF:
1948 case HtmlTokenId::PERSON_OFF:
1949 case HtmlTokenId::ACRONYM_OFF:
1950 case HtmlTokenId::ABBREVIATION_OFF:
1951 case HtmlTokenId::INSERTEDTEXT_OFF:
1952 case HtmlTokenId::DELETEDTEXT_OFF:
1954 case HtmlTokenId::TELETYPE_OFF:
1958 case HtmlTokenId::HEAD_OFF:
1966 case HtmlTokenId::DOCTYPE:
1967 case HtmlTokenId::BODY_OFF:
1968 case HtmlTokenId::HTML_OFF:
1969 case HtmlTokenId::HEAD_ON:
1970 case HtmlTokenId::TITLE_OFF:
1972 case HtmlTokenId::HTML_ON:
1975 for (
size_t i = rHTMLOptions.size();
i; )
1978 if( HtmlOptionId::DIR == rOption.
GetToken() )
1980 const OUString& rDir = rOption.
GetString();
1986 aPropInfo,
nullptr, &rDir );
1995 case HtmlTokenId::INPUT:
1999 case HtmlTokenId::TEXTAREA_ON:
2004 case HtmlTokenId::SELECT_ON:
2009 case HtmlTokenId::ANCHOR_ON:
2013 case HtmlTokenId::ANCHOR_OFF:
2017 case HtmlTokenId::COMMENT:
2023 if(
' ' == aToken[ 3 ] &&
2024 ' ' == aToken[ aToken.getLength()-3 ] )
2026 OUString aComment( aToken.copy( 3, aToken.getLength()-5 ) );
2031 OUString aComment =
"<" + aToken +
">";
2037 case HtmlTokenId::MAP_ON:
2056 case HtmlTokenId::MAP_OFF:
2062 case HtmlTokenId::AREA:
2065 SvMacroItemId::OnMouseOut );
2068 case HtmlTokenId::FRAMESET_ON:
2072 case HtmlTokenId::NOFRAMES_ON:
2078 case HtmlTokenId::UNKNOWNCONTROL_ON:
2084 !sSaveToken.isEmpty() &&
'!' != sSaveToken[0] &&
2085 '%' != sSaveToken[0] )
2097 if( bInsertUnknown )
2099 OUStringBuffer aComment(
"HTML: <");
2100 if( (nToken >= HtmlTokenId::ONOFF_START) &&
isOffToken(nToken) )
2101 aComment.append(
"/");
2102 aComment.append(sSaveToken);
2103 if( !aToken.isEmpty() )
2106 aComment.append(
" ").append(aToken);
2108 aComment.append(
">");
2119 bool& rScriptDependent,
2120 sal_uInt16& rScriptType )
2129 rScriptType = i18n::ScriptType::LATIN;
2130 rScriptDependent =
true;
2137 rScriptType = i18n::ScriptType::ASIAN;
2138 rScriptDependent =
true;
2145 rScriptType = i18n::ScriptType::COMPLEX;
2146 rScriptDependent =
true;
2149 rScriptDependent =
false;
2206 const sal_Int32 nEndCnt = aOldPos.nContent.
GetIndex();
2212 HTMLAttr *pAttr = *pHTMLAttributes;
2215 bool bWholePara =
false;
2230 bool bScript =
false;
2231 sal_uInt16 nScriptItem;
2232 bool bInsert =
true;
2240 OSL_ENSURE( pTextNd,
"No text node" );
2243 const OUString& rText = pTextNd->
GetText();
2244 sal_uInt16 nScriptText =
2248 ->endOfScript( rText, nStt, nScriptText );
2249 while (nScriptEnd < nEndCnt && nScriptEnd != -1)
2251 if( nScriptItem == nScriptText )
2254 pAttr->
Clone( rEndIdx, nScriptEnd );
2257 if( !pNext || bWholePara )
2271 ->endOfScript( rText, nStt, nScriptText );
2273 bInsert = nScriptItem == nScriptText;
2279 pAttr->
Clone( rEndIdx, nEndCnt );
2286 if( !pNext || bWholePara )
2302 if( !pNext || bWholePara )
2339 OSL_ENSURE( pTextNd,
"There is the txt node" );
2351 sal_Int32 aEndPos[15] =
2352 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
2354 for(
size_t i=0;
i < nCntAttr;
i++ )
2357 sal_uInt16 nWhich = pHt->
Which();
2414 const sal_Int32 nStt = pHt->
GetStart();
2415 if( nStt >= aEndPos[nIdx] )
2418 static_cast<const SwContentNode *
>(pTextNd)->GetAttr( nWhich );
2445 OSL_ENSURE( pHt->
GetEnd() && *pHt->
GetEnd() <= aEndPos[nIdx],
2446 "hints aren't nested properly!" );
2489 bool bIsCJK =
false;
2490 bool bIsCTL =
false;
2495 for(
size_t i = 0;
i < nCntAttr; ++
i)
2498 sal_uInt16
const nWhich = pHt->
Which();
2543 OSL_ENSURE( SvParserState::Working==eState,
"Show not in working state - That can go wrong" );
2548 if( (
m_xDoc->GetDocShell() &&
m_xDoc->GetDocShell()->IsAbortingImport() )
2549 || 1 ==
m_xDoc->getReferenceCount() )
2552 eState = SvParserState::Error;
2573 OSL_ENSURE( SvParserState::Working==eState,
"ShowStatLine not in working state - That can go wrong" );
2585 if( (
m_xDoc->GetDocShell() &&
m_xDoc->GetDocShell()->IsAbortingImport() )
2586 || 1 ==
m_xDoc->getReferenceCount() )
2588 eState = SvParserState::Error;
2603 if( !pVSh || bChkPtr )
2605 #if OSL_DEBUG_LEVEL > 0
2608 pVSh =
m_xDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
2609 #if OSL_DEBUG_LEVEL > 0
2610 OSL_ENSURE( !pVSh || !pOldVSh || pOldVSh == pVSh,
"CallStartAction: Who swapped the SwViewShell?" );
2611 if( pOldVSh && !pVSh )
2634 "CallEndAction: Who swapped the SwViewShell?" );
2635 #if OSL_DEBUG_LEVEL > 0
2672 if( 1 ==
m_xDoc->getReferenceCount() )
2674 eState = SvParserState::Error;
2687 "CheckActionViewShell: Who has swapped SwViewShell?" );
2688 #if OSL_DEBUG_LEVEL > 0
2699 : m_pFrameFormat(pFrameFormat)
2706 if (rHint.
GetId() == SfxHintId::Dying)
2711 std::deque<std::unique_ptr<HTMLAttr>> *pPostIts )
2719 std::vector<std::unique_ptr<HTMLAttr>> aFields;
2724 sal_uInt16 nWhich = pAttr->
m_pItem->Which();
2736 bSetAttr = ( nEndParaIdx < rEndIdx.
GetIndex() &&
2739 nEndParaIdx == rEndIdx.
GetIndex() &&
2743 nEndParaIdx == rEndIdx.
GetIndex() &&
2750 sal_uLong nEndOfIcons =
m_xDoc->GetNodes().GetEndOfExtras().GetIndex();
2751 bSetAttr = nEndParaIdx < rEndIdx.
GetIndex() ||
2752 rEndIdx.
GetIndex() > nEndOfIcons ||
2753 nEndParaIdx <= nEndOfIcons;
2763 "SetAttr: Attribute must not yet be set" );
2800 OSL_ENSURE(
false,
"SetAttr: GoNext() failed!" );
2812 pAttrPam->GetPoint()->nContent.Assign( pCNd, pAttr->
m_nStartContent );
2814 pAttrPam->SetMark();
2826 OSL_ENSURE(
false,
"SetAttr: GoPrevious() failed!" );
2827 pAttrPam->DeleteMark();
2834 pAttrPam->GetPoint()->nNode = pAttr->
m_nEndPara;
2846 pAttrPam->GetPoint()->nContent.Assign( pCNd, pAttr->
m_nEndContent );
2848 pAttrPam->GetPoint()->nNode.GetIndex() ==
2857 if( pAttrPam->GetMark()->nNode.GetIndex() !=
2860 OSL_ENSURE( !pAttrPam->GetPoint()->nContent.GetIndex(),
2861 "Content-Position before table not 0???" );
2866 pAttrPam->DeleteMark();
2881 if( ppBkmk != pMarkAccess->getAllMarksEnd() &&
2882 (*ppBkmk)->GetMarkStart() == *pAttrPam->GetPoint() )
2884 pAttrPam->DeleteMark();
2885 const ::sw::mark::IMark*
const pNewMark = pMarkAccess->makeMark(
2910 pPostIts->emplace_front( pAttr );
2914 aFields.emplace_back( pAttr);
2917 pAttrPam->DeleteMark();
2922 if( pAttrPam->GetPoint()->nNode.GetIndex() ==
2923 pAttrPam->GetMark()->nNode.GetIndex())
2930 "LRSpace set over multiple paragraphs!" );
2951 m_sJmpMark == static_cast<SwFormatINetFormat*>(pAttr->
m_pItem.get())->GetName() )
2959 pAttrPam->DeleteMark();
2972 SAL_WARN(
"sw.html",
"SwFrameFormat deleted during import");
2979 OSL_ENSURE( RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId(),
2980 "Only At-Para flys need special handling" );
2986 bMoveFly = nFlyParaIdx < rEndIdx.
GetIndex() ||
2987 ( nFlyParaIdx == rEndIdx.
GetIndex() &&
2992 sal_uLong nEndOfIcons =
m_xDoc->GetNodes().GetEndOfExtras().GetIndex();
2993 bMoveFly = nFlyParaIdx < rEndIdx.
GetIndex() ||
2994 rEndIdx.
GetIndex() > nEndOfIcons ||
2995 nFlyParaIdx <= nEndOfIcons;
3000 *pAttrPam->GetPoint() = *pFlyPos;
3001 pAttrPam->GetPoint()->nContent.Assign( pAttrPam->GetContentNode(),
3004 aAnchor.
SetType( RndStdIds::FLY_AT_CHAR );
3005 aAnchor.
SetAnchor( pAttrPam->GetPoint() );
3009 if( text::HoriOrientation::LEFT == rHoriOri.
GetHoriOrient() )
3016 if( text::VertOrientation::TOP == rVertOri.
GetVertOrient() )
3028 for (
auto & field : aFields)
3031 pAttrPam->GetPoint()->nNode = field->m_nStartPara;
3032 pAttrPam->GetPoint()->nContent.Assign( pCNd, field->m_nStartContent );
3035 pAttrPam->GetPoint()->nNode.GetIndex() == rEndIdx.
GetIndex() )
3037 OSL_ENSURE( !bBeforeTable,
"Aha, the case does occur" );
3038 OSL_ENSURE( !pAttrPam->GetPoint()->nContent.GetIndex(),
3039 "Content-Position before table not 0???" );
3044 m_xDoc->getIDocumentContentOperations().InsertPoolItem( *pAttrPam, *field->m_pItem );
3074 OSL_ENSURE( ppHead,
"No list header attribute found!" );
3082 if( ppHead && pAttr != *ppHead )
3090 while( pLast && pLast->
GetNext() != pAttr )
3093 OSL_ENSURE( pLast,
"Attribute not found in own list!" );
3096 bool bMoveBack =
false;
3097 sal_uInt16 nWhich = pAttr->
m_pItem->Which();
3110 sal_uInt16 nScriptItem = 0;
3111 bool bScript =
false;
3130 const SwTextNode *pTextNd = (bInsert && bScript) ?
3136 const OUString& rText = pTextNd->
GetText();
3140 ->endOfScript( rText, pAttr->
GetSttCnt(), nScriptText );
3141 while (nScriptEnd < nEndCnt && nScriptEnd != -1)
3143 if( nScriptItem == nScriptText )
3159 rText, nScriptEnd );
3161 ->endOfScript( rText, nScriptEnd, nScriptText );
3163 bInsert = nScriptItem == nScriptText;
3234 "Danger: there are non-final paragraph attributes");
3240 OSL_ENSURE( ppHead,
"no list header attribute found!" );
3244 if( ppHead && pAttr != *ppHead )
3252 while( pLast && pLast->
GetNext() != pAttr )
3255 OSL_ENSURE( pLast,
"Attribute not found in own list!" );
3262 std::shared_ptr<HTMLAttrTable> xKeepAlive(pAttr->
m_xAttrTab);
3292 "Danger: there are non-final paragraph attributes");
3296 HTMLAttr** pSaveAttributes =
reinterpret_cast<HTMLAttr**
>(rNewAttrTab.get());
3298 for (
auto nCnt =
sizeof(
HTMLAttrTable) /
sizeof(
HTMLAttr*); nCnt--; ++pHTMLAttributes, ++pSaveAttributes)
3300 *pSaveAttributes = *pHTMLAttributes;
3302 HTMLAttr *pAttr = *pSaveAttributes;
3305 pAttr->
SetHead(pSaveAttributes, rNewAttrTab);
3309 *pHTMLAttributes =
nullptr;
3319 "Danger: there are non-final paragraph attributes");
3327 HTMLAttr** pSaveAttributes =
reinterpret_cast<HTMLAttr**
>(rNewAttrTab.get());
3328 bool bSetAttr =
true;
3330 sal_Int32 nEndCnt = nSttCnt;
3336 if( ( nTmpIdx =
m_xDoc->GetNodes().GetEndOfExtras().GetIndex()) >= nOldEnd ||
3337 ( nTmpIdx =
m_xDoc->GetNodes().GetEndOfAutotext().GetIndex()) >= nOldEnd )
3339 nTmpIdx =
m_xDoc->GetNodes().GetEndOfInserts().GetIndex();
3344 bSetAttr = pCNd && nTmpIdx < nEndIdx.
GetIndex();
3346 nEndCnt = (bSetAttr ? pCNd->
Len() : 0);
3348 for (
auto nCnt =
sizeof(
HTMLAttrTable) /
sizeof(
HTMLAttr*); nCnt--; (++pHTMLAttributes, ++pSaveAttributes))
3350 HTMLAttr *pAttr = *pHTMLAttributes;
3351 *pSaveAttributes =
nullptr;
3394 pAttr->
Reset(nSttIdx, nSttCnt, pSaveAttributes, rNewAttrTab);
3396 if (*pSaveAttributes)
3398 HTMLAttr *pSAttr = *pSaveAttributes;
3404 *pSaveAttributes = pAttr;
3409 *pHTMLAttributes =
nullptr;
3418 "Danger: there are non-final paragraph attributes");
3422 HTMLAttr** pSaveAttributes =
reinterpret_cast<HTMLAttr**
>(rNewAttrTab.get());
3424 for (
auto nCnt =
sizeof(
HTMLAttrTable) /
sizeof(
HTMLAttr*); nCnt--; ++pHTMLAttributes, ++pSaveAttributes)
3426 OSL_ENSURE(!*pHTMLAttributes,
"The attribute table is not empty!");
3428 *pHTMLAttributes = *pSaveAttributes;
3430 HTMLAttr *pAttr = *pHTMLAttributes;
3434 "Previous attribute has still a header" );
3439 *pSaveAttributes =
nullptr;
3454 while( !rAttrs.empty() )
3456 std::unique_ptr<HTMLAttr> pAttr = std::move(rAttrs.front());
3464 OUString
aId, aStyle, aLang, aDir;
3468 for (
size_t i = rHTMLOptions.size();
i; )
3473 case HtmlOptionId::ID:
3476 case HtmlOptionId::STYLE:
3479 case HtmlOptionId::CLASS:
3482 case HtmlOptionId::LANG:
3485 case HtmlOptionId::DIR:
3501 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3503 if( HtmlTokenId::SPAN_ON != nToken || aClass.isEmpty() ||
3506 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(), true );
3519 OUString
aId, aStyle, aClass, aLang, aDir;
3522 for (
size_t i = rHTMLOptions.size();
i; )
3527 case HtmlOptionId::ID:
3530 case HtmlOptionId::STYLE:
3533 case HtmlOptionId::CLASS:
3536 case HtmlOptionId::LANG:
3539 case HtmlOptionId::DIR:
3555 aItemSet.Put( rItem );
3557 aItemSet.Put( *pItem2 );
3559 aItemSet.Put( *pItem3 );
3561 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3564 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(), true );
3571 OSL_ENSURE( ppAttr2,
"missing table entry for item2" );
3572 InsertAttr( ppAttr2, *pItem2, xCntxt.get() );
3576 OSL_ENSURE( ppAttr3,
"missing table entry for item3" );
3577 InsertAttr( ppAttr3, *pItem3, xCntxt.get() );
3598 OUString
aId, aStyle, aClass, aLang, aDir;
3599 sal_uInt16 nSize = 3;
3602 for (
size_t i = rHTMLOptions.size();
i; )
3607 case HtmlOptionId::SIZE:
3608 nSize =
static_cast<sal_uInt16
>(rOption.
GetNumber());
3610 case HtmlOptionId::ID:
3613 case HtmlOptionId::STYLE:
3616 case HtmlOptionId::CLASS:
3619 case HtmlOptionId::LANG:
3622 case HtmlOptionId::DIR:
3636 std::unique_ptr<HTMLAttrContext> xCntxt(
new HTMLAttrContext(HtmlTokenId::BASEFONT_ON));
3646 aItemSet.Put( aFontHeight );
3648 aItemSet.Put( aFontHeightCJK );
3653 aItemSet.Put( aFontHeightCTL );
3655 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3658 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(), true );
3679 EndTag( HtmlTokenId::BASEFONT_ON );
3688 sal_uInt16 nBaseSize =
3692 sal_uInt16 nFontSize =
3697 OUString aFace,
aId, aStyle, aClass, aLang, aDir;
3700 sal_uInt16 nSize = 0;
3701 bool bColor =
false;
3704 for (
size_t i = rHTMLOptions.size();
i; )
3709 case HtmlOptionId::SIZE:
3710 if( HtmlTokenId::FONT_ON==nToken && !rOption.
GetString().isEmpty() )
3715 nSSize = o3tl::saturating_add<sal_Int32>(nBaseSize, rOption.
GetSNumber());
3717 nSSize =
static_cast<sal_Int32
>(rOption.
GetNumber());
3721 else if( nSSize > 7 )
3724 nSize =
static_cast<sal_uInt16
>(nSSize);
3728 case HtmlOptionId::COLOR:
3729 if( HtmlTokenId::FONT_ON==nToken )
3735 case HtmlOptionId::FACE:
3736 if( HtmlTokenId::FONT_ON==nToken )
3739 case HtmlOptionId::ID:
3742 case HtmlOptionId::STYLE:
3745 case HtmlOptionId::CLASS:
3748 case HtmlOptionId::LANG:
3751 case HtmlOptionId::DIR:
3758 if( HtmlTokenId::FONT_ON != nToken )
3777 if( HtmlTokenId::BIGPRINT_ON == nToken )
3778 nSize = ( nFontSize<7 ? nFontSize+1 : 7 );
3780 nSize = ( nFontSize>1 ? nFontSize-1 : 1 );
3784 if( nPoolId && nSize>=1 && nSize <=6 )
3792 OSL_ENSURE( !nSize == !nFontHeight,
"HTML-Font-Size != Font-Height" );
3795 const OUString aStyleName;
3798 rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
3800 if( !aFace.isEmpty() && !
m_pCSS1Parser->IsIgnoreFontFamily() )
3812 bool bFound =
false;
3813 sal_Int32 nStrPos = 0;
3814 while( nStrPos!= -1 )
3816 OUString aFName = aFace.getToken( 0,
',', nStrPos );
3818 if( !aFName.isEmpty() )
3820 if( !bFound && pFList )
3823 if(
nullptr != hFont )
3826 if( RTL_TEXTENCODING_DONTKNOW != rFMetric.
GetCharSet() )
3829 if( RTL_TEXTENCODING_SYMBOL == rFMetric.
GetCharSet() )
3830 eEnc = RTL_TEXTENCODING_SYMBOL;
3834 if( !aFontName.isEmpty() )
3836 aFontName += aFName;
3853 aItemSet.Put( aFontHeight );
3855 aItemSet.Put( aFontHeightCJK );
3857 aItemSet.Put( aFontHeightCTL );
3861 if( !aFontName.isEmpty() )
3864 aItemSet.Put( aFont );
3866 aItemSet.Put( aFontCJK );
3868 aItemSet.Put( aFontCTL );
3871 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
3874 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(), true );
3889 if( !aFontName.isEmpty() )
3923 OUString
aId, aStyle, aClass, aLang, aDir;
3926 for (
size_t i = rHTMLOptions.size();
i; )
3931 case HtmlOptionId::ID:
3934 case HtmlOptionId::ALIGN:
3937 case HtmlOptionId::STYLE:
3940 case HtmlOptionId::CLASS:
3943 case HtmlOptionId::LANG:
3946 case HtmlOptionId::DIR:
3954 std::unique_ptr<HTMLAttrContext> xCntxt(
3966 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
3968 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
3969 "Class is not considered" );
3987 OSL_ENSURE(
m_nOpenParaToken == HtmlTokenId::NONE,
"Now an open paragraph element will be lost." );
3995 #if OSL_DEBUG_LEVEL > 0
3997 OSL_ENSURE( pNumRule,
"Where is the NumRule" );
4020 std::unique_ptr<HTMLAttrContext> xCntxt(
4042 OUString
aId, aStyle, aClass, aLang, aDir;
4045 for (
size_t i = rHTMLOptions.size();
i; )
4050 case HtmlOptionId::ID:
4053 case HtmlOptionId::ALIGN:
4056 case HtmlOptionId::STYLE:
4059 case HtmlOptionId::CLASS:
4062 case HtmlOptionId::LANG:
4065 case HtmlOptionId::DIR:
4079 sal_uInt16 nTextColl;
4092 std::unique_ptr<HTMLAttrContext> xCntxt(
new HTMLAttrContext(nToken, nTextColl, aClass));
4100 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4102 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4103 "Class is not considered" );
4133 std::unique_ptr<HTMLAttrContext> xCntxt;
4139 case HtmlTokenId::HEAD1_ON:
4140 case HtmlTokenId::HEAD2_ON:
4141 case HtmlTokenId::HEAD3_ON:
4142 case HtmlTokenId::HEAD4_ON:
4143 case HtmlTokenId::HEAD5_ON:
4144 case HtmlTokenId::HEAD6_ON:
4168 OUString
aId, aStyle, aClass, aLang, aDir;
4171 for (
size_t i = rHTMLOptions.size();
i; )
4176 case HtmlOptionId::ID:
4179 case HtmlOptionId::STYLE:
4182 case HtmlOptionId::CLASS:
4185 case HtmlOptionId::LANG:
4188 case HtmlOptionId::DIR:
4199 case HtmlTokenId::LISTING_ON:
4200 case HtmlTokenId::XMP_ON:
4206 case HtmlTokenId::BLOCKQUOTE_ON:
4207 case HtmlTokenId::BLOCKQUOTE30_ON:
4208 case HtmlTokenId::PREFORMTXT_ON:
4211 case HtmlTokenId::ADDRESS_ON:
4214 case HtmlTokenId::DT_ON:
4215 case HtmlTokenId::DD_ON:
4219 OSL_ENSURE(
false,
"unknown style" );
4228 std::unique_ptr<HTMLAttrContext> xCntxt(
new HTMLAttrContext(nToken, nColl, aClass));
4236 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4238 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4239 "Class is not considered" );
4259 case HtmlTokenId::BLOCKQUOTE_ON:
4260 case HtmlTokenId::BLOCKQUOTE30_ON:
4261 case HtmlTokenId::PREFORMTXT_ON:
4262 case HtmlTokenId::LISTING_ON:
4263 case HtmlTokenId::XMP_ON:
4266 case HtmlTokenId::ADDRESS_ON:
4267 case HtmlTokenId::DT_ON:
4268 case HtmlTokenId::DD_ON:
4272 OSL_ENSURE(
false,
"unknown style" );
4297 OUString
aId, aStyle, aClass, aLang, aDir;
4300 for (
size_t i = rHTMLOptions.size();
i; )
4305 case HtmlOptionId::ID:
4308 case HtmlOptionId::STYLE:
4311 case HtmlOptionId::CLASS:
4314 case HtmlOptionId::LANG:
4317 case HtmlOptionId::DIR:
4334 bool bInDD =
false, bNotInDD =
false;
4339 switch( nCntxtToken )
4341 case HtmlTokenId::DEFLIST_ON:
4342 case HtmlTokenId::DIRLIST_ON:
4343 case HtmlTokenId::MENULIST_ON:
4344 case HtmlTokenId::ORDERLIST_ON:
4345 case HtmlTokenId::UNORDERLIST_ON:
4348 case HtmlTokenId::DD_ON:
4356 std::unique_ptr<HTMLAttrContext> xCntxt(
new HTMLAttrContext(HtmlTokenId::DEFLIST_ON));
4359 sal_uInt16 nLeft=0, nRight=0;
4373 nLeft = nLeft +
static_cast< sal_uInt16
>(rLRSpace.
GetTextLeft());
4376 xCntxt->SetMargins( nLeft, nRight, nIndent );
4384 if(
ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
4411 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext(HtmlTokenId::DEFLIST_ON));
4428 bool bInDefList =
false, bNotInDefList =
false;
4433 switch( nCntxtToken )
4435 case HtmlTokenId::DEFLIST_ON:
4438 case HtmlTokenId::DIRLIST_ON:
4439 case HtmlTokenId::MENULIST_ON:
4440 case HtmlTokenId::ORDERLIST_ON:
4441 case HtmlTokenId::UNORDERLIST_ON:
4442 bNotInDefList =
true;
4453 "Now an open paragraph element will be lost." );
4469 std::unique_ptr<HTMLAttrContext> xCntxt;
4474 switch( nCntxtToken )
4476 case HtmlTokenId::DD_ON:
4477 case HtmlTokenId::DT_ON:
4478 if( nToken == HtmlTokenId::NONE || nToken == nCntxtToken )
4484 case HtmlTokenId::DEFLIST_ON:
4486 case HtmlTokenId::DIRLIST_ON:
4487 case HtmlTokenId::MENULIST_ON:
4488 case HtmlTokenId::ORDERLIST_ON:
4489 case HtmlTokenId::UNORDERLIST_ON:
4515 bool bSurroundOnly )
const
4521 bool bFound =
false;
4522 for (
size_t i=0;
i<rFrameFormatTable.
size();
i++ )
4534 ((RndStdIds::FLY_AT_PARA == pAnchor->
GetAnchorId()) ||
4535 (RndStdIds::FLY_AT_CHAR == pAnchor->
GetAnchorId())) &&
4536 pAPos->
nNode == rNodeIdx )
4538 if( !(bNoSurroundOnly || bSurroundOnly) )
4549 if( bNoSurroundOnly )
4551 if( css::text::WrapTextMode_NONE==eSurround )
4559 if( css::text::WrapTextMode_NONE==eSurround )
4564 else if( css::text::WrapTextMode_THROUGH!=eSurround )
4591 const OUString rTopClass = pContext ? pContext->
GetClass() : OUString();
4597 short nFirstLineIndent = 0;
4608 bool bSetThis =
true;
4648 aItemSet.Set( rCollSet );
4649 pItemSet->
Put( aItemSet );
4656 pCollToSet = pNewColl;
4668 aItemSet.Set( rCollSet );
4669 pItemSet->
Put( aItemSet );
4684 sal_uInt16 nLeft=0, nRight=0;
4686 pCntxt->
GetMargins( nLeft, nRight, nFirstLineIndent );
4687 nLeftMargin = nLeft;
4694 if( pContext && nTopColl )
4700 nTopColl = nDfltColl;
4712 sal_Int32 nRight = pLRItem->
GetRight();
4731 nLeftMargin = nLeftMargin +
static_cast< sal_uInt16
>(nLeft);
4732 nRightMargin = nRightMargin +
static_cast< sal_uInt16
>(nRight);
4734 pContext->
SetMargins( nLeftMargin, nRightMargin,
4748 pCollToSet =
m_pCSS1Parser->GetTextCollFromPool( nDfltColl );
4751 nLeftMargin =
static_cast< sal_uInt16
>(rLRItem.
GetTextLeft());
4754 if( !nFirstLineIndent )
4760 pParaAttr->Invalidate();
4761 m_aParaAttrs.clear();
4768 bool bSetLRSpace = nLeftMargin != rLRItem.
GetTextLeft() ||
4779 pItemSet->
Put( aLRItem );
4784 m_aParaAttrs.push_back(
m_xAttrTab->pLRSpace );
4799 OUString
aId, aStyle, aLang, aDir;
4803 for (
size_t i = rHTMLOptions.size();
i; )
4808 case HtmlOptionId::ID:
4811 case HtmlOptionId::STYLE:
4814 case HtmlOptionId::CLASS:
4817 case HtmlOptionId::LANG:
4820 case HtmlOptionId::DIR:
4832 OSL_ENSURE( pCFormat,
"No character format found for token" );
4840 if (
ParseStyleOptions(aStyle, aId, OUString(), aItemSet, aPropInfo, &aLang, &aDir))
4842 OSL_ENSURE( aClass.isEmpty() || !
m_pCSS1Parser->GetClass( aClass ),
4843 "Class is not considered" );
4845 InsertAttrs( aItemSet, aPropInfo, xCntxt.get(), true );
4861 sal_Int16 eVertOri = text::VertOrientation::TOP;
4865 bool bPercentWidth =
false;
4866 bool bPercentHeight =
false;
4870 for (
size_t i = rHTMLOptions.size();
i; )
4875 case HtmlOptionId::TYPE:
4876 rOption.
GetEnum( nType, aHTMLSpacerTypeTable );
4878 case HtmlOptionId::ALIGN:
4886 case HtmlOptionId::WIDTH:
4888 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
4891 case HtmlOptionId::HEIGHT:
4893 bPercentHeight = (rOption.
GetString().indexOf(
'%') != -1);
4896 case HtmlOptionId::SIZE:
4921 Size aSpace( 0, 0 );
4926 SetFixSize( aSize, aDfltSz, bPercentWidth, bPercentHeight,
4927 aDummyPropInfo, aFrameSet );
4928 SetSpace( aSpace, aDummyItemSet, aDummyPropInfo, aFrameSet );
4933 aFrameSet.Put( aProtectItem );
4951 MapMode(MapUnit::MapTwip) ).Height();
4975 SvxULSpaceItem aULSpace( static_cast<const SvxULSpaceItem&>(pTextNode
4978 pTextNode->
SetAttr( aULSpace );
4999 MapMode(MapUnit::MapTwip) ).Width();
5004 sal_uInt16 nLeft=0, nRight=0;
5008 nIndent = nIndent +
static_cast<short>(nSize);
5011 aLRItem.SetTextLeft( nLeft );
5012 aLRItem.SetRight( nRight );
5013 aLRItem.SetTextFirstLineOffset( nIndent );
5021 m_xDoc->getIDocumentContentOperations().InsertString( *
m_pPam,
" " );
5033 Size( nPixel, nPixel ),
MapMode( MapUnit::MapTwip ) ).Width();
5069 for (
size_t i = rHTMLOptions.size();
i; )
5072 if( HtmlOptionId::ID==rOption.
GetToken() )
5079 if( !aId.isEmpty() )
5097 OUString
aId, aStyle, aClass;
5098 bool bClearLeft =
false, bClearRight =
false;
5099 bool bCleared =
false;
5103 for (
size_t i = rHTMLOptions.size();
i; )
5108 case HtmlOptionId::CLEAR:
5110 const OUString &rClear = rOption.
GetString();
5122 case HtmlOptionId::ID:
5125 case HtmlOptionId::STYLE:
5128 case HtmlOptionId::CLASS:
5136 if( bClearLeft || bClearRight )
5144 for(
size_t i=0;
i<rFrameFormatTable.
size();
i++ )
5150 ((RndStdIds::FLY_AT_PARA == pAnchor->
GetAnchorId()) ||
5151 (RndStdIds::FLY_AT_CHAR == pAnchor->
GetAnchorId())) &&
5152 pAPos->
nNode == rNodeIdx &&
5156 ? text::HoriOrientation::LEFT
5159 css::text::WrapTextMode eSurround = css::text::WrapTextMode_PARALLEL;
5162 if( bClearLeft && text::HoriOrientation::LEFT==eHori )
5163 eSurround = css::text::WrapTextMode_RIGHT;
5164 else if( bClearRight && text::HoriOrientation::RIGHT==eHori )
5165 eSurround = css::text::WrapTextMode_LEFT;
5167 else if( (bClearLeft && text::HoriOrientation::LEFT==eHori) ||
5168 (bClearRight && text::HoriOrientation::RIGHT==eHori) )
5170 eSurround = css::text::WrapTextMode_NONE;
5173 if( css::text::WrapTextMode_PARALLEL != eSurround )
5176 if( css::text::WrapTextMode_NONE != eSurround )
5187 std::shared_ptr<SvxFormatBreakItem> aBreakItem(std::make_shared<SvxFormatBreakItem>(SvxBreak::NONE,
RES_BREAK));
5188 bool bBreakItem =
false;
5198 aBreakItem.reset(aItemSet.Get(
RES_BREAK).Clone());
5201 if( !aPropInfo.m_aId.isEmpty() )
5206 if( bBreakItem && SvxBreak::PageAfter == aBreakItem->GetBreak() )
5212 if( !bCleared && !bBreakItem )
5215 m_xDoc->getIDocumentContentOperations().InsertString( *
m_pPam,
"\x0A" );
5226 if( bBreakItem && SvxBreak::PageBefore == aBreakItem->GetBreak() )
5235 sal_uInt16 nSize = 0;
5236 sal_uInt16 nWidth = 0;
5240 bool bPercentWidth =
false;
5241 bool bNoShade =
false;
5242 bool bColor =
false;
5249 for (
size_t i = rHTMLOptions.size();
i; )
5254 case HtmlOptionId::ID:
5257 case HtmlOptionId::SIZE:
5258 nSize =
static_cast<sal_uInt16
>(rOption.
GetNumber());
5260 case HtmlOptionId::WIDTH:
5261 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
5262 nWidth =
static_cast<sal_uInt16
>(rOption.
GetNumber());
5263 if( bPercentWidth && nWidth>=100 )
5267 bPercentWidth =
false;
5270 case HtmlOptionId::ALIGN:
5271 eAdjust = rOption.
GetEnum( aHTMLPAlignTable, eAdjust );
5273 case HtmlOptionId::NOSHADE:
5276 case HtmlOptionId::COLOR:
5292 std::unique_ptr<HTMLAttrContext> xCntxt(
5303 if( nSize>0 || bColor || bNoShade )
5332 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::BOTTOM );
5346 nWidth = bPercentWidth ?
static_cast<sal_uInt16
>((nWidth*nBrowseWidth) / 100)
5347 :
ToTwips( static_cast<sal_uInt16>(nBrowseWidth) );
5359 case SvxAdjust::Right:
5360 aLRItem.
SetTextLeft( static_cast<sal_uInt16>(nDist) );
5362 case SvxAdjust::Left:
5363 aLRItem.SetRight( static_cast<sal_uInt16>(nDist) );
5365 case SvxAdjust::Center:
5368 aLRItem.SetTextLeft( static_cast<sal_uInt16>(nDist) );
5369 aLRItem.SetRight( static_cast<sal_uInt16>(nDist) );