diff options
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/document.hxx | 2 | ||||
-rw-r--r-- | starmath/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | starmath/source/document.cxx | 4 | ||||
-rw-r--r-- | starmath/source/rtfexport.cxx | 21 | ||||
-rw-r--r-- | starmath/source/rtfexport.hxx | 3 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 4 |
6 files changed, 19 insertions, 17 deletions
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index 43aefaaad229..e9b4a9595990 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -156,7 +156,7 @@ class SmDocShell : public SfxObjectShell, public SfxListener void InvalidateCursor(); bool writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ); - void writeFormulaRtf(OStringBuffer& rBuffer); + void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding); bool readFormulaOoxml( oox::formulaimport::XmlStream& stream ); public: diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index fc6808974a04..dbf4b1fcb9a4 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -93,7 +93,7 @@ public: // oox::FormulaExportBase virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ); - virtual void writeFormulaRtf(OStringBuffer& rBuffer); + virtual void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding); // oox::FormulaImportBase virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ); virtual Size getFormulaSize() const; diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 5a41f9763dca..6cc719e3f60e 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -987,14 +987,14 @@ bool SmDocShell::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, return aEquation.ConvertFromStarMath( m_pSerializer ); } -void SmDocShell::writeFormulaRtf(OStringBuffer& rBuffer) +void SmDocShell::writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding) { if (!pTree) Parse(); if (pTree && !IsFormulaArranged()) ArrangeFormula(); SmRtfExport aEquation(pTree); - aEquation.ConvertFromStarMath(rBuffer); + aEquation.ConvertFromStarMath(rBuffer, nEncoding); } bool SmDocShell::readFormulaOoxml( oox::formulaimport::XmlStream& stream ) diff --git a/starmath/source/rtfexport.cxx b/starmath/source/rtfexport.cxx index 3e1fa3d75763..6f4d0a20d515 100644 --- a/starmath/source/rtfexport.cxx +++ b/starmath/source/rtfexport.cxx @@ -39,11 +39,12 @@ SmRtfExport::SmRtfExport(const SmNode* pIn) { } -bool SmRtfExport::ConvertFromStarMath(OStringBuffer& rBuffer) +bool SmRtfExport::ConvertFromStarMath(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding) { if (!m_pTree) return false; m_pBuffer = &rBuffer; + m_nEncoding = nEncoding; m_pBuffer->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE LO_STRING_SVTOOLS_RTF_MOMATH " "); HandleNode(m_pTree, 0); m_pBuffer->append("}"); // moMath @@ -76,7 +77,7 @@ void SmRtfExport::HandleText(const SmNode* pNode, int /*nLevel*/) { sal_uInt16 nChar = pTemp->GetText().GetChar(i); OUString aValue(SmTextNode::ConvertSymbolToUnicode(nChar)); - m_pBuffer->append(msfilter::rtfutil::OutString(aValue, RTL_TEXTENCODING_MS_1252)); + m_pBuffer->append(msfilter::rtfutil::OutString(aValue, m_nEncoding)); } m_pBuffer->append("}"); // mr @@ -127,7 +128,7 @@ void SmRtfExport::HandleAttribute(const SmAttributNode* pNode, int nLevel) m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MACCPR " "); m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MCHR " "); OUString aValue(pNode->Attribute()->GetToken().cMathChar); - m_pBuffer->append(msfilter::rtfutil::OutString(aValue, RTL_TEXTENCODING_MS_1252)); + m_pBuffer->append(msfilter::rtfutil::OutString(aValue, m_nEncoding)); m_pBuffer->append("}"); // mchr m_pBuffer->append("}"); // maccPr m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); @@ -192,7 +193,7 @@ void SmRtfExport::HandleRoot(const SmRootNode* pNode, int nLevel) } namespace { -OString mathSymbolToString(const SmNode* node) +OString mathSymbolToString(const SmNode* node, rtl_TextEncoding nEncoding) { assert(node->GetType() == NMATH); const SmTextNode* txtnode = static_cast<const SmTextNode*>(node); @@ -201,7 +202,7 @@ OString mathSymbolToString(const SmNode* node) assert(txtnode->GetText().Len() == 1); sal_Unicode chr = SmTextNode::ConvertSymbolToUnicode(txtnode->GetText().GetChar(0)); OUString aValue(chr); - return msfilter::rtfutil::OutString(aValue, RTL_TEXTENCODING_MS_1252); + return msfilter::rtfutil::OutString(aValue, nEncoding); } } @@ -225,7 +226,7 @@ void SmRtfExport::HandleOperator(const SmOperNode* pNode, int nLevel) m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MNARY " "); m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MNARYPR " "); m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MCHR " "); - m_pBuffer->append(mathSymbolToString(operation)); + m_pBuffer->append(mathSymbolToString(operation, m_nEncoding)); m_pBuffer->append("}"); // mchr if (!subsup || !subsup->GetSubSup(CSUB)) m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUBHIDE " 1}"); @@ -408,7 +409,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel) m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MD " "); m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MDPR " "); m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBEGCHR " "); - m_pBuffer->append(mathSymbolToString(pNode->OpeningBrace())); + m_pBuffer->append(mathSymbolToString(pNode->OpeningBrace(), m_nEncoding)); m_pBuffer->append("}"); // mbegChr std::vector< const SmNode* > subnodes; if (pNode->Body()->GetType() == NBRACEBODY) @@ -424,7 +425,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel) if(!separatorWritten) { m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSEPCHR " "); - m_pBuffer->append(mathSymbolToString(math)); + m_pBuffer->append(mathSymbolToString(math, m_nEncoding)); m_pBuffer->append("}"); // msepChr separatorWritten = true; } @@ -436,7 +437,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel) else subnodes.push_back(pNode->Body()); m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MENDCHR " "); - m_pBuffer->append(mathSymbolToString(pNode->ClosingBrace())); + m_pBuffer->append(mathSymbolToString(pNode->ClosingBrace(), m_nEncoding)); m_pBuffer->append("}"); // mendChr m_pBuffer->append("}"); // mdPr for (unsigned int i = 0; i < subnodes.size(); ++i) @@ -465,7 +466,7 @@ void SmRtfExport::HandleVerticalBrace(const SmVerticalBraceNode* pNode, int nLev m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MGROUPCHR " "); m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MGROUPCHRPR " "); m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MCHR " "); - m_pBuffer->append(mathSymbolToString(pNode->Brace())); + m_pBuffer->append(mathSymbolToString(pNode->Brace(), m_nEncoding)); m_pBuffer->append("}"); // mchr // TODO not sure if pos and vertJc are correct m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MPOS " ").append(top ? "top" : "bot").append("}"); diff --git a/starmath/source/rtfexport.hxx b/starmath/source/rtfexport.hxx index bf12b64a4d5b..2183d3978ef2 100644 --- a/starmath/source/rtfexport.hxx +++ b/starmath/source/rtfexport.hxx @@ -40,7 +40,7 @@ class SmRtfExport : public SmWordExportBase { public: SmRtfExport(const SmNode* pIn); - bool ConvertFromStarMath(OStringBuffer& rBuffer); + bool ConvertFromStarMath(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding); private: virtual void HandleVerticalStack(const SmNode* pNode, int nLevel); virtual void HandleText(const SmNode* pNode, int nLevel); @@ -55,6 +55,7 @@ private: virtual void HandleBlank(); OStringBuffer* m_pBuffer; + rtl_TextEncoding m_nEncoding; }; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index dadb8f3454f3..40fa0ebb8574 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -1123,9 +1123,9 @@ void SmModel::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oo static_cast< SmDocShell* >( GetObjectShell())->writeFormulaOoxml( m_pSerializer, version ); } -void SmModel::writeFormulaRtf(OStringBuffer& rBuffer) +void SmModel::writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding) { - static_cast<SmDocShell*>(GetObjectShell())->writeFormulaRtf(rBuffer); + static_cast<SmDocShell*>(GetObjectShell())->writeFormulaRtf(rBuffer, nEncoding); } void SmModel::readFormulaOoxml( oox::formulaimport::XmlStream& stream ) |