diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-02-20 04:20:51 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-02-20 09:48:40 +0100 |
commit | c4950731860058a6a97f080cf581f27c4a34890c (patch) | |
tree | 57419701703a3dc6303b993fcaf276537d111125 | |
parent | 31d435bd576b1877bbf32749fc4bf943fe6a1ea8 (diff) |
Add list-style-type support to html parser
Conflicts:
sw/source/filter/html/svxcss1.cxx
sw/source/filter/html/svxcss1.hxx
Change-Id: Ibd7978b12a3c5024c55571b165b82c6abe7a8925
-rw-r--r-- | sw/source/filter/html/css1kywd.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/html/css1kywd.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/htmlnumreader.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/html/svxcss1.cxx | 52 | ||||
-rw-r--r-- | sw/source/filter/html/svxcss1.hxx | 5 |
5 files changed, 69 insertions, 1 deletions
diff --git a/sw/source/filter/html/css1kywd.cxx b/sw/source/filter/html/css1kywd.cxx index 6088d4293240..7f8cc83da409 100644 --- a/sw/source/filter/html/css1kywd.cxx +++ b/sw/source/filter/html/css1kywd.cxx @@ -144,6 +144,7 @@ const sal_Char* sCSS1_PV_justify = "justify"; const sal_Char* sCSS1_P_text_indent = "text-indent"; const sal_Char* sCSS1_P_line_height = "line-height"; +const sal_Char* sCSS1_P_list_style_type = "list-style-type"; // Strings for box properties diff --git a/sw/source/filter/html/css1kywd.hxx b/sw/source/filter/html/css1kywd.hxx index 9522cd7edcfd..49e41a28cadd 100644 --- a/sw/source/filter/html/css1kywd.hxx +++ b/sw/source/filter/html/css1kywd.hxx @@ -147,6 +147,8 @@ extern const sal_Char* sCSS1_P_text_indent; extern const sal_Char* sCSS1_P_line_height; +extern const sal_Char* sCSS1_P_list_style_type; + // Strings for box properties extern const sal_Char* sCSS1_P_margin_left; diff --git a/sw/source/filter/html/htmlnumreader.cxx b/sw/source/filter/html/htmlnumreader.cxx index dc1d49b846f1..621a826d49d6 100644 --- a/sw/source/filter/html/htmlnumreader.cxx +++ b/sw/source/filter/html/htmlnumreader.cxx @@ -294,6 +294,16 @@ void SwHTMLParser::NewNumBulList( int nToken ) aNumFormat.SetFirstLineOffset( nTextIndent ); bChangeNumFormat = true; } + if( aPropInfo.m_bNumbering ) + { + aNumFormat.SetNumberingType(aPropInfo.m_nNumberingType); + bChangeNumFormat = true; + } + if( aPropInfo.m_bBullet ) + { + aNumFormat.SetBulletChar( (sal_Unicode)aPropInfo.m_cBulletChar ); + bChangeNumFormat = true; + } } aPropInfo.bLeftMargin = aPropInfo.bTextIndent = false; if( !aPropInfo.bRightMargin ) diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 3f5ec0c27726..d2a1004a82cc 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -52,6 +52,7 @@ #include "css1kywd.hxx" #include "svxcss1.hxx" +#include "htmlnum.hxx" #include <memory> #include <utility> @@ -215,7 +216,25 @@ static CSS1PropertyEnum const aPageBreakTable[] = { 0, 0 } }; -// /Feature: PrintExt +static CSS1PropertyEnum const aNumberStyleTable[] = +{ + { "decimal", SVX_NUM_ARABIC }, + { "lower-alpha", SVX_NUM_CHARS_LOWER_LETTER }, + { "lower-latin", SVX_NUM_CHARS_LOWER_LETTER }, + { "lower-roman", SVX_NUM_ROMAN_LOWER }, + { "upper-alpha", SVX_NUM_CHARS_UPPER_LETTER }, + { "upper-latin", SVX_NUM_CHARS_UPPER_LETTER }, + { "upper-roman", SVX_NUM_ROMAN_UPPER }, + { nullptr, 0 } +}; + +static CSS1PropertyEnum const aBulletStyleTable[] = +{ + { "circle", HTML_BULLETCHAR_CIRCLE }, + { "disc", HTML_BULLETCHAR_DISC }, + { "square", HTML_BULLETCHAR_SQUARE }, + { nullptr, 0 } +}; static sal_uInt16 const aBorderWidths[] = { @@ -403,6 +422,7 @@ void SvxCSS1PropertyInfo::Clear() aId.clear(); bTopMargin = bBottomMargin = false; bLeftMargin = bRightMargin = bTextIndent = false; + m_bNumbering = m_bBullet = false; nLeftMargin = nRightMargin = 0; eFloat = SVX_ADJUST_END; @@ -412,6 +432,9 @@ void SvxCSS1PropertyInfo::Clear() nColumnCount = 0; + m_nNumberingType = 0; + m_cBulletChar = ' '; + nLeft = nTop = nWidth = nHeight = 0; eLeftType = eTopType = eWidthType = eHeightType = SVX_CSS1_LTYPE_NONE; @@ -1690,6 +1713,32 @@ static void ParseCSS1_line_height( const CSS1Expression *pExpr, } +static void ParseCSS1_list_style_type( const CSS1Expression *pExpr, + SfxItemSet & /*rItemSet*/, + SvxCSS1PropertyInfo& rPropInfo, + const SvxCSS1Parser& /*rParser*/ ) +{ + OSL_ENSURE( pExpr, "no expression" ); + + if( pExpr->GetType() == CSS1_IDENT ) + { + const OUString& rValue = pExpr->GetString(); + + // values are context-dependent, so fill both + sal_uInt16 nEnum; + if( SvxCSS1Parser::GetEnum( aNumberStyleTable, rValue, nEnum ) ) + { + rPropInfo.m_bNumbering = true; + rPropInfo.m_nNumberingType = nEnum; + } + if( SvxCSS1Parser::GetEnum( aBulletStyleTable, rValue, nEnum ) ) + { + rPropInfo.m_bBullet = true; + rPropInfo.m_cBulletChar = nEnum; + } + } +} + static void ParseCSS1_font( const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo& rPropInfo, @@ -3102,6 +3151,7 @@ static CSS1PropEntry aCSS1PropFnTab[] = CSS1_PROP_ENTRY(font_weight), CSS1_PROP_ENTRY(letter_spacing), CSS1_PROP_ENTRY(line_height), + CSS1_PROP_ENTRY(list_style_type), CSS1_PROP_ENTRY(font), CSS1_PROP_ENTRY(text_align), CSS1_PROP_ENTRY(text_decoration), diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx index 8b4099003cf8..bfb9503342f6 100644 --- a/sw/source/filter/html/svxcss1.hxx +++ b/sw/source/filter/html/svxcss1.hxx @@ -107,6 +107,8 @@ public: bool bLeftMargin : 1; bool bRightMargin : 1; bool bTextIndent : 1; + bool m_bNumbering : 1; + bool m_bBullet : 1; SvxAdjust eFloat; @@ -119,6 +121,9 @@ public: sal_uInt16 nColumnCount; + sal_uInt16 m_nNumberingType; + sal_Unicode m_cBulletChar; + long nLeft, nTop; long nWidth, nHeight; long nLeftMargin, nRightMargin; |