19#ifndef INCLUDED_SW_SOURCE_FILTER_HTML_SWHTML_HXX
20#define INCLUDED_SW_SOURCE_FILTER_HTML_SWHTML_HXX
22#include <config_java.h>
30#include <rtl/ustrbuf.hxx>
36#include <com/sun/star/drawing/XShape.hpp>
37#include <com/sun/star/form/XFormComponent.hpp>
38#include <com/sun/star/beans/XPropertySet.hpp>
152 HTMLAttr **pHd, std::shared_ptr<HTMLAttrTable> xAttrTab );
155 sal_Int32 nEndCnt,
HTMLAttr **pHd, std::shared_ptr<HTMLAttrTable> xAttrTab );
162 void Reset(
const SwNode& rSttPara, sal_Int32 nSttCnt,
163 HTMLAttr **pHd,
const std::shared_ptr<HTMLAttrTable>& rAttrTab );
250 bool bDfltColl=
false );
261 inline void SetMargins( sal_uInt16 nLeft, sal_uInt16 nRight,
short nIndent );
264 inline void GetMargins( sal_uInt16& nLeft, sal_uInt16& nRight,
265 short &nIndent )
const;
267 inline void SetULSpace( sal_uInt16 nUpper, sal_uInt16 nLower );
269 inline void GetULSpace( sal_uInt16& rUpper, sal_uInt16& rLower )
const;
315typedef std::vector<std::unique_ptr<ImageMap>>
ImageMaps;
515 void SetAttr_(
bool bChkEnd,
bool bBeforeTable, std::deque<std::unique_ptr<HTMLAttr>> *pPostIts );
516 void SetAttr(
bool bChkEnd =
true,
bool bBeforeTable =
false,
517 std::deque<std::unique_ptr<HTMLAttr>> *pPostIts =
nullptr )
520 SetAttr_( bChkEnd, bBeforeTable, pPostIts );
537 void SaveAttrTab(std::shared_ptr<HTMLAttrTable>
const & rNewAttrTab);
539 void SplitAttrTab(std::shared_ptr<HTMLAttrTable>
const & rNewAttrTab,
bool bMoveEndBack);
540 void RestoreAttrTab(std::shared_ptr<HTMLAttrTable>
const & rNewAttrTab);
542 void InsertAttrs( std::deque<std::unique_ptr<HTMLAttr>> rAttrs );
590 bool bIgnoreCurrent=
false )
const;
592 short& nIndent )
const;
601 void EndPara(
bool bReal =
false );
615 const OUString& rId );
694 bool bDontAppend=
false );
707 bool bPercentWidth,
bool bPercentHeight,
719 OUString& rTypeStr )
const;
750 void InsertComment(
const OUString& rName, std::string_view pTag = {} );
765 ScriptType eScrType,
const OUString& rScrType );
773 static inline bool HasStyleOptions( std::u16string_view rStyle, std::u16string_view rId,
774 std::u16string_view rClass,
const OUString *pLang=
nullptr,
775 const OUString *pDir=
nullptr );
779 const OUString *pLang=
nullptr,
const OUString *pDir=
nullptr );
790 const css::uno::Reference< css::form::XFormComponent > & rFormComp,
791 const css::uno::Reference< css::beans::XPropertySet > & rFCompPropSet,
798 const std::vector<OUString>& rUnoMacroTable,
799 const std::vector<OUString>& rUnoMacroParamTable,
800 bool bSetPropSet =
true,
801 bool bHidden =
false );
802 void SetControlSize(
const css::uno::Reference< css::drawing::XShape > & rShape,
const Size& rTextSz,
803 bool bMinWidth,
bool bMinHeight );
811 void NewForm(
bool bAppend=
true );
812 void EndForm(
bool bAppend=
true );
845 SvxAdjust eGrpAdjust, sal_Int16 eVertOri );
850 bool bIsParentHead =
false,
851 bool bHasParentSection=
true,
852 bool bHasToFlow =
false);
858 bool FileDownload(
const OUString& rURL, OUString& rStr );
881 bool bSurroundOnly =
false )
const;
904 const OUString &rImageURL,
905 const OUString &rStyle,
907 const OUString &rClass );
926 bool bIgnoreHTMLComments,
927 const OUString& rNamespace);
931 static sal_uInt16
ToTwips( sal_uInt16 nPixel );
936 virtual bool ParseMetaOptions(
const css::uno::Reference<css::document::XDocumentProperties>&,
967 std::unique_ptr<SwPendingData>
pData;
993 short& nIndent )
const
1011 sal_uInt16& rLower )
const
1021 std::u16string_view rId,
1022 std::u16string_view rClass,
1023 const OUString *pLang,
1024 const OUString *pDir )
1026 return !rStyle.empty() || !rId.empty() || !rClass.empty() ||
1027 (pLang && !pLang->isEmpty()) || (pDir && !pDir->isEmpty());
void ClearSaveDocContext()
sal_uInt16 m_nFirstLineIndent
bool IsHeaderOrFooter() const
void SetULSpace(sal_uInt16 nUpper, sal_uInt16 nLower)
HTMLAttrContext_SaveDoc * GetSaveDocContext(bool bCreate=false)
bool GetSpansSection() const
void SetPopStack(bool bSet)
const HTMLAttrs & GetAttrs() const
sal_uInt16 GetDefaultTextFormatColl() const
bool m_bFinishPREListingXMP
void SetVisible(bool bVisible)
SwHTMLAppendMode GetAppendMode() const
void SetHeaderOrFooter(bool bSet)
sal_uInt16 GetTextFormatColl() const
bool IsRestartXMP() const
void SetRestartXMP(bool bSet)
void SetMargins(sal_uInt16 nLeft, sal_uInt16 nRight, short nIndent)
void GetULSpace(sal_uInt16 &rUpper, sal_uInt16 &rLower) const
void SetRestartPRE(bool bSet)
HtmlTokenId GetToken() const
bool m_bDefaultTextFormatColl
std::unique_ptr< HTMLAttrContext_SaveDoc > m_pSaveDocContext
bool IsFinishPREListingXMP() const
bool IsRestartPRE() const
void SetRestartListing(bool bSet)
sal_uInt16 m_nTextFormatColl
const SfxItemSet * GetFrameItemSet() const
bool IsULSpaceChanged() const
SwHTMLAppendMode m_eAppend
void SetSpansSection(bool bSet)
bool IsLRSpaceChanged() const
const OUString & GetClass() const
void SetFinishPREListingXMP(bool bSet)
bool IsRestartListing() const
HTMLAttrContext(HtmlTokenId nTokn, sal_uInt16 nPoolId, OUString aClass, bool bDfltColl=false)
bool HasSaveDocContext() const
std::unique_ptr< SfxItemSet > m_pFrameItemSet
sal_uInt16 m_nRightMargin
void GetMargins(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent) const
void SetAppendMode(SwHTMLAppendMode eMode)
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 SfxPoolItem & GetItem() const
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
Base class of all fields.
TableDepthGuard(SwHTMLParser &rParser)
virtual SvParserState CallParser() override
std::shared_ptr< HTMLTable > m_xTable
void InsertFootEndNote(const OUString &rName, bool bEndNote, bool bFixed)
void SetControlSize(const css::uno::Reference< css::drawing::XShape > &rShape, const Size &rTextSz, bool bMinWidth, bool bMinHeight)
sal_uInt16 m_nSelectEntryCnt
SwViewShell * CheckActionViewShell()
std::vector< std::unique_ptr< SwTableBox > > m_aOrphanedTableBoxes
void PushContext(std::unique_ptr< HTMLAttrContext > &rCntxt)
const SwFormatColl * GetCurrFormatColl() const
bool CanRemoveNode(SwNodeOffset nNodeIdx) const
void FillFootNoteInfo(std::u16string_view aContent)
DECL_LINK(AsyncCallback, void *, void)
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)
bool EndSection(bool bLFStripped=false)
void NewMarquee(HTMLTable *pCurTable=nullptr)
size_t m_nContextStAttrMin
void RegisterHTMLTable(HTMLTable *pNew)
std::unique_ptr< HTMLAttrContext > PopContext(HtmlTokenId nToken=HtmlTokenId::NONE)
static OUString StripQueryFromPath(std::u16string_view rBase, const OUString &rPath)
Strips query and fragment from a URL path if base URL is a file:// one.
SwHTMLForm_Impl * m_pFormImpl
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
bool m_bNotifyMacroEventRead
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)
void DeleteSection(SwStartNode *pSttNd)
css::uno::Reference< css::drawing::XShape > InsertControl(const css::uno::Reference< css::form::XFormComponent > &rFormComp, const css::uno::Reference< css::beans::XPropertySet > &rFCompPropSet, const Size &rSize, sal_Int16 eVertOri, sal_Int16 eHoriOri, SfxItemSet &rCSS1ItemSet, SvxCSS1PropertyInfo &rCSS1PropInfo, const SvxMacroTableDtor &rMacroTable, const std::vector< OUString > &rUnoMacroTable, const std::vector< OUString > &rUnoMacroParamTable, bool bSetPropSet=true, bool bHidden=false)
static void SetSpace(const Size &rPixSpace, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFlyItemSet)
virtual void NextToken(HtmlTokenId nToken) override
SvxBrushItem * CreateBrushItem(const Color *pColor, const OUString &rImageURL, const OUString &rStyle, const OUString &rId, const OUString &rClass)
void ParseMoreMetaOptions()
void EndForm(bool bAppend=true)
sal_uInt16 m_nSBModuleCnt
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)
void SaveDocContext(HTMLAttrContext *pCntxt, HtmlContextFlags nFlags, const SwPosition *pNewPos)
std::shared_ptr< HTMLTable > BuildTable(SvxAdjust eCellAdjust, bool bIsParentHead=false, bool bHasParentSection=true, bool bHasToFlow=false)
OUString m_aBulletGrfs[MAXLEVEL]
void FillEndNoteInfo(std::u16string_view aContent)
void EndContextAttrs(HTMLAttrContext *pContext)
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)
void InsertFlyFrame(const SfxItemSet &rItemSet, HTMLAttrContext *pCntxt, const OUString &rId)
std::vector< sal_uInt16 > m_aFontStack
void BuildTableSection(HTMLTable *pTable, bool bReadOptions, bool bHead)
virtual ~SwHTMLParser() override
void GetDefaultScriptType(ScriptType &rType, OUString &rTypeStr) const
void BuildTableRow(HTMLTable *pTable, bool bReadOptions, SvxAdjust eGrpAdjust, sal_Int16 eVertOri)
HTMLAttr ** GetAttrTabEntry(sal_uInt16 nWhich)
virtual void Continue(HtmlTokenId nToken) override
SwHTMLNumRuleInfo & GetNumInfo()
static SvxNumType GetNumType(std::u16string_view rStr, SvxNumType eDfltType)
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)
bool IsReadingHeaderOrFooter() const
virtual void AddMetaUserDefined(OUString const &i_rMetaName) override
HTMLScriptLanguage m_eScriptLang
void SetAttr_(bool bChkEnd, bool bBeforeTable, std::deque< std::unique_ptr< HTMLAttr > > *pPostIts)
std::unique_ptr< SwField > m_xField
void RestoreDocContext(HTMLAttrContext *pCntxt)
void InsertFootEndNoteText()
void EndDefListItem(HtmlTokenId nToken=HtmlTokenId::NONE)
bool EndSections(bool bLFStripped)
void InsertSelectOption()
sal_Int32 StripTrailingLF()
std::vector< sal_uInt16 > m_aBaseFontStack
rtl::Reference< SdrObject > m_pMarquee
std::unique_ptr< SwCSS1Parser > m_pCSS1Parser
bool m_bReadingHeaderOrFooter
SwTwips GetCurrentBrowseWidth()
std::unique_ptr< SwApplet_Impl > m_pAppletImpl
void EndNumberBulletList(HtmlTokenId nToken=HtmlTokenId::NONE)
void SplitPREListingXMP(HTMLAttrContext *pCntxt)
sal_uInt16 m_nFontStHeadStart
void NotifyMacroEventRead()
void BuildTableCell(HTMLTable *pTable, bool bReadOptions, bool bHead)
std::vector< SwPending > m_vPendingStack
std::vector< HTMLTable * > m_aTables
std::unique_ptr< ImageMaps > m_pImageMaps
all Image-Maps that have been read
void InsertParaAttrs(const SfxItemSet &rItemSet)
SfxViewFrame * m_pTempViewFrame
SwStartNode * InsertTempTableCaptionSection()
void DeregisterHTMLTable(HTMLTable *pOld)
bool AppendTextNode(SwHTMLAppendMode eMode=AM_NORMAL, bool bUpdateNum=true)
void InsertDrawObject(SdrObject *pNewDrawObj, const Size &rSpace, sal_Int16 eVertOri, sal_Int16 eHoriOri, SfxItemSet &rCSS1ItemSet, SvxCSS1PropertyInfo &rCSS1PropInfo)
const SwStartNode * InsertTableSection(const SwStartNode *pPrevStNd)
ImageMap * FindImageMap(std::u16string_view rURL) const
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 MovePageDescAttrs(SwNode *pSrcNd, SwNodeOffset nDestIdx, bool bFormatBreak)
void NewHeading(HtmlTokenId nToken)
void EndPara(bool bReal=false)
bool m_bInFootEndNoteAnchor
void EndTextFormatColl(HtmlTokenId nToken)
void FixHeaderFooterDistance(bool bHeader, const SwPosition *pOldPos)
static void RegisterDrawObjectToTable(HTMLTable *pCurTable, SdrObject *pObj, sal_uInt8 nWidth)
static void ResizeDrawObject(SdrObject *pObj, SwTwips nWidth)
sal_uInt16 m_nBaseFontStMin
std::unique_ptr< HTMLTableCnts > InsertTableContents(bool bHead)
void EndFontAttr(HtmlTokenId nToken)
sal_uInt16 IncGrfsThatResizeTable()
void SplitAttrTab(const SwPosition &rNewPos)
bool HasCurrentParaBookmarks(bool bIgnoreStack=false) const
bool m_bInFootEndNoteSymbol
void SetNodeNum(sal_uInt8 nLevel)
static void SetFrameFormatAttrs(SfxItemSet &rItemSet, HtmlFrameFormatFlags nFlags, SfxItemSet &rFrameItemSet)
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
void BuildTableColGroup(HTMLTable *pTable, bool bReadOptions)
bool EndAttr(HTMLAttr *pAttr, bool bChkEmpty=true)
std::unique_ptr< SwHTMLFootEndNote_Impl > m_pFootEndNoteImpl
SwNodeIndex * GetFootEndNoteSection(const OUString &rName)
bool FileDownload(const OUString &rURL, OUString &rStr)
virtual bool ParseMetaOptions(const css::uno::Reference< css::document::XDocumentProperties > &, SvKeyValueIterator *) override
void GetULSpaceFromContext(sal_uInt16 &rUpper, sal_uInt16 &rLower) const
static void SetVarSize(SvxCSS1PropertyInfo const &rPropInfo, SfxItemSet &rFlyItemSet, SwTwips nDfltWidth=MINLAY, sal_uInt8 nDefaultPercentWidth=0)
void RestoreAttrTab(std::shared_ptr< HTMLAttrTable > const &rNewAttrTab)
void InsertBasicDocEvent(const OUString &aEventName, const OUString &rName, ScriptType eScrType, const OUString &rScrType)
SwViewShell * CallEndAction(bool bChkAction=false, bool bChkPtr=true)
std::deque< sal_Int32 > m_aMoveFlyCnts
void BuildTableCaption(HTMLTable *pTable)
bool HasCurrentParaFlys(bool bNoSurroundOnly=false, bool bSurroundOnly=false) const
void InsertFloatingFrame()
SwViewShell * m_pActionViewShell
OUString m_aEmbedURL
This is the URL of the outer <object> data if it's not OLE2 or an image.
void NewForm(bool bAppend=true)
Marks a node in the document model.
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
PaM is Point and Mark: a selection of the document model.
Starts a section of nodes in the document model.
constexpr auto toTwips(N number, Length from)
HTMLAttr * pFirstLineIndent
HTMLAttr * pTextLeftMargin
HTMLAttr * pFontHeightCTL
HTMLAttr * pFontHeightCJK
SwPending(HtmlTokenId nTkn)
std::unique_ptr< SwPendingData > pData
Marks a position in the document model.
sal_Int32 GetContentIndex() const
HTMLOptionEnum< SvxAdjust > const aHTMLPAlignTable[]
constexpr tools::Long HTML_DFLT_IMG_HEIGHT
std::vector< std::unique_ptr< ImageMap > > ImageMaps
HTMLOptionEnum< sal_Int16 > const aHTMLImgVAlignTable[]
std::vector< std::unique_ptr< HTMLAttrContext > > HTMLAttrContexts
std::deque< HTMLAttr * > HTMLAttrs
constexpr tools::Long HTML_CJK_PARSPACE
constexpr tools::Long HTML_CTL_PARSPACE
HTMLOptionEnum< sal_Int16 > const aHTMLImgHAlignTable[]
constexpr tools::Long HTML_DFLT_IMG_WIDTH
constexpr sal_uInt8 MAXLEVEL