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>
61 #define HTML_CJK_PARSPACE (MM50/2)
62 #define HTML_CTL_PARSPACE (MM50/2)
64 #define HTML_DFLT_IMG_WIDTH (MM50*4)
65 #define HTML_DFLT_IMG_HEIGHT (MM50*2)
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;
504 void SetAttr_(
bool bChkEnd,
bool bBeforeTable, std::deque<std::unique_ptr<HTMLAttr>> *pPostIts );
505 void SetAttr(
bool bChkEnd =
true,
bool bBeforeTable =
false,
506 std::deque<std::unique_ptr<HTMLAttr>> *pPostIts =
nullptr )
508 if( !m_aSetAttrTab.empty() || !m_aMoveFlyFrames.empty() )
509 SetAttr_( bChkEnd, bBeforeTable, pPostIts );
526 void SaveAttrTab(std::shared_ptr<HTMLAttrTable>
const & rNewAttrTab);
528 void SplitAttrTab(std::shared_ptr<HTMLAttrTable>
const & rNewAttrTab,
bool bMoveEndBack);
529 void RestoreAttrTab(std::shared_ptr<HTMLAttrTable>
const & rNewAttrTab);
531 void InsertAttrs( std::deque<std::unique_ptr<HTMLAttr>> rAttrs );
571 m_aContexts.push_back(std::move(rCntxt));
579 bool bIgnoreCurrent=
false )
const;
581 short& nIndent )
const;
590 void EndPara(
bool bReal =
false );
604 const OUString& rId );
685 bool bDontAppend=
false );
698 bool bPercentWidth,
bool bPercentHeight,
710 OUString& rTypeStr )
const;
716 #if HAVE_FEATURE_JAVA
720 #if HAVE_FEATURE_JAVA
741 void InsertComment(
const OUString& rName,
const char *pTag =
nullptr );
756 ScriptType eScrType,
const OUString& rScrType );
764 static inline bool HasStyleOptions( std::u16string_view rStyle, std::u16string_view rId,
765 std::u16string_view rClass,
const OUString *pLang=
nullptr,
766 const OUString *pDir=
nullptr );
770 const OUString *pLang=
nullptr,
const OUString *pDir=
nullptr );
781 const css::uno::Reference< css::form::XFormComponent > & rFormComp,
782 const css::uno::Reference< css::beans::XPropertySet > & rFCompPropSet,
789 const std::vector<OUString>& rUnoMacroTable,
790 const std::vector<OUString>& rUnoMacroParamTable,
791 bool bSetPropSet =
true,
792 bool bHidden =
false );
793 void SetControlSize(
const css::uno::Reference< css::drawing::XShape > & rShape,
const Size& rTextSz,
794 bool bMinWidth,
bool bMinHeight );
802 void NewForm(
bool bAppend=
true );
803 void EndForm(
bool bAppend=
true );
836 SvxAdjust eGrpAdjust, sal_Int16 eVertOri );
841 bool bIsParentHead =
false,
842 bool bHasParentSection=
true,
843 bool bHasToFlow =
false);
849 bool FileDownload(
const OUString& rURL, OUString& rStr );
872 bool bSurroundOnly =
false )
const;
897 const OUString &rImageURL,
898 const OUString &rStyle,
900 const OUString &rClass );
915 const OUString& rFileName,
916 const OUString& rBaseURL,
919 bool bIgnoreHTMLComments,
920 const OUString& rNamespace);
924 static sal_uInt16
ToTwips( sal_uInt16 nPixel );
929 virtual bool ParseMetaOptions(
const css::uno::Reference<css::document::XDocumentProperties>&,
935 m_aTables.push_back(pNew);
960 std::unique_ptr<SwPendingData>
pData;
986 short& nIndent )
const
1004 sal_uInt16& rLower )
const
1014 std::u16string_view rId,
1015 std::u16string_view rClass,
1016 const OUString *pLang,
1017 const OUString *pDir )
1019 return !rStyle.empty() || !rId.empty() || !rClass.empty() ||
1020 (pLang && !pLang->isEmpty()) || (pDir && !pDir->isEmpty());
1031 , 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)
sal_Int32 GetSttCnt() const
std::vector< sal_uInt16 > m_aBaseFontStack
void FillEndNoteInfo(const OUString &rContent)
HTMLOptionEnum< SvxAdjust > const aHTMLPAlignTable[]
void FixHeaderFooterDistance(bool bHeader, const SwPosition *pOldPos)
ImageMap * FindImageMap(const OUString &rURL) const
std::vector< sal_uInt16 > m_aFontStack
SwStartNode * InsertTempTableCaptionSection()
sal_uInt16 m_nSelectEntryCnt
bool FileDownload(const OUString &rURL, OUString &rStr)
sal_uInt16 GetDfltTextFormatColl() const
std::shared_ptr< HTMLTable > BuildTable(SvxAdjust eCellAdjust, bool bIsParentHead=false, bool bHasParentSection=true, bool bHasToFlow=false)
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
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)
HTMLAttrContexts m_aContexts
const SfxItemSet * GetFrameItemSet() const
const OUString & GetClass() const
sal_uInt32 m_aFontHeights[7]
const SwNodeIndex & GetSttPara() const
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)
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
sal_uLong GetIndex() const
DECL_LINK(AsyncCallback, void *, void)
void MovePageDescAttrs(SwNode *pSrcNd, sal_uLong nDestIdx, bool bFormatBreak)
void Reset(const SwNodeIndex &rSttPara, sal_Int32 nSttCnt, HTMLAttr **pHd, const std::shared_ptr< HTMLAttrTable > &rAttrTab)
bool IsRestartListing() const
void NewCharFormat(HtmlTokenId nToken)
void InsertDrawObject(SdrObject *pNewDrawObj, const Size &rSpace, sal_Int16 eVertOri, sal_Int16 eHoriOri, SfxItemSet &rCSS1ItemSet, SvxCSS1PropertyInfo &rCSS1PropInfo)
bool CreateContainer(const OUString &rClass, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, HTMLAttrContext *pContext)
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)
std::set< OUString > m_aAllowedRTFOLEMimeTypes
const SwNodeIndex & GetEndPara() const
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()
bool HasCurrentParaBookmarks(bool bIgnoreStack=false) const
HtmlTokenId m_nOpenParaToken
void NewNumberBulletListItem(HtmlTokenId nToken)
void SetHeaderOrFooter(bool bSet)
std::unique_ptr< SwCSS1Parser > m_pCSS1Parser
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
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
bool PendingObjectsInPaM(SwPaM &rPam) const
void InsertFootEndNoteText()
bool IsULSpaceChanged() const
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
const SfxPoolItem & GetItem() 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
bool m_bDefaultTextFormatColl
void GetULSpaceFromContext(sal_uInt16 &rUpper, sal_uInt16 &rLower) const
void ClearContext(HTMLAttrContext *pContext)
HTMLAttr * pFontHeightCTL
bool CanRemoveNode(sal_uLong nNodeIdx) const
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)
HTMLAttr * pFontHeightCJK
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)
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
sal_Int32 GetEndCnt() const
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
void NewTextFormatColl(HtmlTokenId nToken, sal_uInt16 nPoolId)
void SaveDocContext(HTMLAttrContext *pCntxt, HtmlContextFlags nFlags, const SwPosition *pNewPos)
void EndFontAttr(HtmlTokenId nToken)
std::unique_ptr< SfxPoolItem > m_pItem
sal_uInt32 GetSttParaIdx() const
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
sal_uInt32 GetEndParaIdx() const