19 #ifndef INCLUDED_SW_SOURCE_FILTER_HTML_SWHTML_HXX
20 #define INCLUDED_SW_SOURCE_FILTER_HTML_SWHTML_HXX
22 #include <config_java.h>
29 #include <rtl/ref.hxx>
30 #include <rtl/ustrbuf.hxx>
33 #include <com/sun/star/drawing/XShape.hpp>
34 #include <com/sun/star/form/XFormComponent.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
146 HTMLAttr **pHd,
const std::shared_ptr<HTMLAttrTable>& rAttrTab );
149 sal_Int32 nEndCnt,
HTMLAttr **pHd,
const std::shared_ptr<HTMLAttrTable>& rAttrTab );
157 HTMLAttr **pHd,
const std::shared_ptr<HTMLAttrTable>& rAttrTab );
185 m_xAttrTab = rAttrTab;
244 bool bDfltColl=
false );
255 inline void SetMargins( sal_uInt16 nLeft, sal_uInt16 nRight,
short nIndent );
258 inline void GetMargins( sal_uInt16& nLeft, sal_uInt16& nRight,
259 short &nIndent )
const;
261 inline void SetULSpace( sal_uInt16 nUpper, sal_uInt16 nLower );
263 inline void GetULSpace( sal_uInt16& rUpper, sal_uInt16& rLower )
const;
265 bool HasAttrs()
const {
return !m_aAttrs.empty(); }
309 typedef std::vector<std::unique_ptr<ImageMap>>
ImageMaps;
507 void SetAttr_(
bool bChkEnd,
bool bBeforeTable, std::deque<std::unique_ptr<HTMLAttr>> *pPostIts );
508 void SetAttr(
bool bChkEnd =
true,
bool bBeforeTable =
false,
509 std::deque<std::unique_ptr<HTMLAttr>> *pPostIts =
nullptr )
511 if( !m_aSetAttrTab.empty() || !m_aMoveFlyFrames.empty() )
512 SetAttr_( bChkEnd, bBeforeTable, pPostIts );
529 void SaveAttrTab(std::shared_ptr<HTMLAttrTable>
const & rNewAttrTab);
531 void SplitAttrTab(std::shared_ptr<HTMLAttrTable>
const & rNewAttrTab,
bool bMoveEndBack);
532 void RestoreAttrTab(std::shared_ptr<HTMLAttrTable>
const & rNewAttrTab);
534 void InsertAttrs( std::deque<std::unique_ptr<HTMLAttr>> rAttrs );
574 m_aContexts.push_back(std::move(rCntxt));
582 bool bIgnoreCurrent=
false )
const;
584 short& nIndent )
const;
593 void EndPara(
bool bReal =
false );
607 const OUString& rId );
688 bool bDontAppend=
false );
701 bool bPercentWidth,
bool bPercentHeight,
713 OUString& rTypeStr )
const;
719 #if HAVE_FEATURE_JAVA
723 #if HAVE_FEATURE_JAVA
744 void InsertComment(
const OUString& rName,
const char *pTag =
nullptr );
759 ScriptType eScrType,
const OUString& rScrType );
767 static inline bool HasStyleOptions( std::u16string_view rStyle, std::u16string_view rId,
768 std::u16string_view rClass,
const OUString *pLang=
nullptr,
769 const OUString *pDir=
nullptr );
773 const OUString *pLang=
nullptr,
const OUString *pDir=
nullptr );
784 const css::uno::Reference< css::form::XFormComponent > & rFormComp,
785 const css::uno::Reference< css::beans::XPropertySet > & rFCompPropSet,
792 const std::vector<OUString>& rUnoMacroTable,
793 const std::vector<OUString>& rUnoMacroParamTable,
794 bool bSetPropSet =
true,
795 bool bHidden =
false );
796 void SetControlSize(
const css::uno::Reference< css::drawing::XShape > & rShape,
const Size& rTextSz,
797 bool bMinWidth,
bool bMinHeight );
805 void NewForm(
bool bAppend=
true );
806 void EndForm(
bool bAppend=
true );
839 SvxAdjust eGrpAdjust, sal_Int16 eVertOri );
844 bool bIsParentHead =
false,
845 bool bHasParentSection=
true,
846 bool bHasToFlow =
false);
852 bool FileDownload(
const OUString& rURL, OUString& rStr );
875 bool bSurroundOnly =
false )
const;
898 const OUString &rImageURL,
899 const OUString &rStyle,
901 const OUString &rClass );
916 const OUString& rFileName,
917 const OUString& rBaseURL,
920 bool bIgnoreHTMLComments,
921 const OUString& rNamespace);
925 static sal_uInt16
ToTwips( sal_uInt16 nPixel );
930 virtual bool ParseMetaOptions(
const css::uno::Reference<css::document::XDocumentProperties>&,
936 m_aTables.push_back(pNew);
961 std::unique_ptr<SwPendingData>
pData;
987 short& nIndent )
const
1005 sal_uInt16& rLower )
const
1015 std::u16string_view rId,
1016 std::u16string_view rClass,
1017 const OUString *pLang,
1018 const OUString *pDir )
1020 return !rStyle.empty() || !rId.empty() || !rClass.empty() ||
1021 (pLang && !pLang->isEmpty()) || (pDir && !pDir->isEmpty());
1032 , pTextFootnote(pInTextFootnote)
sal_uInt16 IncGrfsThatResizeTable()
void SetNodeNum(sal_uInt8 nLevel)
std::vector< SwPending > m_vPendingStack
Starts a section of nodes in the document model.
void GetULSpace(sal_uInt16 &rUpper, sal_uInt16 &rLower) const
bool EndSection(bool bLFStripped=false)
static void SetSpace(const Size &rPixSpace, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFlyItemSet)
SwViewShell * CheckActionViewShell()
virtual void Notify(const SfxHint &) override
void SetAnchorAndAdjustment(sal_Int16 eVertOri, sal_Int16 eHoriOri, const SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFrameSet)
void SplitPREListingXMP(HTMLAttrContext *pCntxt)
bool IsFinishPREListingXMP() const
void DeleteSection(SwStartNode *pSttNd)
sal_uInt16 m_nMissingImgMaps
bool HasSaveDocContext() const
virtual void Continue(HtmlTokenId nToken) override
Marks a position in the document model.
void SetControlSize(const css::uno::Reference< css::drawing::XShape > &rShape, const Size &rTextSz, bool bMinWidth, bool bMinHeight)
std::unique_ptr< HTMLAttrContext_SaveDoc > m_pSaveDocContext
void EndTextFormatColl(HtmlTokenId nToken)
void SetAttr(bool bChkEnd=true, bool bBeforeTable=false, std::deque< std::unique_ptr< HTMLAttr >> *pPostIts=nullptr)
void EndForm(bool bAppend=true)
std::vector< sal_uInt16 > m_aBaseFontStack
void FillEndNoteInfo(const OUString &rContent)
constexpr auto toTwips(N number, Length from)
HTMLOptionEnum< SvxAdjust > const aHTMLPAlignTable[]
void FixHeaderFooterDistance(bool bHeader, const SwPosition *pOldPos)
std::vector< sal_uInt16 > m_aFontStack
SwStartNode * InsertTempTableCaptionSection()
sal_uInt16 m_nSelectEntryCnt
bool FileDownload(const OUString &rURL, OUString &rStr)
std::shared_ptr< HTMLTable > BuildTable(SvxAdjust eCellAdjust, bool bIsParentHead=false, bool bHasParentSection=true, bool bHasToFlow=false)
bool CreateContainer(std::u16string_view rClass, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, HTMLAttrContext *pContext)
bool IsReadingHeaderOrFooter() const
std::unique_ptr< SwHTMLFootEndNote_Impl > m_pFootEndNoteImpl
void SaveAttrTab(std::shared_ptr< HTMLAttrTable > const &rNewAttrTab)
HTMLOptionEnum< sal_Int16 > const aHTMLImgVAlignTable[]
void InsertBookmark(const OUString &rName)
std::unique_ptr< SfxItemSet > m_pFrameItemSet
void NewNumberBulletList(HtmlTokenId nToken)
HTMLAttr * GetNext() const
HTMLAttr * pFontHeightCTL
Base class of all fields.
const SwStartNode * InsertTableSection(const SwStartNode *pPrevStNd)
sal_uInt16 m_nTextFormatColl
void NewAttr(const std::shared_ptr< HTMLAttrTable > &rAttrTab, HTMLAttr **ppAttr, const SfxPoolItem &rItem)
sal_uInt16 m_nBaseFontStMin
void SetRestartListing(bool bSet)
SwViewShell * CallEndAction(bool bChkAction=false, bool bChkPtr=true)
std::unique_ptr< HTMLTableCnts > InsertTableContents(bool bHead)
constexpr sal_uInt8 MAXLEVEL
HTMLAttrContexts m_aContexts
const SfxItemSet * GetFrameItemSet() const
const OUString & GetClass() const
sal_uInt32 m_aFontHeights[7]
sal_Int32 StripTrailingLF()
void NewForm(bool bAppend=true)
std::vector< std::unique_ptr< HTMLAttrContext > > HTMLAttrContexts
std::unique_ptr< SwPendingData > pData
sal_uInt16 m_nRightMargin
bool m_bReadingHeaderOrFooter
void SplitAttrTab(const SwPosition &rNewPos)
std::unique_ptr< ImageMaps > m_pImageMaps
all Image-Maps that have been read
void SetAppendMode(SwHTMLAppendMode eMode)
void InsertComment(const OUString &rName, const char *pTag=nullptr)
bool m_isInTableStructure
static void RegisterDrawObjectToTable(HTMLTable *pCurTable, SdrObject *pObj, sal_uInt8 nWidth)
TableDepthGuard(SwHTMLParser &rParser)
SwNodeIndex * m_pSttNdIdx
virtual SvParserState CallParser() override
void InsertBasicDocEvent(const OUString &aEventName, const OUString &rName, ScriptType eScrType, const OUString &rScrType)
void SetULSpace(sal_uInt16 nUpper, sal_uInt16 nLower)
void SetMargins(sal_uInt16 nLeft, sal_uInt16 nRight, short nIndent)
void NewDivision(HtmlTokenId nToken)
void RestoreDocContext(HTMLAttrContext *pCntxt)
bool IsHeaderOrFooter() const
void GetMarginsFromContext(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent, bool bIgnoreCurrent=false) const
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)
bool m_bNotifyMacroEventRead
void EndDefListItem(HtmlTokenId nToken=HtmlTokenId::NONE)
void GetDefaultScriptType(ScriptType &rType, OUString &rTypeStr) const
static void ResizeDrawObject(SdrObject *pObj, SwTwips nWidth)
void InsertAttrs(std::deque< std::unique_ptr< HTMLAttr >> rAttrs)
sal_Int32 GetStartContent() const
bool ParseStyleOptions(const OUString &rStyle, const OUString &rId, const OUString &rClass, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const OUString *pLang=nullptr, const OUString *pDir=nullptr)
const HTMLAttrs & GetAttrs() const
DECL_LINK(AsyncCallback, void *, void)
SwNodeOffset GetEndParagraphIdx() const
void Reset(const SwNodeIndex &rSttPara, sal_Int32 nSttCnt, HTMLAttr **pHd, const std::shared_ptr< HTMLAttrTable > &rAttrTab)
bool IsRestartListing() const
SwNodeOffset GetIndex() const
void NewCharFormat(HtmlTokenId nToken)
void InsertDrawObject(SdrObject *pNewDrawObj, const Size &rSpace, sal_Int16 eVertOri, sal_Int16 eHoriOri, SfxItemSet &rCSS1ItemSet, SvxCSS1PropertyInfo &rCSS1PropInfo)
static OUString StripQueryFromPath(const OUString &rBase, const OUString &rPath)
Strips query and fragment from a URL path if base URL is a file:// one.
std::stack< SwOLENode * > m_aEmbeds
Non-owning pointers to already inserted OLE nodes, matching opened
std::vector< std::unique_ptr< SwHTMLFrameFormatListener > > m_aMoveFlyFrames
void InsertAttr(const SfxPoolItem &rItem, bool bInsAtStart)
void BuildTableColGroup(HTMLTable *pTable, bool bReadOptions)
sal_Int32 GetEndContent() const
constexpr tools::Long HTML_CTL_PARSPACE
std::set< OUString > m_aAllowedRTFOLEMimeTypes
std::unique_ptr< ImportProgress > m_xProgress
std::unique_ptr< SwField > m_xField
void RegisterHTMLTable(HTMLTable *pNew)
static void SetFrameFormatAttrs(SfxItemSet &rItemSet, HtmlFrameFormatFlags nFlags, SfxItemSet &rFrameItemSet)
PaM is Point and Mark: a selection of the document model.
sal_uInt16 m_nDefListDeep
SwNodeIndex * GetFootEndNoteSection(const OUString &rName)
void InsertNext(HTMLAttr *pNxt)
void InsertFootEndNote(const OUString &rName, bool bEndNote, bool bFixed)
sal_uInt16 m_nFirstLineIndent
void DeleteAttr(HTMLAttr *pAttr)
std::deque< HTMLAttr * > HTMLAttrs
void EndTag(HtmlTokenId nToken)
std::shared_ptr< HTMLAttrTable > m_xAttrTab
std::deque< sal_Int32 > m_aMoveFlyCnts
bool IsLRSpaceChanged() const
HTMLAttr * GetPrev() const
void EndContextAttrs(HTMLAttrContext *pContext)
sal_Int32 m_nStartContent
void NewMarquee(HTMLTable *pCurTable=nullptr)
SwHTMLParser(SwDoc *pD, SwPaM &rCursor, SvStream &rIn, const OUString &rFileName, const OUString &rBaseURL, bool bReadNewDoc, SfxMedium *pMed, bool bReadUTF8, bool bIgnoreHTMLComments, const OUString &rNamespace)
void NotifyMacroEventRead()
void InsertFloatingFrame()
sal_uInt16 GetDefaultTextFormatColl() const
bool HasCurrentParaBookmarks(bool bIgnoreStack=false) const
HtmlTokenId m_nOpenParaToken
void NewNumberBulletListItem(HtmlTokenId nToken)
void SetHeaderOrFooter(bool bSet)
std::unique_ptr< SwCSS1Parser > m_pCSS1Parser
SwNodeOffset GetStartParagraphIdx() const
void BuildTableRow(HTMLTable *pTable, bool bReadOptions, SvxAdjust eGrpAdjust, sal_Int16 eVertOri)
HTMLAttrContext(HtmlTokenId nTokn, sal_uInt16 nPoolId, const OUString &rClass, bool bDfltColl=false)
void EndContext(HTMLAttrContext *pContext)
virtual void AddMetaUserDefined(OUString const &i_rMetaName) override
std::unique_ptr< HTMLAttrContext > PopContext(HtmlTokenId nToken=HtmlTokenId::NONE)
void BuildTableCell(HTMLTable *pTable, bool bReadOptions, bool bHead)
bool DoPositioning(SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, HTMLAttrContext *pContext)
void BuildTableSection(HTMLTable *pTable, bool bReadOptions, bool bHead)
void SetSpansSection(bool bSet)
Marks a node in the document model.
bool m_bInFootEndNoteSymbol
void NewHeading(HtmlTokenId nToken)
bool m_bFinishPREListingXMP
void DeregisterHTMLTable(HTMLTable *pOld)
void RegisterFlyFrame(SwFrameFormat *pFlyFrame)
HTMLAttr * Clone(const SwNodeIndex &rEndPara, sal_Int32 nEndCnt) const
bool IsRestartPRE() const
const SwNodeIndex & GetEndParagraph() const
void InsertFlyFrame(const SfxItemSet &rItemSet, HTMLAttrContext *pCntxt, const OUString &rId)
HTMLScriptLanguage m_eScriptLang
void InsertParaAttrs(const SfxItemSet &rItemSet)
void InsertCommentText(const char *pTag)
void GetMargins(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent) const
HTMLAttrContext_SaveDoc * GetSaveDocContext(bool bCreate=false)
bool IsRestartXMP() const
bool HasCurrentParaFlys(bool bNoSurroundOnly=false, bool bSurroundOnly=false) const
static sal_uInt16 ToTwips(sal_uInt16 nPixel)
SfxViewFrame * m_pTempViewFrame
SwTwips GetCurrentBrowseWidth()
void NewMultiCol(sal_uInt16 columnsFromCss=0)
void EndNumberBulletListItem(HtmlTokenId nToken, bool bSetColl)
void ClearFootnotesMarksInRange(const SwNodeIndex &rSttIdx, const SwNodeIndex &rEndIdx)
bool m_bIgnoreHTMLComments
void EndNumberBulletList(HtmlTokenId nToken=HtmlTokenId::NONE)
virtual void NextToken(HtmlTokenId nToken) override
std::unique_ptr< SwApplet_Impl > m_pAppletImpl
void InsertFootEndNoteText()
bool IsULSpaceChanged() const
void MovePageDescAttrs(SwNode *pSrcNd, SwNodeOffset nDestIdx, bool bFormatBreak)
bool EndSections(bool bLFStripped)
void NewDefListItem(HtmlTokenId nToken)
HTMLOptionEnum< sal_Int16 > const aHTMLImgHAlignTable[]
HTMLAttr(const SwPosition &rPos, const SfxPoolItem &rItem, HTMLAttr **pHd, const std::shared_ptr< HTMLAttrTable > &rAttrTab)
std::vector< std::unique_ptr< ImageMap > > ImageMaps
constexpr tools::Long HTML_DFLT_IMG_HEIGHT
const SfxPoolItem & GetItem() const
bool CanRemoveNode(SwNodeOffset nNodeIdx) const
std::vector< std::unique_ptr< SwTableBox > > m_aOrphanedTableBoxes
void SetPopStack(bool bSet)
static SvxNumType GetNumType(const OUString &rStr, SvxNumType eDfltType)
void InsertTextAreaText(HtmlTokenId nToken)
HtmlTokenId GetToken() const
HTMLAttr * pFontHeightCJK
bool m_bDefaultTextFormatColl
void GetULSpaceFromContext(sal_uInt16 &rUpper, sal_uInt16 &rLower) const
void ClearContext(HTMLAttrContext *pContext)
void SetTextCollAttrs(HTMLAttrContext *pContext=nullptr)
sal_Int32 GetIndex() const
SwHTMLNumRuleInfo & GetNumInfo()
void BuildTableCaption(HTMLTable *pTable)
std::vector< HTMLTable * > m_aTables
bool EndAttr(HTMLAttr *pAttr, bool bChkEmpty=true)
void NewStdAttr(HtmlTokenId nToken)
SvxBrushItem * CreateBrushItem(const Color *pColor, const OUString &rImageURL, const OUString &rStyle, const OUString &rId, const OUString &rClass)
SwHTMLForm_Impl * m_pFormImpl
void SetAttr_(bool bChkEnd, bool bBeforeTable, std::deque< std::unique_ptr< HTMLAttr >> *pPostIts)
constexpr tools::Long HTML_DFLT_IMG_WIDTH
sal_uInt16 m_nFontStHeadStart
void SetVisible(bool bVisible)
HTMLAttr ** GetAttrTabEntry(sal_uInt16 nWhich)
std::unique_ptr< SwHTMLNumRuleInfo > m_pNumRuleInfo
virtual ~SwHTMLParser() override
static void SetVarSize(SvxCSS1PropertyInfo const &rPropInfo, SfxItemSet &rFlyItemSet, SwTwips nDfltWidth=MINLAY, sal_uInt8 nDefaultPercentWidth=0)
void SetFinishPREListingXMP(bool bSet)
void SetRestartXMP(bool bSet)
size_t m_nContextStAttrMin
void RestoreAttrTab(std::shared_ptr< HTMLAttrTable > const &rNewAttrTab)
ImageMap * FindImageMap(std::u16string_view rURL) const
std::shared_ptr< HTMLTable > m_xTable
void NewFontAttr(HtmlTokenId nToken)
void FillFootNoteInfo(const OUString &rContent)
const SwFormatColl * GetCurrFormatColl() const
OUString m_InfoNames[4]
the names corresponding to the DOCINFO field subtypes INFO[1-4]
void InsertSelectOption()
void SetRestartPRE(bool bSet)
void GetMarginsFromContextWithNumberBullet(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent) const
sal_uInt16 m_nSBModuleCnt
void SetStart(const SwPosition &rPos)
void SetHead(HTMLAttr **ppHd, const std::shared_ptr< HTMLAttrTable > &rAttrTab)
std::shared_ptr< HTMLAttrTable > m_xAttrTab
void ClearSaveDocContext()
bool m_bInFootEndNoteAnchor
bool AppendTextNode(SwHTMLAppendMode eMode=AM_NORMAL, bool bUpdateNum=true)
sal_uInt16 GetTextFormatColl() const
void EndPara(bool bReal=false)
void PushContext(std::unique_ptr< HTMLAttrContext > &rCntxt)
SwHTMLAppendMode GetAppendMode() const
SwViewShell * CallStartAction(SwViewShell *pVSh=nullptr, bool bChkPtr=true)
SwPending(HtmlTokenId nTkn)
SwViewShell * m_pActionViewShell
rtl::Reference< SwDoc > m_xDoc
void ParseMoreMetaOptions()
SwHTMLAppendMode m_eAppend
const SwNodeIndex & GetStartParagraph() const
void NewTextFormatColl(HtmlTokenId nToken, sal_uInt16 nPoolId)
constexpr tools::Long HTML_CJK_PARSPACE
void SaveDocContext(HTMLAttrContext *pCntxt, HtmlContextFlags nFlags, const SwPosition *pNewPos)
void EndFontAttr(HtmlTokenId nToken)
std::unique_ptr< SfxPoolItem > m_pItem
void InsertPrev(HTMLAttr *pPrv)
bool GetSpansSection() const
static void SetFixSize(const Size &rPixSize, const Size &rTwipDfltSize, bool bPercentWidth, bool bPercentHeight, SvxCSS1PropertyInfo const &rPropInfo, SfxItemSet &rFlyItemSet)
static bool HasStyleOptions(std::u16string_view rStyle, std::u16string_view rId, std::u16string_view rClass, const OUString *pLang=nullptr, const OUString *pDir=nullptr)
OUString m_aBulletGrfs[MAXLEVEL]
Base class of the Writer document model elements.
virtual bool ParseMetaOptions(const css::uno::Reference< css::document::XDocumentProperties > &, SvKeyValueIterator *) override