diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-02 12:20:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-06 05:59:16 +0000 |
commit | 59fbef6cf83083d678571f706bebd5f3147a3d0e (patch) | |
tree | cd0eadde188de2c28ea840f61406f27e7bd3b640 | |
parent | e07dc67dedcb8450bc9d6076f5ef5322c316d20a (diff) |
templatize HTMLEnumOption::GetEnum methods
And consequently fix bug in htmlfld.cxx in
the RES_DOCSTATFLD/SwDocStatSubType handling, where it was updating
the m_bUpdateDocStat fields by comparing the wrong enum variable.
Change-Id: If9a68699a9d375ace120a3bf4f4bf4d4ae20a8e0
Reviewed-on: https://gerrit.libreoffice.org/34857
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svtools/parhtml.hxx | 34 | ||||
-rw-r--r-- | sfx2/source/bastyp/frmhtml.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/bastyp/sfxhtml.cxx | 8 | ||||
-rw-r--r-- | svtools/source/svhtml/htmlsupp.cxx | 14 | ||||
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 78 | ||||
-rw-r--r-- | sw/source/filter/html/htmldrawreader.cxx | 26 | ||||
-rw-r--r-- | sw/source/filter/html/htmlfld.cxx | 124 | ||||
-rw-r--r-- | sw/source/filter/html/htmlform.cxx | 32 | ||||
-rw-r--r-- | sw/source/filter/html/htmlgrin.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/html/htmlnumreader.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/html/htmlsect.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/html/htmltab.cxx | 43 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 33 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.hxx | 6 |
14 files changed, 201 insertions, 232 deletions
diff --git a/include/svtools/parhtml.hxx b/include/svtools/parhtml.hxx index f48106695a4a..a46f07f4b8ca 100644 --- a/include/svtools/parhtml.hxx +++ b/include/svtools/parhtml.hxx @@ -72,10 +72,11 @@ enum HTMLScriptLanguage HTML_SL_UNKNOWN }; +template<typename EnumT> struct HTMLOptionEnum { const sal_Char *pName; // value of an HTML option - sal_uInt16 nValue; // and corresponding value of an enum + EnumT nValue; // and corresponding value of an enum }; /** Representation of an HTML option (=attribute in a start tag). @@ -105,10 +106,33 @@ public: void GetNumbers( std::vector<sal_uInt32> &rNumbers ) const; // ... as numbers void GetColor( Color& ) const; // ... as color - // ... as enum; pOptEnums is an HTMLOptionEnum array - sal_uInt16 GetEnum( const HTMLOptionEnum *pOptEnums, - sal_uInt16 nDflt=0 ) const; - bool GetEnum( sal_uInt16 &rEnum, const HTMLOptionEnum *pOptEnums ) const; + template<typename EnumT> + EnumT GetEnum( const HTMLOptionEnum<EnumT> *pOptEnums, + EnumT nDflt = static_cast<EnumT>(0) ) const + { + while( pOptEnums->pName ) + { + if( aValue.equalsIgnoreAsciiCaseAscii( pOptEnums->pName ) ) + return pOptEnums->nValue; + pOptEnums++; + } + return nDflt; + } + + template<typename EnumT> + bool GetEnum( EnumT &rEnum, const HTMLOptionEnum<EnumT> *pOptEnums ) const + { + while( pOptEnums->pName ) + { + if( aValue.equalsIgnoreAsciiCaseAscii( pOptEnums->pName ) ) + { + rEnum = pOptEnums->nValue; + return true; + } + pOptEnums++; + } + return false; + } // ... and as a few special enums HTMLInputType GetInputType() const; // <INPUT TYPE=...> diff --git a/sfx2/source/bastyp/frmhtml.cxx b/sfx2/source/bastyp/frmhtml.cxx index e421373aceb0..af567e90e4a5 100644 --- a/sfx2/source/bastyp/frmhtml.cxx +++ b/sfx2/source/bastyp/frmhtml.cxx @@ -38,12 +38,12 @@ static sal_Char const sHTML_SC_auto[] = "AUTO"; #define HTML_O_READONLY "READONLY" #define HTML_O_EDIT "EDIT" -static HTMLOptionEnum const aScollingTable[] = +static HTMLOptionEnum<ScrollingMode> const aScrollingTable[] = { { sHTML_SC_yes, ScrollingYes }, { sHTML_SC_no, ScrollingNo }, { sHTML_SC_auto, ScrollingAuto }, - { nullptr, 0 } + { nullptr, (ScrollingMode)0 } }; void SfxFrameHTMLParser::ParseFrameOptions( @@ -93,9 +93,7 @@ void SfxFrameHTMLParser::ParseFrameOptions( bMarginHeight = true; break; case HTML_O_SCROLLING: - pFrame->SetScrollingMode( - (ScrollingMode)rOption.GetEnum( aScollingTable, - ScrollingAuto ) ); + pFrame->SetScrollingMode( rOption.GetEnum( aScrollingTable, ScrollingAuto ) ); break; case HTML_O_FRAMEBORDER: { diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 54024936ddeb..ef9a0661931e 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -47,15 +47,15 @@ using namespace ::com::sun::star; // <INPUT TYPE=xxx> -static HTMLOptionEnum const aAreaShapeOptEnums[] = +static HTMLOptionEnum<sal_uInt16> const aAreaShapeOptEnums[] = { { OOO_STRING_SVTOOLS_HTML_SH_rect, IMAP_OBJ_RECTANGLE }, { OOO_STRING_SVTOOLS_HTML_SH_rectangle, IMAP_OBJ_RECTANGLE }, { OOO_STRING_SVTOOLS_HTML_SH_circ, IMAP_OBJ_CIRCLE }, { OOO_STRING_SVTOOLS_HTML_SH_circle, IMAP_OBJ_CIRCLE }, - { OOO_STRING_SVTOOLS_HTML_SH_poly, IMAP_OBJ_POLYGON }, - { OOO_STRING_SVTOOLS_HTML_SH_polygon, IMAP_OBJ_POLYGON }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_SH_poly, IMAP_OBJ_POLYGON }, + { OOO_STRING_SVTOOLS_HTML_SH_polygon, IMAP_OBJ_POLYGON }, + { nullptr, 0 } }; SfxHTMLParser::SfxHTMLParser( SvStream& rStream, bool bIsNewDoc, diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx index 2f075997e0ab..e1c9d5dd9b2c 100644 --- a/svtools/source/svhtml/htmlsupp.cxx +++ b/svtools/source/svhtml/htmlsupp.cxx @@ -26,13 +26,13 @@ #include <tools/urlobj.hxx> // Table for converting option values into strings -static HTMLOptionEnum const aScriptLangOptEnums[] = +static HTMLOptionEnum<HTMLScriptLanguage> const aScriptLangOptEnums[] = { - { OOO_STRING_SVTOOLS_HTML_LG_starbasic, HTML_SL_STARBASIC }, - { OOO_STRING_SVTOOLS_HTML_LG_javascript, HTML_SL_JAVASCRIPT }, - { OOO_STRING_SVTOOLS_HTML_LG_javascript11,HTML_SL_JAVASCRIPT }, - { OOO_STRING_SVTOOLS_HTML_LG_livescript, HTML_SL_JAVASCRIPT }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_LG_starbasic, HTML_SL_STARBASIC }, + { OOO_STRING_SVTOOLS_HTML_LG_javascript, HTML_SL_JAVASCRIPT }, + { OOO_STRING_SVTOOLS_HTML_LG_javascript11, HTML_SL_JAVASCRIPT }, + { OOO_STRING_SVTOOLS_HTML_LG_livescript, HTML_SL_JAVASCRIPT }, + { nullptr, (HTMLScriptLanguage)0 } }; void HTMLParser::ParseScriptOptions( OUString& rLangString, const OUString& rBaseURL, @@ -57,7 +57,7 @@ void HTMLParser::ParseScriptOptions( OUString& rLangString, const OUString& rBas case HTML_O_LANGUAGE: { rLangString = aOption.GetString(); - sal_uInt16 nLang; + HTMLScriptLanguage nLang; if( aOption.GetEnum( nLang, aScriptLangOptEnums ) ) rLang = (HTMLScriptLanguage)nLang; else diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 9df8ceaa796e..4e98c3017dde 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -51,7 +51,7 @@ const sal_Int32 MAX_ENTITY_LEN( 8L ); // Tables to convert option values into strings // <INPUT TYPE=xxx> -static HTMLOptionEnum const aInputTypeOptEnums[] = +static HTMLOptionEnum<HTMLInputType> const aInputTypeOptEnums[] = { { OOO_STRING_SVTOOLS_HTML_IT_text, HTML_IT_TEXT }, { OOO_STRING_SVTOOLS_HTML_IT_password, HTML_IT_PASSWORD }, @@ -65,67 +65,35 @@ static HTMLOptionEnum const aInputTypeOptEnums[] = { OOO_STRING_SVTOOLS_HTML_IT_image, HTML_IT_IMAGE }, { OOO_STRING_SVTOOLS_HTML_IT_reset, HTML_IT_RESET }, { OOO_STRING_SVTOOLS_HTML_IT_button, HTML_IT_BUTTON }, - { nullptr, 0 } + { nullptr, (HTMLInputType)0 } }; // <TABLE FRAME=xxx> -static HTMLOptionEnum const aTableFrameOptEnums[] = +static HTMLOptionEnum<HTMLTableFrame> const aTableFrameOptEnums[] = { - { OOO_STRING_SVTOOLS_HTML_TF_void, HTML_TF_VOID }, - { OOO_STRING_SVTOOLS_HTML_TF_above, HTML_TF_ABOVE }, - { OOO_STRING_SVTOOLS_HTML_TF_below, HTML_TF_BELOW }, - { OOO_STRING_SVTOOLS_HTML_TF_hsides, HTML_TF_HSIDES }, - { OOO_STRING_SVTOOLS_HTML_TF_lhs, HTML_TF_LHS }, - { OOO_STRING_SVTOOLS_HTML_TF_rhs, HTML_TF_RHS }, - { OOO_STRING_SVTOOLS_HTML_TF_vsides, HTML_TF_VSIDES }, - { OOO_STRING_SVTOOLS_HTML_TF_box, HTML_TF_BOX }, - { OOO_STRING_SVTOOLS_HTML_TF_border, HTML_TF_BOX }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_TF_void, HTML_TF_VOID }, + { OOO_STRING_SVTOOLS_HTML_TF_above, HTML_TF_ABOVE }, + { OOO_STRING_SVTOOLS_HTML_TF_below, HTML_TF_BELOW }, + { OOO_STRING_SVTOOLS_HTML_TF_hsides, HTML_TF_HSIDES }, + { OOO_STRING_SVTOOLS_HTML_TF_lhs, HTML_TF_LHS }, + { OOO_STRING_SVTOOLS_HTML_TF_rhs, HTML_TF_RHS }, + { OOO_STRING_SVTOOLS_HTML_TF_vsides, HTML_TF_VSIDES }, + { OOO_STRING_SVTOOLS_HTML_TF_box, HTML_TF_BOX }, + { OOO_STRING_SVTOOLS_HTML_TF_border, HTML_TF_BOX }, + { nullptr, (HTMLTableFrame)0 } }; // <TABLE RULES=xxx> -static HTMLOptionEnum const aTableRulesOptEnums[] = +static HTMLOptionEnum<HTMLTableRules> const aTableRulesOptEnums[] = { - { OOO_STRING_SVTOOLS_HTML_TR_none, HTML_TR_NONE }, - { OOO_STRING_SVTOOLS_HTML_TR_groups, HTML_TR_GROUPS }, - { OOO_STRING_SVTOOLS_HTML_TR_rows, HTML_TR_ROWS }, - { OOO_STRING_SVTOOLS_HTML_TR_cols, HTML_TR_COLS }, - { OOO_STRING_SVTOOLS_HTML_TR_all, HTML_TR_ALL }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_TR_none, HTML_TR_NONE }, + { OOO_STRING_SVTOOLS_HTML_TR_groups, HTML_TR_GROUPS }, + { OOO_STRING_SVTOOLS_HTML_TR_rows, HTML_TR_ROWS }, + { OOO_STRING_SVTOOLS_HTML_TR_cols, HTML_TR_COLS }, + { OOO_STRING_SVTOOLS_HTML_TR_all, HTML_TR_ALL }, + { nullptr, (HTMLTableRules)0 } }; -sal_uInt16 HTMLOption::GetEnum( const HTMLOptionEnum *pOptEnums, sal_uInt16 nDflt ) const -{ - sal_uInt16 nValue = nDflt; - - while( pOptEnums->pName ) - if( aValue.equalsIgnoreAsciiCaseAscii( pOptEnums->pName ) ) - break; - else - pOptEnums++; - - if( pOptEnums->pName ) - nValue = pOptEnums->nValue; - - return nValue; -} - -bool HTMLOption::GetEnum( sal_uInt16 &rEnum, const HTMLOptionEnum *pOptEnums ) const -{ - while( pOptEnums->pName ) - { - if( aValue.equalsIgnoreAsciiCaseAscii( pOptEnums->pName ) ) - break; - else - pOptEnums++; - } - - const sal_Char *pName = pOptEnums->pName; - if( pName ) - rEnum = pOptEnums->nValue; - - return (pName != nullptr); -} HTMLOption::HTMLOption( sal_uInt16 nTok, const OUString& rToken, const OUString& rValue ) @@ -1876,7 +1844,7 @@ enum eHtmlMetas { }; // <META NAME=xxx> -static HTMLOptionEnum const aHTMLMetaNameTable[] = +static HTMLOptionEnum<eHtmlMetas> const aHTMLMetaNameTable[] = { { OOO_STRING_SVTOOLS_HTML_META_author, HTML_META_AUTHOR }, { OOO_STRING_SVTOOLS_HTML_META_changed, HTML_META_CHANGED }, @@ -1890,7 +1858,7 @@ static HTMLOptionEnum const aHTMLMetaNameTable[] = { OOO_STRING_SVTOOLS_HTML_META_refresh, HTML_META_REFRESH }, { OOO_STRING_SVTOOLS_HTML_META_sdendnote, HTML_META_SDENDNOTE }, { OOO_STRING_SVTOOLS_HTML_META_sdfootnote, HTML_META_SDFOOTNOTE }, - { nullptr, 0 } + { nullptr, (eHtmlMetas)0 } }; @@ -1905,7 +1873,7 @@ bool HTMLParser::ParseMetaOptionsImpl( rtl_TextEncoding& o_rEnc ) { OUString aName, aContent; - sal_uInt16 nAction = HTML_META_NONE; + eHtmlMetas nAction = HTML_META_NONE; bool bHTTPEquiv = false, bChanged = false; for ( size_t i = aOptions.size(); i; ) diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx index 664c8ce80b33..a8c21eaccd4f 100644 --- a/sw/source/filter/html/htmldrawreader.cxx +++ b/sw/source/filter/html/htmldrawreader.cxx @@ -55,19 +55,19 @@ using namespace css; -static HTMLOptionEnum aHTMLMarqBehaviorTable[] = +static HTMLOptionEnum<SdrTextAniKind> aHTMLMarqBehaviorTable[] = { - { OOO_STRING_SVTOOLS_HTML_BEHAV_scroll, SDRTEXTANI_SCROLL }, - { OOO_STRING_SVTOOLS_HTML_BEHAV_alternate, SDRTEXTANI_ALTERNATE }, - { OOO_STRING_SVTOOLS_HTML_BEHAV_slide, SDRTEXTANI_SLIDE }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_BEHAV_scroll, SDRTEXTANI_SCROLL }, + { OOO_STRING_SVTOOLS_HTML_BEHAV_alternate, SDRTEXTANI_ALTERNATE }, + { OOO_STRING_SVTOOLS_HTML_BEHAV_slide, SDRTEXTANI_SLIDE }, + { nullptr, (SdrTextAniKind)0 } }; -static HTMLOptionEnum aHTMLMarqDirectionTable[] = +static HTMLOptionEnum<SdrTextAniDirection> aHTMLMarqDirectionTable[] = { - { OOO_STRING_SVTOOLS_HTML_AL_left, (sal_uInt16)SdrTextAniDirection::Left }, - { OOO_STRING_SVTOOLS_HTML_AL_right, (sal_uInt16)SdrTextAniDirection::Right }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_AL_left, SdrTextAniDirection::Left }, + { OOO_STRING_SVTOOLS_HTML_AL_right, SdrTextAniDirection::Right }, + { nullptr, (SdrTextAniDirection)0 } }; void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj, @@ -281,9 +281,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) break; case HTML_O_BEHAVIOR: - eAniKind = - (SdrTextAniKind)rOption.GetEnum( aHTMLMarqBehaviorTable, - static_cast< sal_uInt16 >(eAniKind) ); + eAniKind = rOption.GetEnum( aHTMLMarqBehaviorTable, eAniKind ); break; case HTML_O_BGCOLOR: @@ -292,9 +290,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) break; case HTML_O_DIRECTION: - eAniDir = - (SdrTextAniDirection)rOption.GetEnum( aHTMLMarqDirectionTable, - static_cast< sal_uInt16 >(eAniDir) ); + eAniDir = rOption.GetEnum( aHTMLMarqDirectionTable, eAniDir ); bDirection = true; break; diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index bdd3961d6bde..2dfdb21e7c89 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -43,7 +43,7 @@ struct HTMLNumFormatTableEntry NfIndexTableOffset eFormat; }; -static HTMLOptionEnum aHTMLFieldTypeTable[] = +static HTMLOptionEnum<RES_FIELDS> aHTMLFieldTypeTable[] = { { OOO_STRING_SW_HTML_FT_author, RES_AUTHORFLD }, { OOO_STRING_SW_HTML_FT_sender, RES_EXTUSERFLD }, @@ -54,7 +54,7 @@ static HTMLOptionEnum aHTMLFieldTypeTable[] = { OOO_STRING_SW_HTML_FT_docinfo, RES_DOCINFOFLD }, { OOO_STRING_SW_HTML_FT_docstat, RES_DOCSTATFLD }, { OOO_STRING_SW_HTML_FT_filename,RES_FILENAMEFLD }, - { nullptr, 0 } + { nullptr, (RES_FIELDS)0 } }; static HTMLNumFormatTableEntry aHTMLDateFieldFormatTable[] = @@ -87,54 +87,54 @@ static HTMLNumFormatTableEntry aHTMLTimeFieldFormatTable[] = { nullptr, NF_NUMERIC_START } }; -static HTMLOptionEnum aHTMLPageNumFieldFormatTable[] = +static HTMLOptionEnum<SvxNumType> aHTMLPageNumFieldFormatTable[] = { { OOO_STRING_SW_HTML_FF_uletter, SVX_NUM_CHARS_UPPER_LETTER }, { OOO_STRING_SW_HTML_FF_lletter, SVX_NUM_CHARS_LOWER_LETTER }, - { OOO_STRING_SW_HTML_FF_uroman, SVX_NUM_ROMAN_UPPER }, - { OOO_STRING_SW_HTML_FF_lroman, SVX_NUM_ROMAN_LOWER }, + { OOO_STRING_SW_HTML_FF_uroman, SVX_NUM_ROMAN_UPPER }, + { OOO_STRING_SW_HTML_FF_lroman, SVX_NUM_ROMAN_LOWER }, { OOO_STRING_SW_HTML_FF_arabic, SVX_NUM_ARABIC }, { OOO_STRING_SW_HTML_FF_none, SVX_NUM_NUMBER_NONE }, { OOO_STRING_SW_HTML_FF_char, SVX_NUM_CHAR_SPECIAL }, { OOO_STRING_SW_HTML_FF_page, SVX_NUM_PAGEDESC }, { OOO_STRING_SW_HTML_FF_ulettern, SVX_NUM_CHARS_UPPER_LETTER_N }, { OOO_STRING_SW_HTML_FF_llettern, SVX_NUM_CHARS_LOWER_LETTER_N }, - { nullptr, 0 } + { nullptr, (SvxNumType)0 } }; -static HTMLOptionEnum aHTMLExtUsrFieldSubTable[] = +static HTMLOptionEnum<SwExtUserSubType> aHTMLExtUsrFieldSubTable[] = { - { OOO_STRING_SW_HTML_FS_company, EU_COMPANY }, + { OOO_STRING_SW_HTML_FS_company, EU_COMPANY }, { OOO_STRING_SW_HTML_FS_firstname, EU_FIRSTNAME }, { OOO_STRING_SW_HTML_FS_name, EU_NAME }, { OOO_STRING_SW_HTML_FS_shortcut, EU_SHORTCUT }, { OOO_STRING_SW_HTML_FS_street, EU_STREET }, - { OOO_STRING_SW_HTML_FS_country, EU_COUNTRY }, - { OOO_STRING_SW_HTML_FS_zip, EU_ZIP }, - { OOO_STRING_SW_HTML_FS_city, EU_CITY }, - { OOO_STRING_SW_HTML_FS_title, EU_TITLE }, - { OOO_STRING_SW_HTML_FS_position, EU_POSITION }, - { OOO_STRING_SW_HTML_FS_pphone, EU_PHONE_PRIVATE }, - { OOO_STRING_SW_HTML_FS_cphone, EU_PHONE_COMPANY }, - { OOO_STRING_SW_HTML_FS_fax, EU_FAX }, - { OOO_STRING_SW_HTML_FS_email, EU_EMAIL }, - { OOO_STRING_SW_HTML_FS_state, EU_STATE }, - { nullptr, 0 } + { OOO_STRING_SW_HTML_FS_country, EU_COUNTRY }, + { OOO_STRING_SW_HTML_FS_zip, EU_ZIP }, + { OOO_STRING_SW_HTML_FS_city, EU_CITY }, + { OOO_STRING_SW_HTML_FS_title, EU_TITLE }, + { OOO_STRING_SW_HTML_FS_position, EU_POSITION }, + { OOO_STRING_SW_HTML_FS_pphone, EU_PHONE_PRIVATE }, + { OOO_STRING_SW_HTML_FS_cphone, EU_PHONE_COMPANY }, + { OOO_STRING_SW_HTML_FS_fax, EU_FAX }, + { OOO_STRING_SW_HTML_FS_email, EU_EMAIL }, + { OOO_STRING_SW_HTML_FS_state, EU_STATE }, + { nullptr, (SwExtUserSubType)0 } }; -static HTMLOptionEnum aHTMLAuthorFieldFormatTable[] = +static HTMLOptionEnum<SwAuthorFormat> aHTMLAuthorFieldFormatTable[] = { { OOO_STRING_SW_HTML_FF_name, AF_NAME }, { OOO_STRING_SW_HTML_FF_shortcut, AF_SHORTCUT }, - { nullptr, 0 } + { nullptr, (SwAuthorFormat)0 } }; -static HTMLOptionEnum aHTMLPageNumFieldSubTable[] = +static HTMLOptionEnum<SwPageNumSubType> aHTMLPageNumFieldSubTable[] = { { OOO_STRING_SW_HTML_FS_random, PG_RANDOM }, { OOO_STRING_SW_HTML_FS_next, PG_NEXT }, { OOO_STRING_SW_HTML_FS_prev, PG_PREV }, - { nullptr, 0 } + { nullptr, (SwPageNumSubType)0 } }; // UGLY: these are extensions of nsSwDocInfoSubType (in inc/docufld.hxx) @@ -145,31 +145,31 @@ static HTMLOptionEnum aHTMLPageNumFieldSubTable[] = const SwDocInfoSubType DI_INFO3 = DI_SUBTYPE_END + 3; const SwDocInfoSubType DI_INFO4 = DI_SUBTYPE_END + 4; -static HTMLOptionEnum aHTMLDocInfoFieldSubTable[] = +static HTMLOptionEnum<sal_uInt16> aHTMLDocInfoFieldSubTable[] = { { OOO_STRING_SW_HTML_FS_title, DI_TITEL }, { OOO_STRING_SW_HTML_FS_theme, DI_THEMA }, { OOO_STRING_SW_HTML_FS_keys, DI_KEYS }, - { OOO_STRING_SW_HTML_FS_comment, DI_COMMENT }, - { "INFO1", DI_INFO1 }, - { "INFO2", DI_INFO2 }, - { "INFO3", DI_INFO3 }, - { "INFO4", DI_INFO4 }, - { OOO_STRING_SW_HTML_FS_custom, DI_CUSTOM }, - { OOO_STRING_SW_HTML_FS_create, DI_CREATE }, - { OOO_STRING_SW_HTML_FS_change, DI_CHANGE }, - { nullptr, 0 } + { OOO_STRING_SW_HTML_FS_comment, DI_COMMENT }, + { "INFO1", DI_INFO1 }, + { "INFO2", DI_INFO2 }, + { "INFO3", DI_INFO3 }, + { "INFO4", DI_INFO4 }, + { OOO_STRING_SW_HTML_FS_custom, DI_CUSTOM }, + { OOO_STRING_SW_HTML_FS_create, DI_CREATE }, + { OOO_STRING_SW_HTML_FS_change, DI_CHANGE }, + { nullptr, 0 } }; -static HTMLOptionEnum aHTMLDocInfoFieldFormatTable[] = +static HTMLOptionEnum<sal_uInt16> aHTMLDocInfoFieldFormatTable[] = { - { OOO_STRING_SW_HTML_FF_author, DI_SUB_AUTHOR }, + { OOO_STRING_SW_HTML_FF_author, DI_SUB_AUTHOR }, { OOO_STRING_SW_HTML_FF_time, DI_SUB_TIME }, { OOO_STRING_SW_HTML_FF_date, DI_SUB_DATE }, - { nullptr, 0 } + { nullptr, 0 } }; -static HTMLOptionEnum aHTMLDocStatFieldSubTable[] = +static HTMLOptionEnum<SwDocStatSubType> aHTMLDocStatFieldSubTable[] = { { OOO_STRING_SW_HTML_FS_page, DS_PAGE }, { OOO_STRING_SW_HTML_FS_para, DS_PARA }, @@ -178,25 +178,25 @@ static HTMLOptionEnum aHTMLDocStatFieldSubTable[] = { OOO_STRING_SW_HTML_FS_tbl, DS_TBL }, { OOO_STRING_SW_HTML_FS_grf, DS_GRF }, { OOO_STRING_SW_HTML_FS_ole, DS_OLE }, - { nullptr, 0 } + { nullptr, (SwDocStatSubType)0 } }; -static HTMLOptionEnum aHTMLFileNameFieldFormatTable[] = +static HTMLOptionEnum<SwFileNameFormat> aHTMLFileNameFieldFormatTable[] = { { OOO_STRING_SW_HTML_FF_name, FF_NAME }, { OOO_STRING_SW_HTML_FF_pathname, FF_PATHNAME }, { OOO_STRING_SW_HTML_FF_path, FF_PATH }, { OOO_STRING_SW_HTML_FF_name_noext, FF_NAME_NOEXT }, - { nullptr, 0 } + { nullptr, (SwFileNameFormat)0 } }; SvxNumType SwHTMLParser::GetNumType( const OUString& rStr, SvxNumType nDfltType ) { - const HTMLOptionEnum *pOptEnums = aHTMLPageNumFieldFormatTable; + const HTMLOptionEnum<SvxNumType> *pOptEnums = aHTMLPageNumFieldFormatTable; while( pOptEnums->pName ) { if( rStr.equalsIgnoreAsciiCaseAscii( pOptEnums->pName ) ) - return (SvxNumType)pOptEnums->nValue; + return pOptEnums->nValue; pOptEnums++; } return nDfltType; @@ -206,7 +206,7 @@ void SwHTMLParser::NewField() { bool bKnownType = false, bFixed = false, bHasNumFormat = false, bHasNumValue = false; - sal_uInt16 nType = 0; + RES_FIELDS nType = RES_DBFLD; OUString aValue, aNumFormat, aNumValue, aName; const HTMLOption *pSubOption=nullptr, *pFormatOption=nullptr; @@ -255,8 +255,8 @@ void SwHTMLParser::NewField() // niemend geandert hat und man das Dok erstellt hat. Sonst // wird ein Fixed-Feld daraus gemacht. if( !bFixed && - (RES_EXTUSERFLD == (RES_FIELDS)nType || - RES_AUTHORFLD == (RES_FIELDS)nType) ) + (RES_EXTUSERFLD == nType || + RES_AUTHORFLD == nType) ) { SvtUserOptions aOpt; const OUString& rUser = aOpt.GetFullName(); @@ -284,12 +284,12 @@ void SwHTMLParser::NewField() SwField *pNewField = nullptr; bool bInsOnEndTag = false; - switch( (RES_FIELDS)nType ) + switch( nType ) { case RES_EXTUSERFLD: if( pSubOption ) { - sal_uInt16 nSub; + SwExtUserSubType nSub; sal_uLong nFormat = 0; if( bFixed ) { @@ -303,12 +303,12 @@ void SwHTMLParser::NewField() case RES_AUTHORFLD: { - sal_uInt16 nFormat = AF_NAME; + SwAuthorFormat nFormat = AF_NAME; if( pFormatOption ) pFormatOption->GetEnum( nFormat, aHTMLAuthorFieldFormatTable ); if( bFixed ) { - nFormat |= AF_FIXED; + nFormat = (SwAuthorFormat)((int)nFormat | AF_FIXED); bInsOnEndTag = true; } @@ -402,28 +402,28 @@ void SwHTMLParser::NewField() case RES_PAGENUMBERFLD: if( pSubOption ) { - sal_uInt16 nSub; + SwPageNumSubType nSub; if( pSubOption->GetEnum( nSub, aHTMLPageNumFieldSubTable ) ) { - sal_uInt16 nFormat = SVX_NUM_PAGEDESC; + SvxNumType nFormat = SVX_NUM_PAGEDESC; if( pFormatOption ) pFormatOption->GetEnum( nFormat, aHTMLPageNumFieldFormatTable ); short nOff = 0; - if( (SvxNumType)nFormat!=SVX_NUM_CHAR_SPECIAL && !aValue.isEmpty() ) + if( nFormat!=SVX_NUM_CHAR_SPECIAL && !aValue.isEmpty() ) nOff = (short)aValue.toInt32(); - else if( (SwPageNumSubType)nSub == PG_NEXT ) + else if( nSub == PG_NEXT ) nOff = 1; - else if( (SwPageNumSubType)nSub == PG_PREV ) + else if( nSub == PG_PREV ) nOff = -1; - if( (SvxNumType)nFormat==SVX_NUM_CHAR_SPECIAL && - (SwPageNumSubType)nSub==PG_RANDOM ) + if( nFormat==SVX_NUM_CHAR_SPECIAL && + nSub==PG_RANDOM ) nFormat = SVX_NUM_PAGEDESC; pNewField = new SwPageNumberField(static_cast<SwPageNumberFieldType*>(pType), nSub, nFormat, nOff); - if ((SvxNumType)nFormat == SVX_NUM_CHAR_SPECIAL) + if (nFormat == SVX_NUM_CHAR_SPECIAL) static_cast<SwPageNumberField *>(pNewField)->SetUserString(aValue); } } @@ -482,26 +482,26 @@ void SwHTMLParser::NewField() case RES_DOCSTATFLD: if( pSubOption ) { - sal_uInt16 nSub; + SwDocStatSubType nSub; if( pSubOption->GetEnum( nSub, aHTMLDocStatFieldSubTable ) ) { - sal_uInt16 nFormat = SVX_NUM_ARABIC; + SvxNumType nFormat = SVX_NUM_ARABIC; if( pFormatOption ) pFormatOption->GetEnum( nFormat, aHTMLPageNumFieldFormatTable ); pNewField = new SwDocStatField(static_cast<SwDocStatFieldType*>(pType), nSub, nFormat); - m_bUpdateDocStat |= (DS_PAGE != nFormat); + m_bUpdateDocStat |= (DS_PAGE != nSub); } } break; case RES_FILENAMEFLD: { - sal_uInt16 nFormat = FF_NAME; + SwFileNameFormat nFormat = FF_NAME; if( pFormatOption ) pFormatOption->GetEnum( nFormat, aHTMLFileNameFieldFormatTable ); if( bFixed ) { - nFormat |= FF_FIXED; + nFormat = (SwFileNameFormat)((int)nFormat | FF_FIXED); bInsOnEndTag = true; } diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 8e75a53b4be3..53e479bb6f33 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -85,31 +85,31 @@ using namespace ::com::sun::star::form; const sal_uInt16 TABINDEX_MIN = 0; const sal_uInt16 TABINDEX_MAX = 32767; -static HTMLOptionEnum aHTMLFormMethodTable[] = +static HTMLOptionEnum<FormSubmitMethod> aHTMLFormMethodTable[] = { - { OOO_STRING_SVTOOLS_HTML_METHOD_get, FormSubmitMethod_GET }, + { OOO_STRING_SVTOOLS_HTML_METHOD_get, FormSubmitMethod_GET }, { OOO_STRING_SVTOOLS_HTML_METHOD_post, FormSubmitMethod_POST }, - { nullptr, 0 } + { nullptr, (FormSubmitMethod)0 } }; -static HTMLOptionEnum aHTMLFormEncTypeTable[] = +static HTMLOptionEnum<FormSubmitEncoding> aHTMLFormEncTypeTable[] = { - { OOO_STRING_SVTOOLS_HTML_ET_url, FormSubmitEncoding_URL }, + { OOO_STRING_SVTOOLS_HTML_ET_url, FormSubmitEncoding_URL }, { OOO_STRING_SVTOOLS_HTML_ET_multipart, FormSubmitEncoding_MULTIPART }, { OOO_STRING_SVTOOLS_HTML_ET_text, FormSubmitEncoding_TEXT }, - { nullptr, 0 } + { nullptr, (FormSubmitEncoding)0 } }; enum HTMLWordWrapMode { HTML_WM_OFF, HTML_WM_HARD, HTML_WM_SOFT }; -static HTMLOptionEnum aHTMLTextAreaWrapTable[] = +static HTMLOptionEnum<HTMLWordWrapMode> aHTMLTextAreaWrapTable[] = { - { OOO_STRING_SVTOOLS_HTML_WW_off, HTML_WM_OFF }, - { OOO_STRING_SVTOOLS_HTML_WW_hard, HTML_WM_HARD }, - { OOO_STRING_SVTOOLS_HTML_WW_soft, HTML_WM_SOFT }, - { OOO_STRING_SVTOOLS_HTML_WW_physical,HTML_WM_HARD }, - { OOO_STRING_SVTOOLS_HTML_WW_virtual, HTML_WM_SOFT }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_WW_off, HTML_WM_OFF }, + { OOO_STRING_SVTOOLS_HTML_WW_hard, HTML_WM_HARD }, + { OOO_STRING_SVTOOLS_HTML_WW_soft, HTML_WM_SOFT }, + { OOO_STRING_SVTOOLS_HTML_WW_physical, HTML_WM_HARD }, + { OOO_STRING_SVTOOLS_HTML_WW_virtual, HTML_WM_SOFT }, + { nullptr, (HTMLWordWrapMode)0 } }; HTMLEventType aEventTypeTable[] = @@ -1230,8 +1230,8 @@ void SwHTMLParser::NewForm( bool bAppend ) OUString aAction( m_sBaseURL ); OUString sName, sTarget; - sal_uInt16 nEncType = FormSubmitEncoding_URL; - sal_uInt16 nMethod = FormSubmitMethod_GET; + FormSubmitEncoding nEncType = FormSubmitEncoding_URL; + FormSubmitMethod nMethod = FormSubmitMethod_GET; SvxMacroTableDtor aMacroTable; std::vector<OUString> aUnoMacroTable; std::vector<OUString> aUnoMacroParamTable; @@ -1878,7 +1878,7 @@ void SwHTMLParser::NewTextArea() std::vector<OUString> aUnoMacroTable; std::vector<OUString> aUnoMacroParamTable; sal_uInt16 nRows = 0, nCols = 0; - sal_uInt16 nWrap = HTML_WM_OFF; + HTMLWordWrapMode nWrap = HTML_WM_OFF; bool bDisabled = false; SvKeyValueIterator *pHeaderAttrs = m_pFormImpl->GetHeaderAttrs(); ScriptType eDfltScriptType = GetScriptType( pHeaderAttrs ); diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 008b8b8a8e18..908cc30ccde7 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -71,14 +71,14 @@ using namespace ::com::sun::star; -HTMLOptionEnum aHTMLImgHAlignTable[] = +HTMLOptionEnum<sal_Int16> aHTMLImgHAlignTable[] = { { OOO_STRING_SVTOOLS_HTML_AL_left, text::HoriOrientation::LEFT }, { OOO_STRING_SVTOOLS_HTML_AL_right, text::HoriOrientation::RIGHT }, - { nullptr, 0 } + { nullptr, 0 } }; -HTMLOptionEnum aHTMLImgVAlignTable[] = +HTMLOptionEnum<sal_Int16> aHTMLImgVAlignTable[] = { { OOO_STRING_SVTOOLS_HTML_VA_top, text::VertOrientation::LINE_TOP }, { OOO_STRING_SVTOOLS_HTML_VA_texttop, text::VertOrientation::CHAR_TOP }, @@ -88,7 +88,7 @@ HTMLOptionEnum aHTMLImgVAlignTable[] = { OOO_STRING_SVTOOLS_HTML_VA_bottom, text::VertOrientation::TOP }, { OOO_STRING_SVTOOLS_HTML_VA_baseline, text::VertOrientation::TOP }, { OOO_STRING_SVTOOLS_HTML_VA_absbottom, text::VertOrientation::LINE_BOTTOM }, - { nullptr, 0 } + { nullptr, 0 } }; ImageMap *SwHTMLParser::FindImageMap( const OUString& rName ) const diff --git a/sw/source/filter/html/htmlnumreader.cxx b/sw/source/filter/html/htmlnumreader.cxx index 1f088a6e4fc2..6704369dc64f 100644 --- a/sw/source/filter/html/htmlnumreader.cxx +++ b/sw/source/filter/html/htmlnumreader.cxx @@ -43,12 +43,12 @@ using namespace css; // <UL TYPE=...> -static HTMLOptionEnum aHTMLULTypeTable[] = +static HTMLOptionEnum<sal_Unicode> aHTMLULTypeTable[] = { - { OOO_STRING_SVTOOLS_HTML_ULTYPE_disc, HTML_BULLETCHAR_DISC }, - { OOO_STRING_SVTOOLS_HTML_ULTYPE_circle, HTML_BULLETCHAR_CIRCLE }, - { OOO_STRING_SVTOOLS_HTML_ULTYPE_square, HTML_BULLETCHAR_SQUARE }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_ULTYPE_disc, HTML_BULLETCHAR_DISC }, + { OOO_STRING_SVTOOLS_HTML_ULTYPE_circle, HTML_BULLETCHAR_CIRCLE }, + { OOO_STRING_SVTOOLS_HTML_ULTYPE_square, HTML_BULLETCHAR_SQUARE }, + { nullptr, 0 } }; @@ -157,7 +157,7 @@ void SwHTMLParser::NewNumBulList( int nToken ) break; case HTML_UNORDERLIST_ON: - aNumFormat.SetBulletChar( (sal_Unicode)rOption.GetEnum( + aNumFormat.SetBulletChar( rOption.GetEnum( aHTMLULTypeTable,aNumFormat.GetBulletChar() ) ); bChangeNumFormat = true; break; @@ -205,9 +205,7 @@ void SwHTMLParser::NewNumBulList( int nToken ) nHeight = (sal_uInt16)rOption.GetNumber(); break; case HTML_O_ALIGN: - eVertOri = - (sal_Int16)rOption.GetEnum( aHTMLImgVAlignTable, - static_cast< sal_uInt16 >(eVertOri) ); + eVertOri = rOption.GetEnum( aHTMLImgVAlignTable, eVertOri ); break; } } diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 04dbd80995c1..4b6f88d7a925 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -75,8 +75,7 @@ void SwHTMLParser::NewDivision( int nToken ) break; case HTML_O_ALIGN: if( HTML_DIVISION_ON==nToken ) - eAdjust = (SvxAdjust)rOption.GetEnum( aHTMLPAlignTable, - static_cast< sal_uInt16 >(eAdjust) ); + eAdjust = rOption.GetEnum( aHTMLPAlignTable, eAdjust ); break; case HTML_O_STYLE: aStyle = rOption.GetString(); diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 9d7d9a8d2220..f7a3395e8537 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -63,12 +63,12 @@ using ::editeng::SvxBorderLine; using namespace ::com::sun::star; -static HTMLOptionEnum aHTMLTableVAlignTable[] = +static HTMLOptionEnum<sal_Int16> aHTMLTableVAlignTable[] = { - { OOO_STRING_SVTOOLS_HTML_VA_top, text::VertOrientation::NONE }, - { OOO_STRING_SVTOOLS_HTML_VA_middle, text::VertOrientation::CENTER }, - { OOO_STRING_SVTOOLS_HTML_VA_bottom, text::VertOrientation::BOTTOM }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_VA_top, text::VertOrientation::NONE }, + { OOO_STRING_SVTOOLS_HTML_VA_middle, text::VertOrientation::CENTER }, + { OOO_STRING_SVTOOLS_HTML_VA_bottom, text::VertOrientation::BOTTOM }, + { nullptr, 0 } }; // table tags options @@ -3043,12 +3043,10 @@ CellSaveStruct::CellSaveStruct( SwHTMLParser& rParser, HTMLTable *pCurTable, m_nRowSpan = (sal_uInt16)rOption.GetNumber(); break; case HTML_O_ALIGN: - m_eAdjust = (SvxAdjust)rOption.GetEnum( - aHTMLPAlignTable, static_cast< sal_uInt16 >(m_eAdjust) ); + m_eAdjust = rOption.GetEnum( aHTMLPAlignTable, m_eAdjust ); break; case HTML_O_VALIGN: - m_eVertOri = rOption.GetEnum( - aHTMLTableVAlignTable, m_eVertOri ); + m_eVertOri = rOption.GetEnum( aHTMLTableVAlignTable, m_eVertOri ); break; case HTML_O_WIDTH: m_nWidth = (sal_uInt16)rOption.GetNumber(); // Just for Netscape @@ -3761,9 +3759,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, { if( HTML_O_ALIGN==rOption.GetToken() ) { - SvxAdjust eAdjust = - (SvxAdjust)rOption.GetEnum( - aHTMLPAlignTable, SVX_ADJUST_END ); + SvxAdjust eAdjust = rOption.GetEnum( aHTMLPAlignTable, SVX_ADJUST_END ); bNeedsSection = SVX_ADJUST_LEFT == eAdjust || SVX_ADJUST_RIGHT == eAdjust; break; @@ -4050,12 +4046,10 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, bool bReadOptions, aId = rOption.GetString(); break; case HTML_O_ALIGN: - eAdjust = (SvxAdjust)rOption.GetEnum( - aHTMLPAlignTable, static_cast< sal_uInt16 >(eAdjust) ); + eAdjust = rOption.GetEnum( aHTMLPAlignTable, eAdjust ); break; case HTML_O_VALIGN: - eVertOri = rOption.GetEnum( - aHTMLTableVAlignTable, eVertOri ); + eVertOri = rOption.GetEnum( aHTMLTableVAlignTable, eVertOri ); break; case HTML_O_BGCOLOR: // Ignore empty BGCOLOR on <TABLE>, <TR> and <TD>/>TH> like Netscape @@ -4248,8 +4242,7 @@ void SwHTMLParser::BuildTableSection( HTMLTable *pCurTable, break; case HTML_O_ALIGN: pSaveStruct->eAdjust = - (SvxAdjust)rOption.GetEnum( aHTMLPAlignTable, - static_cast< sal_uInt16 >(pSaveStruct->eAdjust) ); + rOption.GetEnum( aHTMLPAlignTable, pSaveStruct->eAdjust ); break; case HTML_O_VALIGN: pSaveStruct->eVertOri = @@ -4442,8 +4435,7 @@ void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable, break; case HTML_O_ALIGN: pSaveStruct->eColGrpAdjust = - (SvxAdjust)rOption.GetEnum( aHTMLPAlignTable, - static_cast< sal_uInt16 >(pSaveStruct->eColGrpAdjust) ); + rOption.GetEnum( aHTMLPAlignTable, pSaveStruct->eColGrpAdjust ); break; case HTML_O_VALIGN: pSaveStruct->eColGrpVertOri = @@ -4523,14 +4515,11 @@ void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable, (rOption.GetString().indexOf('*') != -1); break; case HTML_O_ALIGN: - eColAdjust = - (SvxAdjust)rOption.GetEnum( aHTMLPAlignTable, - static_cast< sal_uInt16 >(eColAdjust) ); + eColAdjust = rOption.GetEnum( aHTMLPAlignTable, eColAdjust ); break; case HTML_O_VALIGN: eColVertOri = - rOption.GetEnum( aHTMLTableVAlignTable, - eColVertOri ); + rOption.GetEnum( aHTMLTableVAlignTable, eColVertOri ); break; } } @@ -4892,10 +4881,8 @@ HTMLTableOptions::HTMLTableOptions( const HTMLOptions& rOptions, break; case HTML_O_ALIGN: { - sal_uInt16 nAdjust = static_cast< sal_uInt16 >(eAdjust); - if( rOption.GetEnum( nAdjust, aHTMLPAlignTable ) ) + if( rOption.GetEnum( eAdjust, aHTMLPAlignTable ) ) { - eAdjust = (SvxAdjust)nAdjust; bTableAdjust = true; } } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index b3c6d72bf139..95fb0b6163a4 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -126,24 +126,24 @@ using editeng::SvxBorderLine; using namespace ::com::sun::star; // <P ALIGN=xxx>, <Hn ALIGN=xxx>, <TD ALIGN=xxx> usw. -HTMLOptionEnum aHTMLPAlignTable[] = +HTMLOptionEnum<SvxAdjust> aHTMLPAlignTable[] = { - { OOO_STRING_SVTOOLS_HTML_AL_left, SVX_ADJUST_LEFT }, - { OOO_STRING_SVTOOLS_HTML_AL_center, SVX_ADJUST_CENTER }, - { OOO_STRING_SVTOOLS_HTML_AL_middle, SVX_ADJUST_CENTER }, // Netscape - { OOO_STRING_SVTOOLS_HTML_AL_right, SVX_ADJUST_RIGHT }, - { OOO_STRING_SVTOOLS_HTML_AL_justify, SVX_ADJUST_BLOCK }, - { OOO_STRING_SVTOOLS_HTML_AL_char, SVX_ADJUST_LEFT }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_AL_left, SVX_ADJUST_LEFT }, + { OOO_STRING_SVTOOLS_HTML_AL_center, SVX_ADJUST_CENTER }, + { OOO_STRING_SVTOOLS_HTML_AL_middle, SVX_ADJUST_CENTER }, // Netscape + { OOO_STRING_SVTOOLS_HTML_AL_right, SVX_ADJUST_RIGHT }, + { OOO_STRING_SVTOOLS_HTML_AL_justify, SVX_ADJUST_BLOCK }, + { OOO_STRING_SVTOOLS_HTML_AL_char, SVX_ADJUST_LEFT }, + { nullptr, (SvxAdjust)0 } }; // <SPACER TYPE=...> -static HTMLOptionEnum aHTMLSpacerTypeTable[] = +static HTMLOptionEnum<sal_uInt16> aHTMLSpacerTypeTable[] = { - { OOO_STRING_SVTOOLS_HTML_SPTYPE_block, HTML_SPTYPE_BLOCK }, - { OOO_STRING_SVTOOLS_HTML_SPTYPE_horizontal, HTML_SPTYPE_HORI }, - { OOO_STRING_SVTOOLS_HTML_SPTYPE_vertical, HTML_SPTYPE_VERT }, - { nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_SPTYPE_block, HTML_SPTYPE_BLOCK }, + { OOO_STRING_SVTOOLS_HTML_SPTYPE_horizontal, HTML_SPTYPE_HORI }, + { OOO_STRING_SVTOOLS_HTML_SPTYPE_vertical, HTML_SPTYPE_VERT }, + { nullptr, 0 } }; HTMLReader::HTMLReader() @@ -3866,7 +3866,7 @@ void SwHTMLParser::NewPara() aId = rOption.GetString(); break; case HTML_O_ALIGN: - m_eParaAdjust = (SvxAdjust)rOption.GetEnum( aHTMLPAlignTable, static_cast< sal_uInt16 >(m_eParaAdjust) ); + m_eParaAdjust = rOption.GetEnum( aHTMLPAlignTable, m_eParaAdjust ); break; case HTML_O_STYLE: aStyle = rOption.GetString(); @@ -3985,7 +3985,7 @@ void SwHTMLParser::NewHeading( int nToken ) aId = rOption.GetString(); break; case HTML_O_ALIGN: - m_eParaAdjust = (SvxAdjust)rOption.GetEnum( aHTMLPAlignTable, static_cast< sal_uInt16 >(m_eParaAdjust) ); + m_eParaAdjust = rOption.GetEnum( aHTMLPAlignTable, m_eParaAdjust ); break; case HTML_O_STYLE: aStyle = rOption.GetString(); @@ -5214,8 +5214,7 @@ void SwHTMLParser::InsertHorzRule() } break; case HTML_O_ALIGN: - eAdjust = - (SvxAdjust)rOption.GetEnum( aHTMLPAlignTable, static_cast< sal_uInt16 >(eAdjust) ); + eAdjust = rOption.GetEnum( aHTMLPAlignTable, eAdjust ); break; case HTML_O_NOSHADE: bNoShade = true; diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 0ebe99f026cf..4dfbd786622c 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -61,9 +61,9 @@ struct ImplSVEvent; #define HTML_DFLT_IMG_HEIGHT (MM50*2) // ein par Sachen, die man oefter mal braucht -extern HTMLOptionEnum aHTMLPAlignTable[]; -extern HTMLOptionEnum aHTMLImgHAlignTable[]; -extern HTMLOptionEnum aHTMLImgVAlignTable[]; +extern HTMLOptionEnum<SvxAdjust> aHTMLPAlignTable[]; +extern HTMLOptionEnum<sal_Int16> aHTMLImgHAlignTable[]; +extern HTMLOptionEnum<sal_Int16> aHTMLImgVAlignTable[]; // der Attribut Stack: |