diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-13 20:23:36 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-13 20:31:29 +0200 |
commit | 044ec0fc7408b01087029c7057185abda71fb8ff (patch) | |
tree | 5d760aec72fd50de9d53fdb63146a28622f5f99f /writerfilter | |
parent | 4fa8282816cb39692678e9da6b6693e821a3039b (diff) |
Use constants for ST_HighlightColor values
Change-Id: I230feea7ebf3138e6b1862401373216a25c34309
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/inc/dmapper/DomainMapper.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 42 | ||||
-rw-r--r-- | writerfilter/source/ooxml/model.xml | 34 |
3 files changed, 39 insertions, 39 deletions
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx index 054f69b54627..ea743be152e7 100644 --- a/writerfilter/inc/dmapper/DomainMapper.hxx +++ b/writerfilter/inc/dmapper/DomainMapper.hxx @@ -163,7 +163,7 @@ private: void handleUnderlineType(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext); void handleParaJustification(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext, const bool bExchangeLeftRight); - bool getColorFromIndex(const sal_Int32 nIndex, sal_Int32 &nColor); + bool getColorFromId(const Id, sal_Int32 &nColor); sal_Int16 getEmphasisValue(const sal_Int32 nIntValue); OUString getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix = true); com::sun::star::style::TabAlign getTabAlignFromValue(const sal_Int32 nIntValue); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 1586d1d5852e..b7aec84bf6b6 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1412,7 +1412,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) case NS_ooxml::LN_EG_RPrBase_highlight: { sal_Int32 nColor = 0; - if( (mbIsHighlightSet = getColorFromIndex(nIntValue, nColor)) ) + if( (mbIsHighlightSet = getColorFromId(nIntValue, nColor)) ) rContext->Insert(PROP_CHAR_BACK_COLOR, uno::makeAny( nColor )); else if (mnBackgroundColor) rContext->Insert(PROP_CHAR_BACK_COLOR, uno::makeAny( mnBackgroundColor )); @@ -3208,30 +3208,30 @@ void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::bo m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "jc", aStringValue); } -bool DomainMapper::getColorFromIndex(const sal_Int32 nIndex, sal_Int32 &nColor) +bool DomainMapper::getColorFromId(const Id nId, sal_Int32 &nColor) { nColor = 0; - if ((nIndex < 1) || (nIndex > 16)) + if ((nId < NS_ooxml::LN_Value_ST_HighlightColor_black) || (nId > NS_ooxml::LN_Value_ST_HighlightColor_lightGray)) return false; - switch (nIndex) - { - case 1: nColor=0x000000; break; //black - case 2: nColor=0x0000ff; break; //blue - case 3: nColor=0x00ffff; break; //cyan - case 4: nColor=0x00ff00; break; //green - case 5: nColor=0xff00ff; break; //magenta - case 6: nColor=0xff0000; break; //red - case 7: nColor=0xffff00; break; //yellow - case 8: nColor=0xffffff; break; //white - case 9: nColor=0x000080; break;//dark blue - case 10: nColor=0x008080; break; //dark cyan - case 11: nColor=0x008000; break; //dark green - case 12: nColor=0x800080; break; //dark magenta - case 13: nColor=0x800000; break; //dark red - case 14: nColor=0x808000; break; //dark yellow - case 15: nColor=0x808080; break; //dark gray - case 16: nColor=0xC0C0C0; break; //light gray + switch (nId) + { + case NS_ooxml::LN_Value_ST_HighlightColor_black: nColor=0x000000; break; + case NS_ooxml::LN_Value_ST_HighlightColor_blue: nColor=0x0000ff; break; + case NS_ooxml::LN_Value_ST_HighlightColor_cyan: nColor=0x00ffff; break; + case NS_ooxml::LN_Value_ST_HighlightColor_green: nColor=0x00ff00; break; + case NS_ooxml::LN_Value_ST_HighlightColor_magenta: nColor=0xff00ff; break; + case NS_ooxml::LN_Value_ST_HighlightColor_red: nColor=0xff0000; break; + case NS_ooxml::LN_Value_ST_HighlightColor_yellow: nColor=0xffff00; break; + case NS_ooxml::LN_Value_ST_HighlightColor_white: nColor=0xffffff; break; + case NS_ooxml::LN_Value_ST_HighlightColor_darkBlue: nColor=0x000080; break; + case NS_ooxml::LN_Value_ST_HighlightColor_darkCyan: nColor=0x008080; break; + case NS_ooxml::LN_Value_ST_HighlightColor_darkGreen: nColor=0x008000; break; + case NS_ooxml::LN_Value_ST_HighlightColor_darkMagenta: nColor=0x800080; break; + case NS_ooxml::LN_Value_ST_HighlightColor_darkRed: nColor=0x800000; break; + case NS_ooxml::LN_Value_ST_HighlightColor_darkYellow: nColor=0x808000; break; + case NS_ooxml::LN_Value_ST_HighlightColor_darkGray: nColor=0x808080; break; + case NS_ooxml::LN_Value_ST_HighlightColor_lightGray: nColor=0xC0C0C0; break; default: return false; } diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 61bd8e4281b4..328964badf81 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -16640,23 +16640,23 @@ <action name="start" action="setDefaultIntegerValue"/> </resource> <resource name="ST_HighlightColor" resource="List"> - <value tokenid="1">black</value> - <value tokenid="2">blue</value> - <value tokenid="3">cyan</value> - <value tokenid="4">green</value> - <value tokenid="5">magenta</value> - <value tokenid="6">red</value> - <value tokenid="7">yellow</value> - <value tokenid="8">white</value> - <value tokenid="9">darkBlue</value> - <value tokenid="10">darkCyan</value> - <value tokenid="11">darkGreen</value> - <value tokenid="12">darkMagenta</value> - <value tokenid="13">darkRed</value> - <value tokenid="14">darkYellow</value> - <value tokenid="15">darkGray</value> - <value tokenid="16">lightGray</value> - <value tokenid="0">none</value> + <value tokenid="ooxml:Value_ST_HighlightColor_black">black</value> + <value tokenid="ooxml:Value_ST_HighlightColor_blue">blue</value> + <value tokenid="ooxml:Value_ST_HighlightColor_cyan">cyan</value> + <value tokenid="ooxml:Value_ST_HighlightColor_green">green</value> + <value tokenid="ooxml:Value_ST_HighlightColor_magenta">magenta</value> + <value tokenid="ooxml:Value_ST_HighlightColor_red">red</value> + <value tokenid="ooxml:Value_ST_HighlightColor_yellow">yellow</value> + <value tokenid="ooxml:Value_ST_HighlightColor_white">white</value> + <value tokenid="ooxml:Value_ST_HighlightColor_darkBlue">darkBlue</value> + <value tokenid="ooxml:Value_ST_HighlightColor_darkCyan">darkCyan</value> + <value tokenid="ooxml:Value_ST_HighlightColor_darkGreen">darkGreen</value> + <value tokenid="ooxml:Value_ST_HighlightColor_darkMagenta">darkMagenta</value> + <value tokenid="ooxml:Value_ST_HighlightColor_darkRed">darkRed</value> + <value tokenid="ooxml:Value_ST_HighlightColor_darkYellow">darkYellow</value> + <value tokenid="ooxml:Value_ST_HighlightColor_darkGray">darkGray</value> + <value tokenid="ooxml:Value_ST_HighlightColor_lightGray">lightGray</value> + <value tokenid="ooxml:Value_ST_HighlightColor_none">none</value> </resource> <resource name="CT_Highlight" resource="Value"> <attribute name="val" tokenid="ooxml:CT_Highlight_val" action="setValue"/> |