diff options
author | Ricardo Montania <ricardo@linuxafundo.com.br> | 2013-07-16 07:47:27 -0300 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2013-07-16 12:21:00 +0000 |
commit | 150c9f8bbcffacc687a5603e2a589d2a3816dccb (patch) | |
tree | 3ac2128e53eba42642d4b89c9c02390296b413cf /starmath | |
parent | 32527be0677a8fa971ebbf39ca9cab9c5a3687fb (diff) |
String.AppendAscii() cleanup in math
Change-Id: I567e1a80ab75d6ebdaba52cb9afd47dbd52f39ce
Reviewed-on: https://gerrit.libreoffice.org/4933
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/document.hxx | 4 | ||||
-rw-r--r-- | starmath/inc/node.hxx | 24 | ||||
-rw-r--r-- | starmath/qa/cppunit/test_nodetotextvisitors.cxx | 30 | ||||
-rw-r--r-- | starmath/source/document.cxx | 4 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 4 | ||||
-rw-r--r-- | starmath/source/mathmlimport.hxx | 4 | ||||
-rw-r--r-- | starmath/source/mathtype.cxx | 271 | ||||
-rw-r--r-- | starmath/source/mathtype.hxx | 26 | ||||
-rw-r--r-- | starmath/source/node.cxx | 108 |
9 files changed, 235 insertions, 240 deletions
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index d4f132455abc..4446ad0d86fd 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -92,7 +92,7 @@ class SmDocShell : public SfxObjectShell, public SfxListener friend class SmModel; friend class SmCursor; - String aText; + OUString aText; SmFormat aFormat; SmParser aInterpreter; OUString aAccText; @@ -186,7 +186,7 @@ public: void UpdateText(); void SetText(const OUString& rBuffer); - OUString GetText() { return (OUString(aText)); } + OUString GetText() { return (aText); } void SetFormat(SmFormat& rFormat); const SmFormat& GetFormat() { return (aFormat); } diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 2416d6e9080b..b449666b082b 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -155,7 +155,7 @@ public: virtual void Move(const Point &rPosition); void MoveTo(const Point &rPosition) { Move(rPosition - GetTopLeft()); } virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - virtual void CreateTextFromNode(String &rText); + virtual void CreateTextFromNode(OUString &rText); virtual void GetAccessibleText( OUStringBuffer &rText ) const; sal_Int32 GetAccessibleIndex() const { return nAccIndex; } @@ -403,7 +403,7 @@ public: virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); }; @@ -489,7 +489,7 @@ public: virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - virtual void CreateTextFromNode(String &rText); + virtual void CreateTextFromNode(OUString &rText); virtual void GetAccessibleText( OUStringBuffer &rText ) const; void Accept(SmVisitor* pVisitor); @@ -575,7 +575,7 @@ public: virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); }; @@ -741,7 +741,7 @@ public: {} virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); }; @@ -794,7 +794,7 @@ public: } virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); SmNode* Argument(); @@ -867,7 +867,7 @@ public: virtual SmNode * GetLeftMost(); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); }; @@ -979,7 +979,7 @@ public: void SetSubSup(SmSubSup eSubSup, SmNode* pScript) { SetSubNode( 1 + eSubSup, pScript); } virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); }; @@ -1017,7 +1017,7 @@ public: const SmMathSymbolNode* ClosingBrace() const; virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); }; @@ -1162,7 +1162,7 @@ public: {} virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); SmNode* Attribute(); @@ -1197,7 +1197,7 @@ public: virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); }; @@ -1229,7 +1229,7 @@ public: virtual SmNode * GetLeftMost(); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - void CreateTextFromNode(String &rText); + void CreateTextFromNode(OUString &rText); void Accept(SmVisitor* pVisitor); }; diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index 4409d97e8302..251ba83efe94 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -519,11 +519,11 @@ void Test::ParseAndCompare(const char *formula1, const char *formula2, const cha void Test::testBinomInBinHor() { - String sInput, sExpected; + OUString sInput, sExpected; SmNode* pTree; // set up a binom (table) node - sInput.AppendAscii("binom a b + c"); + sInput += "binom a b + c"; pTree = SmParser().Parse(sInput); pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); @@ -539,19 +539,19 @@ void Test::testBinomInBinHor() aCursor.InsertElement(PlusElement); aCursor.InsertText("d"); - sExpected.AppendAscii(" { { binom a b + c } + d } "); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Binom Node in BinHor Node", sExpected, String(xDocShRef->GetText())); + sExpected += " { { binom a b + c } + d } "; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Binom Node in BinHor Node", sExpected, xDocShRef->GetText()); delete pTree; } void Test::testBinVerInUnary() { - String sInput, sExpected; + OUString sInput, sExpected; SmNode* pTree; // set up a unary operator with operand - sInput.AppendAscii("- 1"); + sInput += "- 1"; pTree = SmParser().Parse(sInput); pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); @@ -570,19 +570,19 @@ void Test::testBinVerInUnary() aCursor.Move(&aOutputDevice, MoveDown); aCursor.InsertText("2"); - sExpected.AppendAscii(" - { 1 over 2 } "); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Binary Vertical in Unary Operator", sExpected, String(xDocShRef->GetText())); + sExpected += " - { 1 over 2 } "; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Binary Vertical in Unary Operator", sExpected, xDocShRef->GetText()); delete pTree; } void Test::testBinHorInSubSup() { - String sInput, sExpected; + OUString sInput, sExpected; SmNode* pTree; // set up a blank formula - sInput.AppendAscii(""); + sInput += ""; pTree = SmParser().Parse(sInput); pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); @@ -601,7 +601,7 @@ void Test::testBinHorInSubSup() aCursor.InsertElement(PlusElement); aCursor.InsertText("d"); - sExpected.AppendAscii(" { a rsup { b + c } + d } "); + sExpected += " { a rsup { b + c } + d } "; //FIXME CPPUNIT_ASSERT_EQUAL_MESSAGE("BinHor in SubSup", sExpected, xDocShRef->GetText()); delete pTree; @@ -609,11 +609,11 @@ void Test::testBinHorInSubSup() void Test::testUnaryInMixedNumberAsNumerator() { - String sInput, sExpected; + OUString sInput, sExpected; SmNode* pTree; // set up a unary operator - sInput.AppendAscii("- 1"); + sInput += "- 1"; pTree = SmParser().Parse(sInput); pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); @@ -648,8 +648,8 @@ void Test::testUnaryInMixedNumberAsNumerator() aCursor.InsertElement(PlusElement); aCursor.InsertText("4"); - sExpected.AppendAscii(" { 2 { - 1 over 2 } + 4 } "); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unary in mixed number as Numerator", sExpected, String(xDocShRef->GetText())); + sExpected += " { 2 { - 1 over 2 } + 4 } "; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unary in mixed number as Numerator", sExpected, xDocShRef->GetText()); delete pTree; } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 8a8c9c640c55..e49faecbc852 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -154,7 +154,7 @@ void SmDocShell::SetText(const OUString& rBuffer) { SAL_INFO( "starmath", "starmath: SmDocShell::SetText" ); - if (rBuffer != OUString(aText)) + if (rBuffer != aText) { bool bIsEnabled = IsEnableSetModified(); if( bIsEnabled ) @@ -656,7 +656,7 @@ void SmDocShell::OnDocumentPrinterChanged( Printer *pPrt ) SetFormulaArranged(false); Size aOldSize = GetVisArea().GetSize(); Repaint(); - if( aOldSize != GetVisArea().GetSize() && aText.Len() ) + if( aOldSize != GetVisArea().GetSize() && !aText.isEmpty() ) SetModified( true ); pTmpPrinter = 0; } diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index beaaf3d59548..eb3579636571 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -555,7 +555,7 @@ void SmXMLImport::endDocument(void) SmDocShell *pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); pDocShell->SetFormulaTree(pTree); - if (0 == aText.Len()) //If we picked up no annotation text + if (aText.isEmpty()) //If we picked up no annotation text { // Get text from imported formula pTree->CreateTextFromNode(aText); @@ -1194,7 +1194,7 @@ void SmXMLAnnotationContext_Impl::StartElement(const uno::Reference< void SmXMLAnnotationContext_Impl::Characters(const OUString &rChars) { if (bIsStarMath) - GetSmImport().GetText().Append(String(rChars)); + GetSmImport().GetText() + rChars; } //////////////////////////////////////////////////////////// diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx index 76363dfec3b6..17b0260e18de 100644 --- a/starmath/source/mathmlimport.hxx +++ b/starmath/source/mathmlimport.hxx @@ -83,7 +83,7 @@ class SmXMLImport : public SvXMLImport SmNodeStack aNodeStack; sal_Bool bSuccess; - String aText; + OUString aText; public: SmXMLImport( @@ -256,7 +256,7 @@ public: } sal_Bool GetSuccess() { return bSuccess; } - String &GetText() { return aText; } + OUString &GetText() { return aText; } virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps); virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps); diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 22b48f725495..987568458656 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -73,7 +73,7 @@ void MathType::Init() between math symbols and ordinary text e.g. 1=2 rather than 1 = 2 */ -sal_Bool MathType::LookupChar(sal_Unicode nChar,String &rRet,sal_uInt8 nVersion, +sal_Bool MathType::LookupChar(sal_Unicode nChar,OUString &rRet,sal_uInt8 nVersion, sal_uInt8 nTypeFace) { bool bRet=false; @@ -109,56 +109,56 @@ sal_Bool MathType::LookupChar(sal_Unicode nChar,String &rRet,sal_uInt8 nVersion, pC = " rightarrow "; else { - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; } break; case 0x00fb: if ((nVersion < 3) && (nTypeFace == 0x81)) nChar = 0xDF; - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; break; case 'a': if ((nVersion < 3) && (nTypeFace == 0x84)) nChar = 0x3b1; - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; break; case 'b': if ((nVersion < 3) && (nTypeFace == 0x84)) nChar = 0x3b2; - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; break; case 'l': if ((nVersion < 3) && (nTypeFace == 0x84)) nChar = 0x3bb; - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; break; case 'n': if ((nVersion < 3) && (nTypeFace == 0x84)) nChar = 0x3bd; - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; break; case 'r': if ((nVersion < 3) && (nTypeFace == 0x84)) nChar = 0x3c1; - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; break; case 'D': if ((nVersion < 3) && (nTypeFace == 0x84)) nChar = 0x394; - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; break; case 0xa9: if ((nVersion < 3) && (nTypeFace == 0x82)) nChar = '\''; - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; break; case 0x00f1: @@ -166,7 +166,7 @@ sal_Bool MathType::LookupChar(sal_Unicode nChar,String &rRet,sal_uInt8 nVersion, pC = " \\rangle "; else { - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; } break; @@ -175,7 +175,7 @@ sal_Bool MathType::LookupChar(sal_Unicode nChar,String &rRet,sal_uInt8 nVersion, pC = " <= "; else { - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; } break; @@ -184,7 +184,7 @@ sal_Bool MathType::LookupChar(sal_Unicode nChar,String &rRet,sal_uInt8 nVersion, pC = " drarrow "; else { - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; } break; @@ -193,7 +193,7 @@ sal_Bool MathType::LookupChar(sal_Unicode nChar,String &rRet,sal_uInt8 nVersion, pC = " %OMEGA "; else { - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; } break; @@ -441,9 +441,7 @@ sal_Bool MathType::LookupChar(sal_Unicode nChar,String &rRet,sal_uInt8 nVersion, break; case 0x22b2: case 0x22b3: - rRet += ' '; - rRet.Append(nChar); - rRet += ' '; + rRet += " " + OUString( nChar ) + " "; break; case 0x22a5: pC = " ortho "; @@ -478,7 +476,7 @@ sal_Bool MathType::LookupChar(sal_Unicode nChar,String &rRet,sal_uInt8 nVersion, pC = " rdbracket "; break; case 0xe083: - rRet.Append('+'); + rRet += "+"; bRet=true; break; case '^': @@ -505,25 +503,25 @@ sal_Bool MathType::LookupChar(sal_Unicode nChar,String &rRet,sal_uInt8 nVersion, case 0xef05: //tiny space case 0xeb02: //small space case 0xeb04: //medium space - rRet.Append('`'); + rRet += "`"; break; case 0xeb05: //large space - rRet.Append('~'); + rRet += "~"; break; case 0x3a9: pC = " %OMEGA "; break; default: - rRet.Append(nChar); + rRet += OUString( nChar ); bRet=true; break; } if (pC) - rRet.AppendAscii(pC); + rRet += OUString::createFromAscii( pC ); return bRet; } -void MathTypeFont::AppendStyleToText(String &rRet) +void MathTypeFont::AppendStyleToText(OUString &rRet) { const char *pC = NULL; switch (nStyle) @@ -542,10 +540,10 @@ void MathTypeFont::AppendStyleToText(String &rRet) break; } if (pC) - rRet.AppendAscii(pC); + rRet += OUString::createFromAscii( pC ); } -void MathType::TypeFaceToString(String &rTxt,sal_uInt8 nFace) +void MathType::TypeFaceToString(OUString &rTxt,sal_uInt8 nFace) { MathTypeFont aFont(nFace); MathTypeFontSet::iterator aItr = aUserStyles.find(aFont); @@ -606,28 +604,28 @@ int MathType::Parse(SotStorage *pStor) return nRet; } -static void lcl_PrependDummyTerm(String &rRet, xub_StrLen &rTextStart) +static void lcl_PrependDummyTerm(OUString &rRet, sal_Int32 &rTextStart) { - if ((rRet.GetChar(rTextStart) == '=') && + if ((rRet[rTextStart] == '=') && ((rTextStart == 0) || - (rRet.GetChar(rTextStart-1) == '{')) + (rRet[ rTextStart-1 ] == '{')) ) { - rRet.InsertAscii(" {}",rTextStart); + rRet = rRet.replaceAt(rTextStart,0," {}"); rTextStart+=3; } } -static void lcl_AppendDummyTerm(String &rRet) +static void lcl_AppendDummyTerm(OUString &rRet) { bool bOk=false; - for(int nI=rRet.Len()-1;nI >= 0; nI--) + for(int nI=rRet.getLength()-1;nI >= 0; nI--) { - xub_StrLen nIdx = sal::static_int_cast< xub_StrLen >(nI); - sal_Unicode nChar = rRet.GetChar(nIdx); + sal_Int32 nIdx = sal::static_int_cast< sal_Int32 >(nI); + sal_Unicode nChar = rRet[nIdx]; if (nChar == ' ') continue; - if (rRet.GetChar(nIdx) != '{') + if (rRet[nIdx] != '{') bOk=true; break; } @@ -664,9 +662,9 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, int nSetSize=0,nSetAlign=0; int nCurRow=0,nCurCol=0; bool bOpenString=false; - xub_StrLen nTextStart = 0; - xub_StrLen nSubSupStartPos = 0; - xub_StrLen nLastTemplateBracket=STRING_NOTFOUND; + sal_Int32 nTextStart = 0; + sal_Int32 nSubSupStartPos = 0; + sal_Int32 nLastTemplateBracket=STRING_NOTFOUND; do { @@ -687,24 +685,24 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if ((nRecord == CHAR) && (!bIsSilent) && (!bOpenString)) { bOpenString=true; - nTextStart = rRet.Len(); + nTextStart = rRet.getLength(); } else if ((nRecord != CHAR) && (bOpenString)) { bOpenString=false; - if ((rRet.Len() - nTextStart) > 1) + if ((rRet.getLength() - nTextStart) > 1) { - String aStr; + OUString aStr; TypeFaceToString(aStr,nTypeFace); - aStr += '\"'; - rRet.Insert(aStr,nTextStart); - rRet += '\"'; + aStr += "\""; + rRet = rRet.replaceAt(nTextStart,0,aStr); + rRet += "\""; } - else if (nRecord == END && rRet.Len() > 0) + else if (nRecord == END && !rRet.isEmpty()) { sal_Unicode cChar = 0; - xub_StrLen nI = rRet.Len()-1; - while (nI && ((cChar = rRet.GetChar(nI)) == ' ')) + sal_Int32 nI = rRet.getLength()-1; + while (nI && ((cChar = rRet[nI]) == ' ')) --nI; if ((cChar == '=') || (cChar == '+') || (cChar == '-')) rRet += "{}"; @@ -792,7 +790,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, { rRet += " nroot"; sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } rRet += " {"; @@ -807,7 +805,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, rRet += " {"; break; case 0xf: - nSubSupStartPos = rRet.Len(); + nSubSupStartPos = rRet.getLength(); if ((nVariation == 0) || ((nVariation == 2) && (nPart==1))) { @@ -876,7 +874,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if ( (nVariation != 0) && (nVariation != 3)) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } if (((nVariation == 1) || @@ -898,7 +896,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if ( (nVariation != 0) && (nVariation != 2)) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } if (((nVariation == 1) || @@ -916,7 +914,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if ( (nVariation != 0) && (nVariation != 2)) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } if (((nVariation == 1) || @@ -932,7 +930,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, else rRet += " Int"; sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if (((nVariation == 1) || (nVariation == 2)) && (nPart==1)) @@ -951,7 +949,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, else rRet += " iInt"; sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if (nPart==1) rRet += " cSub"; @@ -965,7 +963,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, else rRet += " iiInt"; sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if (nPart==1) rRet += " cSub"; @@ -982,7 +980,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nVariation != 2) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } if ((nVariation == 0) && (nPart==1)) @@ -998,7 +996,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, { rRet += " Sum"; sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if ((nVariation == 0) && (nPart==1)) rRet += " rSub"; @@ -1015,7 +1013,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nVariation != 2) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } if ((nVariation == 0) && (nPart==1)) @@ -1031,7 +1029,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, { rRet += " Prod"; sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if ((nVariation == 0) && (nPart==1)) rRet += " rSub"; @@ -1048,7 +1046,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nVariation != 2) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } if ((nVariation == 0) && (nPart==1)) @@ -1064,7 +1062,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, { rRet += " coProd"; sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if ((nVariation == 0) && (nPart==1)) rRet += " rSub"; @@ -1081,7 +1079,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nVariation != 2) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } if ((nVariation == 0) && (nPart==1)) @@ -1097,7 +1095,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, { rRet += " union"; //union sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if ((nVariation == 0) && (nPart==1)) rRet += " rSub"; @@ -1114,7 +1112,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nVariation != 2) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } if ((nVariation == 0) && (nPart==1)) @@ -1130,7 +1128,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, { rRet += " intersect"; //intersect sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if ((nVariation == 0) && (nPart==1)) rRet += " rSub"; @@ -1157,7 +1155,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nPart == 0) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } } rRet += " {"; @@ -1178,7 +1176,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nPart == 0) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if ((nVariation == 0) && (nPart==0)) rRet += " rSup"; @@ -1194,7 +1192,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nPart == 0) { sPush = rRet; - rRet.Erase(); + rRet = OUString(); } if ((nVariation == 0) && (nPart==0)) rRet += " cSup"; @@ -1256,17 +1254,17 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, break; } sal_Int16 nOldCurSize=nCurSize; - xub_StrLen nSizeStartPos = rRet.Len(); + sal_Int32 nSizeStartPos = rRet.getLength(); HandleSize(nLSize,nDSize,nSetSize); nRet = HandleRecords(nLevel+1); while (nSetSize) { bool bOk=false; - xub_StrLen nI = rRet.SearchBackward('{'); + sal_Int32 nI = rRet.lastIndexOf('{'); if (nI != STRING_NOTFOUND) { - for(nI=nI+1;nI<rRet.Len();nI++) - if (rRet.GetChar(nI) != ' ') + for(nI=nI+1;nI<rRet.getLength();nI++) + if (rRet[nI] != ' ') { bOk=true; break; @@ -1278,7 +1276,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (bOk) rRet += "} "; else - rRet.Erase(nSizeStartPos); + rRet = rRet.replaceAt( nSizeStartPos, rRet.getLength(), "" ); nSetSize--; nCurSize=nOldCurSize; } @@ -1353,7 +1351,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, { newline--; sMainTerm = rRet; - rRet.Erase(); + rRet = OUString(); } else { @@ -1387,11 +1385,11 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, newline--; bool bOk=false; - xub_StrLen nI = rRet.SearchBackward('{'); + sal_Int32 nI = rRet.lastIndexOf('{'); if (nI != STRING_NOTFOUND) { - for(nI=nI+1;nI<rRet.Len();nI++) - if (rRet.GetChar(nI) != ' ') + for(nI=nI+1;nI<rRet.getLength();nI++) + if (rRet[nI] != ' ') { bOk=true; break; @@ -1403,7 +1401,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (bOk) rRet += "} "; else - rRet.Erase(nSubSupStartPos); + rRet = rRet.replaceAt(nSubSupStartPos, rRet.getLength(), ""); nPart++; } break; @@ -1466,7 +1464,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nPart == 0) { sMainTerm = rRet; - rRet.Erase(); + rRet = OUString(); } else { @@ -1513,7 +1511,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nVariation != 2) { sMainTerm = rRet; - rRet.Erase(); + rRet = OUString(); } newline--; } @@ -1542,7 +1540,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if ((nVariation != 0) && (nVariation != 3)) { sMainTerm = rRet; - rRet.Erase(); + rRet = OUString(); } newline--; } @@ -1573,7 +1571,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if ((nVariation != 0) && (nVariation != 2)) { sMainTerm = rRet; - rRet.Erase(); + rRet = OUString(); } newline--; } @@ -1592,7 +1590,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nPart == 0) { sMainTerm = rRet; - rRet.Erase(); + rRet = OUString(); newline--; } else if ((nPart == 1) && @@ -1620,7 +1618,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, if (nPart == 0) { sMainTerm = rRet; - rRet.Erase(); + rRet = OUString(); newline--; } else if (nPart == 1) @@ -1640,7 +1638,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, ((nVariation == 0) || (nVariation == 1))) { sMainTerm = rRet; - rRet.Erase(); + rRet = OUString(); newline--; } else if ((nPart == 0) && (nVariation == 2)) @@ -1648,7 +1646,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, else if ((nPart == 1) && (nVariation == 2)) { sMainTerm = rRet; - rRet.Erase(); + rRet = OUString(); newline--; } else if ((nPart == 2) || ((((nPart == 1) && @@ -1771,7 +1769,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, while (nRecord != END && !pS->IsEof()); while (nSetSize) { - rRet += '}'; + rRet += "}"; nSetSize--; } return nRet; @@ -1805,7 +1803,7 @@ void MathType::HandleMatrixSeparator(int nMatrixRows,int nMatrixCols, if (nMatrixRows!=-1) rCurCol++; else - rRet += '\n'; + rRet += "\n"; } } } @@ -1842,7 +1840,7 @@ sal_Bool MathType::HandleSize(sal_Int16 nLstSize,sal_Int16 nDefSize, int &rSetSi if (rSetSize) { rSetSize--; - rRet += '}'; + rRet += "}"; bRet=true; } if (-nLstSize/32 != nLastSize) @@ -1850,7 +1848,7 @@ sal_Bool MathType::HandleSize(sal_Int16 nLstSize,sal_Int16 nDefSize, int &rSetSi nLastSize = nCurSize; rRet += " size "; rRet += OUString::number(-nLstSize/32); - rRet += '{'; + rRet += "{"; bRet=true; rSetSize++; } @@ -1871,7 +1869,7 @@ sal_Bool MathType::HandleSize(sal_Int16 nLstSize,sal_Int16 nDefSize, int &rSetSi if (rSetSize) { rSetSize--; - rRet += '}'; + rRet += "}"; bRet=true; } if (nLstSize != nLastSize) @@ -1879,7 +1877,7 @@ sal_Bool MathType::HandleSize(sal_Int16 nLstSize,sal_Int16 nDefSize, int &rSetSi nLastSize = nCurSize; rRet += " size "; rRet += OUString::number(nLstSize); - rRet += '{'; + rRet += "{"; bRet=true; rSetSize++; } @@ -2664,7 +2662,7 @@ int MathType::HandlePile(int &rSetAlign,int nLevel,sal_uInt8 nSelector, rRet += " stack {\n"; int nRet = HandleRecords(nLevel+1,nSelector,nVariation,-1,-1); - rRet.Erase(rRet.Len()-3,2); + rRet = rRet.replaceAt(rRet.getLength()-3,2,""); rRet += "} "; while (rSetAlign) @@ -2695,9 +2693,9 @@ int MathType::HandleMatrix(int nLevel,sal_uInt8 nSelector, rRet += " matrix {\n"; int nRet = HandleRecords(nLevel+1,nSelector,nVariation,nRows,nCols); - xub_StrLen nI = rRet.SearchBackward('#'); + sal_Int32 nI = rRet.lastIndexOf('#'); if ((nI != STRING_NOTFOUND) && (nI > 0)) - if (rRet.GetChar(nI-1) != '#') //missing column + if (rRet[nI-1] != '#') //missing column rRet += "{}"; rRet += "\n} "; @@ -2705,7 +2703,7 @@ int MathType::HandleMatrix(int nLevel,sal_uInt8 nSelector, } int MathType::HandleTemplate(int nLevel,sal_uInt8 &rSelector, - sal_uInt8 &rVariation, xub_StrLen &rLastTemplateBracket) + sal_uInt8 &rVariation, sal_Int32 &rLastTemplateBracket) { sal_uInt8 nOption; //This appears utterly unused *pS >> rSelector; @@ -2728,8 +2726,8 @@ int MathType::HandleTemplate(int nLevel,sal_uInt8 &rSelector, if ( (rSelector == 0xf) && (rLastTemplateBracket != STRING_NOTFOUND) ) { bRemove=true; - for (xub_StrLen nI = rLastTemplateBracket+1; nI < rRet.Len(); nI++ ) - if (rRet.GetChar(nI) != ' ') + for (sal_Int32 nI = rLastTemplateBracket+1; nI < rRet.getLength(); nI++ ) + if (rRet[nI] != ' ') { bRemove=false; break; @@ -2741,12 +2739,12 @@ int MathType::HandleTemplate(int nLevel,sal_uInt8 &rSelector, if (bRemove) { - rRet.Erase(rLastTemplateBracket,1); + rRet = rRet.replaceAt(rLastTemplateBracket,1,""); rRet += "} "; rLastTemplateBracket = STRING_NOTFOUND; } if (rSelector == 0xf) - rLastTemplateBracket = rRet.SearchBackward('}'); + rLastTemplateBracket = rRet.lastIndexOf('}'); else rLastTemplateBracket = STRING_NOTFOUND; @@ -2772,30 +2770,30 @@ void MathType::HandleEmblishments() rRet += " dddot "; break; case 0x05: - if (nPostSup == 0) + if (!nPostSup) { sPost += " sup {}"; - nPostSup = sPost.Len(); + nPostSup = sPost.getLength(); } - sPost.InsertAscii(" ' ",nPostSup-1); + sPost = sPost.replaceAt(nPostSup-1,0," ' "); nPostSup += 3; break; case 0x06: - if (nPostSup == 0) + if (!nPostSup) { sPost += " sup {}"; - nPostSup = sPost.Len(); + nPostSup = sPost.getLength(); } - sPost.InsertAscii(" '' ",nPostSup-1); + sPost = sPost.replaceAt(nPostSup-1,0," '' "); nPostSup += 4; break; case 0x07: - if (nPostlSup == 0) + if (!nPostlSup) { sPost += " lsup {}"; - nPostlSup = sPost.Len(); + nPostlSup = sPost.getLength(); } - sPost.InsertAscii(" ' ",nPostlSup-1); + sPost = sPost.replaceAt(nPostlSup-1,0," ' "); nPostlSup += 3; break; case 0x08: @@ -2814,12 +2812,12 @@ void MathType::HandleEmblishments() rRet += " bar "; break; case 0x12: - if (nPostSup == 0) + if (!nPostSup) { sPost += " sup {}"; - nPostSup = sPost.Len(); + nPostSup = sPost.getLength(); } - sPost.InsertAscii(" ''' ",nPostSup-1); + sPost = sPost.replaceAt(nPostSup-1,0," ''' "); nPostSup += 5; break; case 0x14: @@ -2857,7 +2855,7 @@ void MathType::HandleSetSize() } } -int MathType::HandleChar(xub_StrLen &rTextStart,int &rSetSize,int nLevel, +int MathType::HandleChar(sal_Int32 &rTextStart,int &rSetSize,int nLevel, sal_uInt8 nTag,sal_uInt8 nSelector,sal_uInt8 nVariation, sal_Bool bSilent) { sal_Unicode nChar; @@ -2897,36 +2895,35 @@ int MathType::HandleChar(xub_StrLen &rTextStart,int &rSetSize,int nLevel, //follows the char and nPostSup and nPostlSup are the //indexes at which this class of emblishment is //collated together - sPost.Erase(); + sPost = OUString(); nPostSup = nPostlSup = 0; - int nOriglen=rRet.Len()-rTextStart; + int nOriglen=rRet.getLength()-rTextStart; rRet += " {"; // #i24340# make what would be "vec {A}_n" become "{vec {A}}_n" if ((!bSilent) && ((nOriglen) > 1)) - rRet += '\"'; + rRet += "\""; nRet = HandleRecords(nLevel+1,nSelector,nVariation); if (!bSilent) { if (nOriglen > 1) { - String aStr; + OUString aStr; TypeFaceToString(aStr,nOldTypeFace); - aStr += '\"'; - rRet.Insert(aStr,rTextStart); + aStr += "\""; + rRet.replaceAt(rTextStart,0,aStr); - aStr.Erase(); + aStr = OUString(); TypeFaceToString(aStr,nTypeFace); - rRet.Append(aStr); - rRet += '{'; + rRet += aStr + "{"; } else rRet += " {"; - rTextStart = rRet.Len(); + rTextStart = rRet.getLength(); } } if (!bSilent) { - xub_StrLen nOldLen = rRet.Len(); + sal_Int32 nOldLen = rRet.getLength(); if ( HandleSize(nLSize,nDSize,rSetSize) || (nOldTypeFace != nTypeFace) @@ -2934,36 +2931,34 @@ int MathType::HandleChar(xub_StrLen &rTextStart,int &rSetSize,int nLevel, { if ((nOldLen - rTextStart) > 1) { - rRet.InsertAscii("\"",nOldLen); - String aStr; + rRet = rRet.replaceAt(nOldLen, 0, "\""); + OUString aStr; TypeFaceToString(aStr,nOldTypeFace); - aStr += '\"'; - rRet.Insert(aStr,rTextStart); + aStr += "\""; + rRet = rRet.replaceAt(rTextStart,0,aStr); } - rTextStart = rRet.Len(); + rTextStart = rRet.getLength(); } - nOldLen = rRet.Len(); + nOldLen = rRet.getLength(); if (!LookupChar(nChar,rRet,nVersion,nTypeFace)) { if (nOldLen - rTextStart > 1) { - rRet.InsertAscii("\"",nOldLen); - String aStr; + rRet = rRet.replaceAt(nOldLen,0,"\""); + OUString aStr; TypeFaceToString(aStr,nOldTypeFace); - aStr += '\"'; - rRet.Insert(aStr,rTextStart); + aStr += "\""; + rRet = rRet.replaceAt(rTextStart, 0, aStr); } - rTextStart = rRet.Len(); + rTextStart = rRet.getLength(); } lcl_PrependDummyTerm(rRet, rTextStart); } if ((xfEMBELL(nTag)) && (!bSilent)) { - rRet += '}'; // #i24340# make what would be "vec {A}_n" become "{vec {A}}_n" - rRet += '}'; - rRet += sPost; - rTextStart = rRet.Len(); + rRet += "}}" + sPost; // #i24340# make what would be "vec {A}_n" become "{vec {A}}_n" + rTextStart = rRet.getLength(); } return nRet; } diff --git a/starmath/source/mathtype.hxx b/starmath/source/mathtype.hxx index 0d3e298ea66f..055b6e022973 100644 --- a/starmath/source/mathtype.hxx +++ b/starmath/source/mathtype.hxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #ifndef MATHTYPE_HXX +#ifndef MATHTYPE_HXX #define MATHTYPE_HXX #include "node.hxx" @@ -36,7 +36,7 @@ public: sal_uInt8 nStyle; MathTypeFont() : nTface(0),nStyle(0) {} MathTypeFont(sal_uInt8 nFace) : nTface(nFace),nStyle(0) {} - void AppendStyleToText(String &rS); + void AppendStyleToText(OUString &rS); }; struct LessMathTypeFont @@ -53,7 +53,7 @@ typedef ::std::set< MathTypeFont, LessMathTypeFont > MathTypeFontSet; class MathType { public: - MathType(String &rIn) : + MathType(OUString &rIn) : rRet(rIn), nHAlign(0), nVAlign(0), nDefaultSize(12), nLSize(0), nDSize(0), nCurSize(0), nLastSize(0), bIsSilent(sal_False), nTypeFace(0) @@ -61,7 +61,7 @@ public: Init(); } - MathType(String &rIn,SmNode *pIn) : + MathType(OUString &rIn,SmNode *pIn) : rRet(rIn), pTree(pIn), nHAlign(2), nVAlign(0), nInsertion(0), nDefaultSize(12), nLSize(0), nDSize(0), nCurSize(0), nLastSize(0), nSpec(0), bIsSilent(sal_False), nTypeFace(0) @@ -94,10 +94,10 @@ private: void HandleMatrixSeparator(int nMatrixRows,int nMatrixCols,int &rCurCol, int &rCurRow); int HandleTemplate(int nLevel,sal_uInt8 &rSelector,sal_uInt8 &rVariation, - xub_StrLen &rLastTemplateBracket); + sal_Int32 &rLastTemplateBracket); void HandleEmblishments(); void HandleSetSize(); - int HandleChar(xub_StrLen &rTextStart,int &rSetSize,int nLevel, + int HandleChar(sal_Int32 &rTextStart,int &rSetSize,int nLevel, sal_uInt8 nTag,sal_uInt8 nSelector,sal_uInt8 nVariation, sal_Bool bSilent); void HandleNudge(); @@ -126,9 +126,9 @@ private: void HandleMath(SmNode *pNode,int nLevel); void HandleText(SmNode *pNode,int nLevel); void HandleAttributes(SmNode *pNode,int nLevel); - void TypeFaceToString(String &rRet,sal_uInt8 nFace); + void TypeFaceToString(OUString &rRet,sal_uInt8 nFace); - String &rRet; + OUString &rRet; SmNode *pTree; sal_uInt8 nHAlign; @@ -144,10 +144,10 @@ private: sal_Int16 nCurSize; sal_Int16 nLastSize; sal_uInt8 nSpec; - sal_Bool bIsSilent, bIsReInterpBrace; - String sPost; - xub_StrLen nPostSup; - xub_StrLen nPostlSup; + sal_Bool bIsSilent, bIsReInterpBrace; + OUString sPost; + sal_Int32 nPostSup; + sal_Int32 nPostlSup; sal_uInt8 nTypeFace; MathTypeFontSet aUserStyles; @@ -160,7 +160,7 @@ private: tmDSINT,tmTSINT,tmUHBRACE,tmLHBRACE,tmSUM }; public: - static sal_Bool LookupChar(sal_Unicode nChar,String &rRet, + static sal_Bool LookupChar(sal_Unicode nChar,OUString &rRet, sal_uInt8 nVersion=3,sal_uInt8 nTypeFace=0); }; diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index e69ed2c1cb35..84571474d349 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -422,12 +422,12 @@ void SmNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) pNode->Arrange(rDev, rFormat); } -void SmNode::CreateTextFromNode(String &rText) +void SmNode::CreateTextFromNode(OUString &rText) { SmNode *pNode; sal_uInt16 nSize = GetNumSubNodes(); if (nSize > 1) - rText.Append('{'); + rText += "{"; for (sal_uInt16 i = 0; i < nSize; i++) if (NULL != (pNode = GetSubNode(i))) pNode->CreateTextFromNode(rText); @@ -790,21 +790,21 @@ void SmGraphicNode::GetAccessibleText( OUStringBuffer &rText ) const /////////////////////////////////////////////////////////////////////////// -void SmExpressionNode::CreateTextFromNode(String &rText) +void SmExpressionNode::CreateTextFromNode(OUString &rText) { SmNode *pNode; sal_uInt16 nSize = GetNumSubNodes(); if (nSize > 1) - rText.Append('{'); + rText += "{"; for (sal_uInt16 i = 0; i < nSize; i++) if (NULL != (pNode = GetSubNode(i))) { pNode->CreateTextFromNode(rText); //Just a bit of foo to make unary +asd -asd +-asd -+asd look nice if (pNode->GetType() == NMATH) - if ((nSize != 2) || ((rText.GetChar(rText.Len()-1) != '+') && - (rText.GetChar(rText.Len()-1) != '-'))) - rText.Append(' '); + if ((nSize != 2) || ((rText[rText.getLength()-1] != '+') && + (rText[rText.getLength()-1] != '-'))) + rText += " "; } if (nSize > 1) @@ -1095,7 +1095,7 @@ void SmRootNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) } -void SmRootNode::CreateTextFromNode(String &rText) +void SmRootNode::CreateTextFromNode(OUString &rText) { SmNode *pExtra = GetSubNode(0); if (pExtra) @@ -1208,7 +1208,7 @@ void SmBinVerNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) ExtendBy(*pDenom, RCP_NONE).ExtendBy(*pLine, RCP_NONE, pLine->GetCenterY()); } -void SmBinVerNode::CreateTextFromNode(String &rText) +void SmBinVerNode::CreateTextFromNode(OUString &rText) { SmNode *pNum = GetSubNode(0), *pDenom = GetSubNode(2); @@ -1594,7 +1594,7 @@ void SmSubSupNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) } } -void SmSubSupNode::CreateTextFromNode(String &rText) +void SmSubSupNode::CreateTextFromNode(OUString &rText) { SmNode *pNode; GetSubNode(0)->CreateTextFromNode(rText); @@ -1622,13 +1622,13 @@ void SmSubSupNode::CreateTextFromNode(String &rText) if (NULL != (pNode = GetSubNode(RSUB+1))) { rText = comphelper::string::stripEnd(rText, ' '); - rText.Append('_'); + rText += "_"; pNode->CreateTextFromNode(rText); } if (NULL != (pNode = GetSubNode(RSUP+1))) { rText = comphelper::string::stripEnd(rText, ' '); - rText.Append('^'); + rText += "^"; pNode->CreateTextFromNode(rText); } } @@ -1636,26 +1636,26 @@ void SmSubSupNode::CreateTextFromNode(String &rText) /**************************************************************************/ -void SmBraceNode::CreateTextFromNode(String &rText) +void SmBraceNode::CreateTextFromNode(OUString &rText) { if (GetScaleMode() == SCALE_HEIGHT) rText += "left "; { - String aStr; + OUString aStr; GetSubNode(0)->CreateTextFromNode(aStr); aStr = comphelper::string::strip(aStr, ' '); aStr = comphelper::string::stripStart(aStr, '\\'); - if (aStr.Len()) + if (!aStr.isEmpty()) { - if (aStr.EqualsAscii("divides")) + if (aStr.equalsAscii("divides")) rText += "lline"; - else if (aStr.EqualsAscii("parallel")) + else if (aStr.equalsAscii("parallel")) rText += "ldline"; - else if (aStr.EqualsAscii("<")) + else if (aStr.equalsAscii("<")) rText += "langle"; else - rText.Append(aStr); - rText.Append(' '); + rText += aStr; + rText += " "; } else rText += "none "; @@ -1664,26 +1664,26 @@ void SmBraceNode::CreateTextFromNode(String &rText) if (GetScaleMode() == SCALE_HEIGHT) rText += "right "; { - String aStr; + OUString aStr; GetSubNode(2)->CreateTextFromNode(aStr); aStr = comphelper::string::strip(aStr, ' '); aStr = comphelper::string::stripStart(aStr, '\\'); - if (aStr.Len()) + if (!aStr.isEmpty()) { - if (aStr.EqualsAscii("divides")) + if (aStr.equalsAscii("divides")) rText += "rline"; - else if (aStr.EqualsAscii("parallel")) + else if (aStr.equalsAscii("parallel")) rText += "rdline"; - else if (aStr.EqualsAscii(">")) + else if (aStr.equalsAscii(">")) rText += "rangle"; else - rText.Append(aStr); - rText.Append(' '); + rText += aStr; + rText += " "; } else rText += "none "; } - rText.Append(' '); + rText += " "; } @@ -2048,7 +2048,7 @@ void SmAttributNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) -void SmFontNode::CreateTextFromNode(String &rText) +void SmFontNode::CreateTextFromNode(OUString &rText) { switch (GetToken().eType) { @@ -2073,26 +2073,26 @@ void SmFontNode::CreateTextFromNode(String &rText) switch (nSizeType) { case FNTSIZ_PLUS: - rText.Append('+'); + rText += "+"; break; case FNTSIZ_MINUS: - rText.Append('-'); + rText += "-"; break; case FNTSIZ_MULTIPLY: - rText.Append('*'); + rText += "*'"; break; case FNTSIZ_DIVIDE: - rText.Append('/'); + rText += "/"; break; case FNTSIZ_ABSOLUT: default: break; } - rText += String( ::rtl::math::doubleToUString( + rText += ::rtl::math::doubleToUString( static_cast<double>(aFontSize), rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', sal_True)); - rText.Append(' '); + rtl_math_DecimalPlaces_Max, '.', sal_True); + rText += " "; } break; case TBLACK: @@ -2383,12 +2383,12 @@ void SmTextNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) SmRect::operator = (SmRect(aTmpDev, &rFormat, aText, GetFont().GetBorderWidth())); } -void SmTextNode::CreateTextFromNode(String &rText) +void SmTextNode::CreateTextFromNode(OUString &rText) { bool bQuoted=false; if (GetToken().eType == TTEXT) { - rText.Append('\"'); + rText += "\""; bQuoted=true; } else @@ -2423,15 +2423,15 @@ void SmTextNode::CreateTextFromNode(String &rText) rText += "italic "; if (bQuoted) - rText.Append('\"'); + rText += "\""; } - rText.Append(GetToken().aText); + rText += GetToken().aText; if (bQuoted) - rText.Append('\"'); - rText.Append(' '); + rText += "\""; + rText += " "; } @@ -2506,7 +2506,7 @@ sal_Unicode SmTextNode::ConvertSymbolToUnicode(sal_Unicode nIn) /**************************************************************************/ -void SmMatrixNode::CreateTextFromNode(String &rText) +void SmMatrixNode::CreateTextFromNode(OUString &rText) { rText += "matrix {"; for (sal_uInt16 i = 0; i < nNumRows; i++) @@ -2744,14 +2744,14 @@ void SmMathSymbolNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat SmRect::operator = (SmRect(aTmpDev, &rFormat, rText, GetFont().GetBorderWidth())); } -void SmMathSymbolNode::CreateTextFromNode(String &rText) +void SmMathSymbolNode::CreateTextFromNode(OUString &rText) { - String sStr; + OUString sStr; MathType::LookupChar(GetToken().cMathChar, sStr); - rText.Append(sStr); + rText += sStr; } -void SmRectangleNode::CreateTextFromNode(String &rText) +void SmRectangleNode::CreateTextFromNode(OUString &rText) { switch (GetToken().eType) { @@ -2769,22 +2769,22 @@ void SmRectangleNode::CreateTextFromNode(String &rText) } } -void SmAttributNode::CreateTextFromNode(String &rText) +void SmAttributNode::CreateTextFromNode(OUString &rText) { SmNode *pNode; sal_uInt16 nSize = GetNumSubNodes(); OSL_ENSURE(nSize == 2, "Node missing members"); - rText.Append('{'); + rText += "{"; sal_Unicode nLast=0; if (NULL != (pNode = GetSubNode(0))) { - String aStr; + OUString aStr; pNode->CreateTextFromNode(aStr); - if (aStr.Len() > 1) - rText.Append(aStr); + if (aStr.getLength() > 1) + rText += aStr; else { - nLast = aStr.GetChar(0); + nLast = aStr[0]; switch (nLast) { case MS_BAR: // MACRON @@ -2841,7 +2841,7 @@ void SmAttributNode::CreateTextFromNode(String &rText) rText += "bar "; break; default: - rText.Append(nLast); + rText += OUString( nLast ); break; } } |