[Libreoffice-commits] .: writerfilter/source
Lubos Lunak
llunak at kemper.freedesktop.org
Thu Mar 3 05:39:39 PST 2011
writerfilter/source/dmapper/FontTable.cxx | 24 ++++++++++++++++++++----
writerfilter/source/dmapper/FontTable.hxx | 1 +
writerfilter/source/ooxml/model.xml | 24 +++++++++++++++++++++++-
3 files changed, 44 insertions(+), 5 deletions(-)
New commits:
commit 43232a4927f03e5b8c5964f8a2343138cf682fcc
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Thu Mar 3 14:38:21 2011 +0100
read w:characterSet (fdo#34814)
diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx
index 8410780..5ebf867 100644
--- a/writerfilter/source/dmapper/FontTable.cxx
+++ b/writerfilter/source/dmapper/FontTable.cxx
@@ -101,6 +101,18 @@ void FontTable::attribute(Id Name, Value & val)
case NS_ooxml::LN_CT_Font_name:
m_pImpl->pCurrentEntry->sFontName = sValue;
break;
+ case NS_ooxml::LN_CT_Charset_val:
+ // w:characterSet has higher priority, set only if that one is not set
+ if( m_pImpl->pCurrentEntry->nTextEncoding == RTL_TEXTENCODING_DONTKNOW )
+ m_pImpl->pCurrentEntry->nTextEncoding = rtl_getTextEncodingFromWindowsCharset( nIntValue );
+ break;
+ case NS_ooxml::LN_CT_Charset_characterSet:
+ {
+ rtl::OString tmp;
+ sValue.convertToString( &tmp, RTL_TEXTENCODING_ASCII_US, OUSTRING_TO_OSTRING_CVTFLAGS );
+ m_pImpl->pCurrentEntry->nTextEncoding = rtl_getTextEncodingFromMimeCharset( tmp );
+ break;
+ }
default:
{
//----> debug
@@ -125,12 +137,16 @@ void FontTable::sprm(Sprm& rSprm)
switch(nSprmId)
{
case NS_ooxml::LN_CT_Font_charset:
- m_pImpl->pCurrentEntry->nTextEncoding = rtl_getTextEncodingFromWindowsCharset( nIntValue );
- break;
- default:
- break;
+ resolveSprm( rSprm );
+ break;
}
+}
+void FontTable::resolveSprm(Sprm & r_Sprm)
+{
+ writerfilter::Reference<Properties>::Pointer_t pProperties = r_Sprm.getProps();
+ if( pProperties.get())
+ pProperties->resolve(*this);
}
void FontTable::entry(int /*pos*/, writerfilter::Reference<Properties>::Pointer_t ref)
diff --git a/writerfilter/source/dmapper/FontTable.hxx b/writerfilter/source/dmapper/FontTable.hxx
index 84f0b02..7344203 100644
--- a/writerfilter/source/dmapper/FontTable.hxx
+++ b/writerfilter/source/dmapper/FontTable.hxx
@@ -75,6 +75,7 @@ public:
// Properties
virtual void attribute(Id Name, Value & val);
virtual void sprm(Sprm & sprm);
+ void resolveSprm(Sprm & r_sprm);
// Table
virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index ba836fe..2285cec 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -20377,7 +20377,12 @@
</optional>
<optional>
<element name="charset">
- <ref name="CT_UcharHexNumber"/>
+ <ref name="CT_Charset"/>
+ </element>
+ </optional>
+ <optional>
+ <element name="characterSet">
+ <ref name="CT_String"/>
</element>
</optional>
<optional>
@@ -20433,6 +20438,18 @@
</element>
</zeroOrMore>
</define>
+ <define name="CT_Charset">
+ <optional>
+ <attribute name="val">
+ <ref name="CT_UcharHexNumber"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="characterSet">
+ <ref name="ST_String"/>
+ </attribute>
+ </optional>
+ </define>
<define name="CT_DivBdr">
<optional>
<element name="top">
@@ -23282,6 +23299,10 @@
<attribute name="val" tokenid="ooxml:CT_Panose_val" action="setValue"/>
<action name="start" action="setDefaultHexValue"/>
</resource>
+ <resource name="CT_Charset" resource="Properties">
+ <attribute name="val" tokenid="ooxml:CT_Charset_val"/>
+ <attribute name="characterSet" tokenid="ooxml:CT_Charset_characterSet"/>
+ </resource>
<resource name="ST_FontFamily" resource="List">
<value tokenid="ooxml:Value_ST_FontFamily_decorative">decorative</value>
<value tokenid="ooxml:Value_ST_FontFamily_modern">modern</value>
@@ -23318,6 +23339,7 @@
<element name="altName" tokenid="ooxml:CT_Font_altName"/>
<element name="panose1" tokenid="ooxml:CT_Font_panose1"/>
<element name="charset" tokenid="ooxml:CT_Font_charset"/>
+ <element name="characterSet" tokenid="ooxml:CT_Font_characterSet"/>
<element name="family" tokenid="ooxml:CT_Font_family"/>
<element name="notTrueType" tokenid="ooxml:CT_Font_notTrueType"/>
<element name="pitch" tokenid="ooxml:CT_Font_pitch"/>
More information about the Libreoffice-commits
mailing list