40 aBaseURL(
std::move( _aBaseURL )),
41 mpEditEngine(nullptr),
44 bFieldsInserted(false),
59 if ( pHTTPHeaderAttrs )
69 DBG_ASSERT(pEE,
"CallParser: ImpEditEngine ?!");
102 case HtmlTokenId::META:
105 size_t nArrLen = aOptions.size();
107 for (
size_t i = 0;
i < nArrLen;
i++ )
112 case HtmlOptionId::HTTPEQUIV:
117 case HtmlOptionId::CONTENT:
122 if ( eEnc != RTL_TEXTENCODING_DONTKNOW )
133 case HtmlTokenId::PLAINTEXT_ON:
134 case HtmlTokenId::PLAINTEXT2_ON:
137 case HtmlTokenId::PLAINTEXT_OFF:
138 case HtmlTokenId::PLAINTEXT2_OFF:
142 case HtmlTokenId::LINEBREAK:
143 case HtmlTokenId::NEWPARA:
152 case HtmlTokenId::HORZRULE:
159 case HtmlTokenId::NONBREAKSPACE:
167 case HtmlTokenId::RAWDATA:
175 case HtmlTokenId::TEXTTOKEN:
183 OUString aText =
aToken.toString();
185 aText = aText.copy( 1 );
195 aText = aText.replaceAll(
u"\t",
u" ");
202 case HtmlTokenId::CENTER_ON:
203 case HtmlTokenId::CENTER_OFF:
208 if (
nToken == HtmlTokenId::CENTER_ON )
216 case HtmlTokenId::ANCHOR_OFF:
AnchorEnd();
219 case HtmlTokenId::PARABREAK_ON:
225 case HtmlTokenId::PARABREAK_OFF:
230 case HtmlTokenId::HEAD1_ON:
231 case HtmlTokenId::HEAD2_ON:
232 case HtmlTokenId::HEAD3_ON:
233 case HtmlTokenId::HEAD4_ON:
234 case HtmlTokenId::HEAD5_ON:
235 case HtmlTokenId::HEAD6_ON:
241 case HtmlTokenId::HEAD1_OFF:
242 case HtmlTokenId::HEAD2_OFF:
243 case HtmlTokenId::HEAD3_OFF:
244 case HtmlTokenId::HEAD4_OFF:
245 case HtmlTokenId::HEAD5_OFF:
246 case HtmlTokenId::HEAD6_OFF:
252 case HtmlTokenId::PREFORMTXT_ON:
253 case HtmlTokenId::XMP_ON:
254 case HtmlTokenId::LISTING_ON:
261 case HtmlTokenId::DEFLIST_ON:
267 case HtmlTokenId::DEFLIST_OFF:
274 case HtmlTokenId::TABLE_ON:
nInTable++;
280 case HtmlTokenId::TABLEHEADER_ON:
281 case HtmlTokenId::TABLEDATA_ON:
284 case HtmlTokenId::BLOCKQUOTE_ON:
285 case HtmlTokenId::BLOCKQUOTE_OFF:
286 case HtmlTokenId::BLOCKQUOTE30_ON:
287 case HtmlTokenId::BLOCKQUOTE30_OFF:
288 case HtmlTokenId::LISTHEADER_ON:
289 case HtmlTokenId::LI_ON:
290 case HtmlTokenId::DD_ON:
291 case HtmlTokenId::DT_ON:
292 case HtmlTokenId::ORDERLIST_ON:
293 case HtmlTokenId::UNORDERLIST_ON:
302 case HtmlTokenId::TABLEHEADER_OFF:
303 case HtmlTokenId::TABLEDATA_OFF:
309 case HtmlTokenId::LISTHEADER_OFF:
310 case HtmlTokenId::LI_OFF:
311 case HtmlTokenId::DD_OFF:
312 case HtmlTokenId::DT_OFF:
313 case HtmlTokenId::ORDERLIST_OFF:
314 case HtmlTokenId::UNORDERLIST_OFF:
EndPara();
317 case HtmlTokenId::TABLEROW_ON:
318 case HtmlTokenId::TABLEROW_OFF:
320 case HtmlTokenId::COL_ON:
321 case HtmlTokenId::COLGROUP_ON:
322 case HtmlTokenId::COLGROUP_OFF:
break;
324 case HtmlTokenId::FONT_ON:
326 case HtmlTokenId::FONT_OFF:
329 case HtmlTokenId::TITLE_ON:
332 case HtmlTokenId::TITLE_OFF:
337 case HtmlTokenId::HTML_ON:
338 case HtmlTokenId::HTML_OFF:
339 case HtmlTokenId::STYLE_ON:
340 case HtmlTokenId::STYLE_OFF:
341 case HtmlTokenId::BODY_ON:
342 case HtmlTokenId::BODY_OFF:
343 case HtmlTokenId::HEAD_ON:
344 case HtmlTokenId::HEAD_OFF:
345 case HtmlTokenId::FORM_ON:
346 case HtmlTokenId::FORM_OFF:
347 case HtmlTokenId::THEAD_ON:
348 case HtmlTokenId::THEAD_OFF:
349 case HtmlTokenId::TBODY_ON:
350 case HtmlTokenId::TBODY_OFF:
353 case HtmlTokenId::BANNER_ON:
354 case HtmlTokenId::BANNER_OFF:
355 case HtmlTokenId::DIVISION_ON:
356 case HtmlTokenId::DIVISION_OFF:
359 case HtmlTokenId::NOTE_ON:
360 case HtmlTokenId::NOTE_OFF:
363 case HtmlTokenId::ADDRESS_ON:
364 case HtmlTokenId::ADDRESS_OFF:
367 case HtmlTokenId::CITATION_ON:
368 case HtmlTokenId::CITATION_OFF:
369 case HtmlTokenId::CODE_ON:
370 case HtmlTokenId::CODE_OFF:
371 case HtmlTokenId::DEFINSTANCE_ON:
372 case HtmlTokenId::DEFINSTANCE_OFF:
373 case HtmlTokenId::EMPHASIS_ON:
374 case HtmlTokenId::EMPHASIS_OFF:
375 case HtmlTokenId::KEYBOARD_ON:
376 case HtmlTokenId::KEYBOARD_OFF:
377 case HtmlTokenId::SAMPLE_ON:
378 case HtmlTokenId::SAMPLE_OFF:
379 case HtmlTokenId::STRIKE_ON:
380 case HtmlTokenId::STRIKE_OFF:
381 case HtmlTokenId::STRONG_ON:
382 case HtmlTokenId::STRONG_OFF:
383 case HtmlTokenId::VARIABLE_ON:
384 case HtmlTokenId::VARIABLE_OFF:
386 case HtmlTokenId::ABBREVIATION_ON:
387 case HtmlTokenId::ABBREVIATION_OFF:
388 case HtmlTokenId::ACRONYM_ON:
389 case HtmlTokenId::ACRONYM_OFF:
390 case HtmlTokenId::AUTHOR_ON:
391 case HtmlTokenId::AUTHOR_OFF:
394 case HtmlTokenId::DELETEDTEXT_ON:
395 case HtmlTokenId::DELETEDTEXT_OFF:
396 case HtmlTokenId::INSERTEDTEXT_ON:
397 case HtmlTokenId::INSERTEDTEXT_OFF:
398 case HtmlTokenId::LANGUAGE_ON:
399 case HtmlTokenId::LANGUAGE_OFF:
400 case HtmlTokenId::PERSON_ON:
401 case HtmlTokenId::PERSON_OFF:
402 case HtmlTokenId::SHORTQUOTE_ON:
403 case HtmlTokenId::SHORTQUOTE_OFF:
404 case HtmlTokenId::SUBSCRIPT_ON:
405 case HtmlTokenId::SUBSCRIPT_OFF:
406 case HtmlTokenId::SUPERSCRIPT_ON:
407 case HtmlTokenId::SUPERSCRIPT_OFF:
410 case HtmlTokenId::BOLD_ON:
411 case HtmlTokenId::BOLD_OFF:
412 case HtmlTokenId::ITALIC_ON:
413 case HtmlTokenId::ITALIC_OFF:
414 case HtmlTokenId::TELETYPE_ON:
415 case HtmlTokenId::TELETYPE_OFF:
416 case HtmlTokenId::UNDERLINE_ON:
417 case HtmlTokenId::UNDERLINE_OFF:
419 case HtmlTokenId::BIGPRINT_ON:
420 case HtmlTokenId::BIGPRINT_OFF:
421 case HtmlTokenId::STRIKETHROUGH_ON:
422 case HtmlTokenId::STRIKETHROUGH_OFF:
423 case HtmlTokenId::SMALLPRINT_ON:
424 case HtmlTokenId::SMALLPRINT_OFF:
426 case HtmlTokenId::FIGURE_ON:
427 case HtmlTokenId::FIGURE_OFF:
428 case HtmlTokenId::CAPTION_ON:
429 case HtmlTokenId::CAPTION_OFF:
430 case HtmlTokenId::CREDIT_ON:
431 case HtmlTokenId::CREDIT_OFF:
433 case HtmlTokenId::DIRLIST_ON:
434 case HtmlTokenId::DIRLIST_OFF:
435 case HtmlTokenId::FOOTNOTE_ON:
436 case HtmlTokenId::FOOTNOTE_OFF:
437 case HtmlTokenId::MENULIST_ON:
438 case HtmlTokenId::MENULIST_OFF:
443 case HtmlTokenId::SPAN_ON:
444 case HtmlTokenId::SPAN_OFF:
451 case HtmlTokenId::BLINK_ON:
452 case HtmlTokenId::BLINK_OFF:
453 case HtmlTokenId::NOBR_ON:
454 case HtmlTokenId::NOBR_OFF:
455 case HtmlTokenId::NOEMBED_ON:
456 case HtmlTokenId::NOEMBED_OFF:
457 case HtmlTokenId::NOFRAMES_ON:
458 case HtmlTokenId::NOFRAMES_OFF:
460 case HtmlTokenId::MARQUEE_ON:
461 case HtmlTokenId::MARQUEE_OFF:
468 if (
nToken >= HtmlTokenId::ONOFF_START )
470 if ( (
nToken == HtmlTokenId::UNKNOWNCONTROL_ON ) || (
nToken == HtmlTokenId::UNKNOWNCONTROL_OFF ) )
487 if (
nToken == HtmlTokenId::TEXTTOKEN )
489 else if (
nToken == HtmlTokenId::STYLE_OFF)
538 DBG_ASSERT( nStartNode == nEndNode,
"ImpSetAttribs: Several paragraphs?" );
545 aItems.
Put( rItems );
582 if ( ( nHLevel >= 1 ) && ( nHLevel <= 3 ) )
585 aItems.
Put( aWeightItem );
588 aItems.
Put( aWeightItemCJK );
591 aItems.
Put( aWeightItemCTL );
596 if ( ( eUnit != MapUnit::MapPixel ) && ( eUnit != MapUnit::MapSysFont ) &&
597 ( eUnit != MapUnit::MapAppFont ) && ( eUnit != MapUnit::MapRelative ) )
602 else if ( nHLevel == 2 )
604 else if ( nHLevel == 3 )
606 else if ( nHLevel == 4 )
612 aItems.
Put( aHeightItem );
615 aItems.
Put( aHeightItemCJK );
618 aItems.
Put( aHeightItemCTL );
626 aItems.
Put( aULSpaceItem );
635 aItems.
Put( aFontItem );
638 aItems.
Put( aFontItemCJK );
641 aItems.
Put( aFontItemCTL );
652 aImportInfo.
aText = rText;
673 case HtmlTokenId::TABLEHEADER_ON:
674 case HtmlTokenId::TABLEDATA_ON:
677 case HtmlTokenId::TABLEHEADER_OFF:
678 case HtmlTokenId::TABLEDATA_OFF:
693 for (
const auto & aOption : aOptions)
695 if( aOption.GetToken() == HtmlOptionId::ALIGN )
697 OUString
const& rTmp(aOption.GetString());
731 return !(pNode->
Len() && ( pNode->
GetChar( pNode->
Len()-1 ) !=
' ' ));
748 for (
const auto & aOption : aOptions)
750 if( aOption.GetToken() == HtmlOptionId::HREF)
751 aRef = aOption.GetString();
754 if ( aRef.isEmpty() )
757 OUString
aURL = aRef;
758 if ( !
aURL.isEmpty() && (
aURL[ 0 ] !=
'#' ) )
795 sal_uInt16
nId = sal::static_int_cast< sal_uInt16 >(
796 1 + ( (
static_cast<int>(
nToken) -
int(HtmlTokenId::HEAD1_ON) ) / 2 ) );
797 DBG_ASSERT( (
nId >= 1) && (
nId <= 9),
"HeadingStart: ID can not be correct!" );
sal_Unicode GetChar(sal_Int32 nPos) const
ContentAttribs & GetContentAttribs()
sal_Int32 GetPos(const ContentNode *pNode) const
const SfxItemSet & GetBaseParaAttribs(sal_Int32 nPara) const
ESelection CreateESelection(const EditSelection &rSel) const
void CallHtmlImportHandler(HtmlImportInfo &rInfo)
bool IsHtmlImportHandlerSet() const
EditPaM InsertField(const EditSelection &rEditSelection, const SvxFieldItem &rFld)
MapMode const & GetRefMapMode() const
void SetParaAttribsOnly(sal_Int32 nPara, const SfxItemSet &rSet)
EditSelection InsertText(css::uno::Reference< css::datatransfer::XTransferable > const &rxDataObj, const OUString &rBaseURL, const EditPaM &rPaM, bool bUseSpecial)
const SfxItemSet & GetEmptyItemSet() const
EditPaM InsertParaBreak(const EditSelection &rEditSelection)
void SetAttribs(const EditSelection &rSel, const SfxItemSet &rSet, SetAttribsMode nSpecial=SetAttribsMode::NONE)
bool HasTextInCurrentPara()
virtual ~EditHTMLParser() override
void StartPara(bool bReal)
void HeadingStart(HtmlTokenId nToken)
void ImpInsertParaBreak()
EditHTMLParser(SvStream &rIn, OUString aBaseURL, SvKeyValueIterator *pHTTPHeaderAttrs)
std::optional< AnchorInfo > moCurAnchor
virtual void NextToken(HtmlTokenId nToken) override
void ImpInsertText(const OUString &rText)
void ImpSetAttribs(const SfxItemSet &rItems)
virtual SvParserState CallParser() override
void SkipGroup(HtmlTokenId nEndToken)
EditEngine * mpEditEngine
void ImpSetStyleSheet(sal_uInt16 nHeadingLevel)
OUStringBuffer maStyleSource
void SetIndex(sal_Int32 n)
const ContentNode * GetNode() const
sal_Int32 GetIndex() const
HtmlOptionId GetToken() const
const OUString & GetString() const
static rtl_TextEncoding GetEncodingByMIME(const OUString &rMime)
virtual SvParserState CallParser() override
bool SetEncodingByHTTPHeader(SvKeyValueIterator *pHTTPHeader)
const HTMLOptions & GetOptions(HtmlOptionId const *pNoConvertToken=nullptr)
bool GetNewAbsURL(OUString const &rTheRelURIRef, INetURLObject *pTheAbsURIRef) const
MapUnit GetMapUnit() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void SetSrcEncoding(rtl_TextEncoding eSrcEnc)
bool IsSwitchToUCS2() const
void SetSwitchToUCS2(bool bSet)
This item stores a field (SvxFieldData).
This item describes a Font.
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
FontFamily GetFamilyType()
const OUString & GetFamilyName() const
rtl_TextEncoding GetCharSet() const
#define DBG_ASSERT(sCon, aError)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+16)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxULSpaceItem > EE_PARA_ULSPACE(EE_PARA_START+14)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
#define OOO_STRING_SVTOOLS_HTML_AL_center
#define OOO_STRING_SVTOOLS_HTML_AL_right
#define OOO_STRING_SVTOOLS_HTML_AL_middle
constexpr bool isOffToken(HtmlTokenId nToken)
::std::vector< HTMLOption > HTMLOptions
TOOLS_DLLPUBLIC rtl_TextEncoding GetExtendedCompatibilityTextEncoding(rtl_TextEncoding eEncoding)