diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2011-12-02 14:23:59 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2011-12-07 14:47:10 +0100 |
commit | efe72126d9942aa6c62608f801670db06a31828f (patch) | |
tree | ef553d3a834d1d213bcf22e17e897cb5c4fd30ca /starmath/source/ooxmlexport.cxx | |
parent | d7017dbc1754c3b6f27501d3eae997a39f62daf8 (diff) |
merge two duplicates of a function
Diffstat (limited to 'starmath/source/ooxmlexport.cxx')
-rw-r--r-- | starmath/source/ooxmlexport.cxx | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index b84fd385aaa3..360489424f36 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -34,41 +34,6 @@ using namespace oox; using namespace oox::core; -// TODO duped from MathType - -static sal_Unicode Convert(sal_Unicode nIn) -{ - //Find the best match in accepted unicode for our private area symbols - static const sal_Unicode aStarMathPrivateToUnicode[] = - { - 0x2030, 0xF613, 0xF612, 0x002B, 0x003C, 0x003E, 0xE425, 0xE421, 0xE088, 0x2208, - 0x0192, 0x2026, 0x2192, 0x221A, 0x221A, 0x221A, 0xE090, 0x005E, 0x02C7, 0x02D8, - 0x00B4, 0x0060, 0x02DC, 0x00AF, 0x0362, 0xE099, 0xE09A, 0x20DB, 0xE09C, 0xE09D, - 0x0028, 0x0029, 0x2220, 0x22AF, 0xE0A2, 0xE0A3, 0xE0A4, 0xE0A5, 0xE0A6, 0xE0A7, - 0x002F, 0x005C, 0x274F, 0xE0AB, 0x0393, 0x0394, 0x0398, 0x039b, 0x039e, 0x03A0, - 0x03a3, 0x03a5, 0x03a6, 0x03a8, 0x03A9, 0x03B1, 0x03B2, 0x03b3, 0x03b4, 0x03b5, - 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, - 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03b5, - 0x03d1, 0x03d6, 0xE0D2, 0x03db, 0x2118, 0x2202, 0x2129, 0xE0D7, 0xE0D8, 0x22A4, - 0xE0DA, 0x2190, 0x2191, 0x2193 - }; - if ((nIn >= 0xE080) && (nIn <= 0xE0DD)) - nIn = aStarMathPrivateToUnicode[nIn-0xE080]; - - //For whatever unicode glyph that equation editor doesn't ship with that - //we have a possible match we can munge it to. - switch (nIn) - { - case 0x2223: - nIn = '|'; - break; - default: - break; - } - - return nIn; -} - SmOoxmlExport::SmOoxmlExport( const String &rIn, const SmNode* pIn, OoxmlVersion v ) : str( rIn ) , pTree( pIn ) @@ -268,7 +233,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/) *pS << sal_uInt8(nFace+128); //typeface #endif sal_uInt16 nChar = pTemp->GetText().GetChar(i); - m_pSerializer->writeEscaped( rtl::OUString( Convert(nChar))); + m_pSerializer->writeEscaped( rtl::OUString( SmTextNode::ConvertSymbolToUnicode(nChar))); #if 0 //Mathtype can only have these sort of character @@ -454,8 +419,10 @@ void SmOoxmlExport::HandleRoot( const SmRootNode* pNode, int nLevel ) static rtl::OString mathSymbolToString( const SmNode* node ) { - OSL_ASSERT( node->GetType() == NMATH && static_cast< const SmTextNode* >( node )->GetText().Len() == 1 ); - sal_Unicode chr = Convert( static_cast< const SmTextNode* >( node )->GetText().GetChar( 0 )); + assert( node->GetType() == NMATH ); + const SmTextNode* txtnode = static_cast< const SmTextNode* >( node ); + assert( txtnode->GetText().Len() == 1 ); + sal_Unicode chr = SmTextNode::ConvertSymbolToUnicode( txtnode->GetText().GetChar( 0 )); return rtl::OUStringToOString( rtl::OUString( chr ), RTL_TEXTENCODING_UTF8 ); } |