[Libreoffice-commits] core.git: writerfilter/inc writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Sun Sep 14 13:01:21 PDT 2014
writerfilter/inc/dmapper/DomainMapper.hxx | 2
writerfilter/source/dmapper/DomainMapper.cxx | 83 +++++++++++++++++--------
writerfilter/source/ooxml/model.xml | 36 +++++-----
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 42 ++++++------
4 files changed, 99 insertions(+), 64 deletions(-)
New commits:
commit aa3696b1ac6c66865d24300e92eed57fff8efbef
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sun Sep 14 21:47:35 2014 +0200
Use constants for ST_Underline values
The integers were a leftover from doctok's Kul enumeration.
Change-Id: I71ee4add743af9ae5b5dee877536c09ca48b854c
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx
index ea743be..6c44d02 100644
--- a/writerfilter/inc/dmapper/DomainMapper.hxx
+++ b/writerfilter/inc/dmapper/DomainMapper.hxx
@@ -161,7 +161,7 @@ private:
// Table
virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) SAL_OVERRIDE;
- void handleUnderlineType(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext);
+ void handleUnderlineType(const Id nId, const ::boost::shared_ptr<PropertyMap> pContext);
void handleParaJustification(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext, const bool bExchangeLeftRight);
bool getColorFromId(const Id, sal_Int32 &nColor);
sal_Int16 getEmphasisValue(const sal_Int32 nIntValue);
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index b7aec84..b0d4f82 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3145,33 +3145,68 @@ void DomainMapper::lcl_info(const std::string & /*info_*/)
{
}
-void DomainMapper::handleUnderlineType(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext)
+void DomainMapper::handleUnderlineType(const Id nId, const ::boost::shared_ptr<PropertyMap> pContext)
{
- sal_Int16 eUnderline = awt::FontUnderline::NONE;
+ sal_Int16 nUnderline = awt::FontUnderline::NONE;
- switch(nIntValue)
+ switch (nId)
{
- case 0: eUnderline = awt::FontUnderline::NONE; break;
- case 2: pContext->Insert(PROP_CHAR_WORD_MODE, uno::makeAny( true ) ); // TODO: how to get rid of it?
- case 1: eUnderline = awt::FontUnderline::SINGLE; break;
- case 3: eUnderline = awt::FontUnderline::DOUBLE; break;
- case 4: eUnderline = awt::FontUnderline::DOTTED; break;
- case 7: eUnderline = awt::FontUnderline::DASH; break;
- case 9: eUnderline = awt::FontUnderline::DASHDOT; break;
- case 10:eUnderline = awt::FontUnderline::DASHDOTDOT; break;
- case 6: eUnderline = awt::FontUnderline::BOLD; break;
- case 11:eUnderline = awt::FontUnderline::WAVE; break;
- case 20:eUnderline = awt::FontUnderline::BOLDDOTTED; break;
- case 23:eUnderline = awt::FontUnderline::BOLDDASH; break;
- case 39:eUnderline = awt::FontUnderline::LONGDASH; break;
- case 55:eUnderline = awt::FontUnderline::BOLDLONGDASH; break;
- case 25:eUnderline = awt::FontUnderline::BOLDDASHDOT; break;
- case 26:eUnderline = awt::FontUnderline::BOLDDASHDOTDOT;break;
- case 27:eUnderline = awt::FontUnderline::BOLDWAVE; break;
- case 43:eUnderline = awt::FontUnderline::DOUBLEWAVE; break;
- default: ;
- }
- pContext->Insert(PROP_CHAR_UNDERLINE, uno::makeAny( eUnderline ) );
+ case NS_ooxml::LN_Value_ST_Underline_none:
+ nUnderline = awt::FontUnderline::NONE;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_words:
+ pContext->Insert(PROP_CHAR_WORD_MODE, uno::makeAny(true));
+ // fall-through intended
+ case NS_ooxml::LN_Value_ST_Underline_single:
+ nUnderline = awt::FontUnderline::SINGLE;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_double:
+ nUnderline = awt::FontUnderline::DOUBLE;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dotted:
+ nUnderline = awt::FontUnderline::DOTTED;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dash:
+ nUnderline = awt::FontUnderline::DASH;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dotDash:
+ nUnderline = awt::FontUnderline::DASHDOT;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dotDotDash:
+ nUnderline = awt::FontUnderline::DASHDOTDOT;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_thick:
+ nUnderline = awt::FontUnderline::BOLD;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_wave:
+ nUnderline = awt::FontUnderline::WAVE;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dottedHeavy:
+ nUnderline = awt::FontUnderline::BOLDDOTTED;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dashedHeavy:
+ nUnderline = awt::FontUnderline::BOLDDASH;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dashLong:
+ nUnderline = awt::FontUnderline::LONGDASH;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dashLongHeavy:
+ nUnderline = awt::FontUnderline::BOLDLONGDASH;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dashDotHeavy:
+ nUnderline = awt::FontUnderline::BOLDDASHDOT;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_dashDotDotHeavy:
+ nUnderline = awt::FontUnderline::BOLDDASHDOTDOT;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_wavyHeavy:
+ nUnderline = awt::FontUnderline::BOLDWAVE;
+ break;
+ case NS_ooxml::LN_Value_ST_Underline_wavyDouble:
+ nUnderline = awt::FontUnderline::DOUBLEWAVE;
+ break;
+ }
+ pContext->Insert(PROP_CHAR_UNDERLINE, uno::makeAny(nUnderline));
}
void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext, const bool bExchangeLeftRight)
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 328964b..6953b2d 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -16683,24 +16683,24 @@
<action name="start" action="setDefaultStringValue"/>
</resource>
<resource name="ST_Underline" resource="List">
- <value tokenid="1">single</value>
- <value tokenid="2">words</value>
- <value tokenid="3">double</value>
- <value tokenid="6">thick</value>
- <value tokenid="4">dotted</value>
- <value tokenid="20">dottedHeavy</value>
- <value tokenid="7">dash</value>
- <value tokenid="23">dashedHeavy</value>
- <value tokenid="39">dashLong</value>
- <value tokenid="55">dashLongHeavy</value>
- <value tokenid="9">dotDash</value>
- <value tokenid="25">dashDotHeavy</value>
- <value tokenid="10">dotDotDash</value>
- <value tokenid="26">dashDotDotHeavy</value>
- <value tokenid="11">wave</value>
- <value tokenid="27">wavyHeavy</value>
- <value tokenid="43">wavyDouble</value>
- <value tokenid="0">none</value>
+ <value tokenid="ooxml:Value_ST_Underline_single">single</value>
+ <value tokenid="ooxml:Value_ST_Underline_words">words</value>
+ <value tokenid="ooxml:Value_ST_Underline_double">double</value>
+ <value tokenid="ooxml:Value_ST_Underline_thick">thick</value>
+ <value tokenid="ooxml:Value_ST_Underline_dotted">dotted</value>
+ <value tokenid="ooxml:Value_ST_Underline_dottedHeavy">dottedHeavy</value>
+ <value tokenid="ooxml:Value_ST_Underline_dash">dash</value>
+ <value tokenid="ooxml:Value_ST_Underline_dashedHeavy">dashedHeavy</value>
+ <value tokenid="ooxml:Value_ST_Underline_dashLong">dashLong</value>
+ <value tokenid="ooxml:Value_ST_Underline_dashLongHeavy">dashLongHeavy</value>
+ <value tokenid="ooxml:Value_ST_Underline_dotDash">dotDash</value>
+ <value tokenid="ooxml:Value_ST_Underline_dashDotHeavy">dashDotHeavy</value>
+ <value tokenid="ooxml:Value_ST_Underline_dotDotDash">dotDotDash</value>
+ <value tokenid="ooxml:Value_ST_Underline_dashDotDotHeavy">dashDotDotHeavy</value>
+ <value tokenid="ooxml:Value_ST_Underline_wave">wave</value>
+ <value tokenid="ooxml:Value_ST_Underline_wavyHeavy">wavyHeavy</value>
+ <value tokenid="ooxml:Value_ST_Underline_wavyDouble">wavyDouble</value>
+ <value tokenid="ooxml:Value_ST_Underline_none">none</value>
</resource>
<resource name="CT_Underline" resource="Properties">
<attribute name="val" tokenid="ooxml:CT_Underline_val"/>
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 836943ee..2b22101 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2427,14 +2427,14 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
int nParam = -1;
int nSprm = -1;
- // Map all underline flags to a single sprm.
+ // Underline flags.
switch (nKeyword)
{
case RTF_ULD:
- nSprm = 4;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dotted;
break;
case RTF_ULW:
- nSprm = 2;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_words;
break;
default:
break;
@@ -2935,7 +2935,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
break;
case RTF_ULNONE:
{
- RTFValue::Pointer_t pValue(new RTFValue(0));
+ RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Underline_none));
m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue);
}
break;
@@ -4622,60 +4622,60 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam
int nSprm = -1;
RTFValue::Pointer_t pBoolValue(new RTFValue(int(!bParam || nParam != 0)));
- // Map all underline toggles to a single sprm.
+ // Underline toggles.
switch (nKeyword)
{
case RTF_UL:
- nSprm = 1;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_single;
break;
case RTF_ULDASH:
- nSprm = 7;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dash;
break;
case RTF_ULDASHD:
- nSprm = 9;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dotDash;
break;
case RTF_ULDASHDD:
- nSprm = 10;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dotDotDash;
break;
case RTF_ULDB:
- nSprm = 3;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_double;
break;
case RTF_ULHWAVE:
- nSprm = 27;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_wavyHeavy;
break;
case RTF_ULLDASH:
- nSprm = 39;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dashLong;
break;
case RTF_ULTH:
- nSprm = 6;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_thick;
break;
case RTF_ULTHD:
- nSprm = 20;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dottedHeavy;
break;
case RTF_ULTHDASH:
- nSprm = 23;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dashedHeavy;
break;
case RTF_ULTHDASHD:
- nSprm = 25;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dashDotHeavy;
break;
case RTF_ULTHDASHDD:
- nSprm = 26;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dashDotDotHeavy;
break;
case RTF_ULTHLDASH:
- nSprm = 55;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_dashLongHeavy;
break;
case RTF_ULULDBWAVE:
- nSprm = 43;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_wavyDouble;
break;
case RTF_ULWAVE:
- nSprm = 11;
+ nSprm = NS_ooxml::LN_Value_ST_Underline_wave;
break;
default:
break;
}
if (nSprm >= 0)
{
- RTFValue::Pointer_t pValue(new RTFValue((!bParam || nParam != 0) ? nSprm : 0));
+ RTFValue::Pointer_t pValue(new RTFValue((!bParam || nParam != 0) ? nSprm : NS_ooxml::LN_Value_ST_Underline_none));
m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue);
return 0;
}
More information about the Libreoffice-commits
mailing list