summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorIvan Timofeev <timofeev.i.s@gmail.com>2012-09-27 21:07:25 +0400
committerIvan Timofeev <timofeev.i.s@gmail.com>2012-10-01 16:36:48 +0400
commitb03eab3560bb5c8379ae711b41796dec459c20e0 (patch)
tree07bb2e3077a6b2d8477e6c6edc4b050f790582dd /starmath
parent773667483e3991b078eca03568681e2f3e8f4ec9 (diff)
String -> OUString
Change-Id: Icdb39e5b5ba38d48f5cc3a4ae371fb77cb981242
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/visitors.hxx19
-rw-r--r--starmath/qa/cppunit/test_nodetotextvisitors.cxx10
-rw-r--r--starmath/source/cursor.cxx2
-rw-r--r--starmath/source/visitors.cxx6
4 files changed, 19 insertions, 18 deletions
diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx
index 9f792124d1c4..f20379d4df20 100644
--- a/starmath/inc/visitors.hxx
+++ b/starmath/inc/visitors.hxx
@@ -453,11 +453,9 @@ private:
class SmNodeToTextVisitor : public SmVisitor
{
public:
- SmNodeToTextVisitor( SmNode* pNode, String &rText )
- : rCmdText( rText ) {
- pNode->Accept( this );
- }
+ SmNodeToTextVisitor( SmNode* pNode, OUString &rText );
virtual ~SmNodeToTextVisitor() {}
+
void Visit( SmTableNode* pNode );
void Visit( SmBraceNode* pNode );
void Visit( SmBracebodyNode* pNode );
@@ -493,19 +491,16 @@ private:
pNode->Accept( this );
Separate( );
}
- inline void Append( const sal_Char* pCharStr ) {
- rCmdText.AppendAscii( pCharStr );
- }
- inline void Append( const String &rText ) {
- rCmdText.Append( rText );
+ void Append( const OUString &rText ) {
+ aCmdText.append( rText );
}
/** Append a blank for separation, if needed */
inline void Separate( ){
- if( !rCmdText.Len() || rCmdText.GetChar( rCmdText.Len( ) - 1 ) != ' ' )
- rCmdText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " " ) );
+ if( !aCmdText.getLength() || aCmdText[ aCmdText.getLength() - 1 ] != ' ' )
+ aCmdText.append(' ');
}
/** Output text generated from the pNodes */
- String &rCmdText;
+ OUStringBuffer aCmdText;
};
#endif /* SMVISITORS_H */
diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
index 5e24fb04781c..b7e363ca4818 100644
--- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx
+++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
@@ -494,11 +494,11 @@ void Test::SimpleSpecialChars()
*/
void Test::parseandparseagain(const char *formula, const char *test_name)
{
- String input, output1, output2;
+ OUString output1, output2;
SmNode *pNode1, *pNode2;
// parse 1
- input.AppendAscii(formula);
+ OUString input = OUString::createFromAscii(formula);
pNode1 = SmParser().ParseExpression(input);
pNode1->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmNodeToTextVisitor(pNode1, output1);
@@ -519,17 +519,17 @@ void Test::parseandparseagain(const char *formula, const char *test_name)
void Test::ParseAndCheck(const char *formula, const char * expected, const char *test_name)
{
- String sInput, sOutput, sExpected;
+ OUString sOutput;
SmNode *pNode;
// parse
- sInput.AppendAscii(formula);
+ OUString sInput = OUString::createFromAscii(formula);
pNode = SmParser().ParseExpression(sInput);
pNode->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmNodeToTextVisitor(pNode, sOutput);
// compare
- sExpected.AppendAscii(expected);
+ OUString sExpected = OUString::createFromAscii(expected);
CPPUNIT_ASSERT_EQUAL_MESSAGE(test_name,
sExpected,
sOutput);
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 489c339f4d49..de674f491b77 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -1462,7 +1462,7 @@ void SmCursor::EndEdit(){
RequestRepaint();
//Update the edit engine and text of the document
- String formula;
+ OUString formula;
SmNodeToTextVisitor(pTree, formula);
//pTree->CreateTextFromNode(formula);
pDocShell->aText = formula;
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 9c279702d057..f1b835a462ee 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -2117,6 +2117,12 @@ void SmSelectionDrawingVisitor::Visit( SmTextNode* pNode )
/////////////////////////////// SmNodeToTextVisitor ///////////////////////////////
+SmNodeToTextVisitor::SmNodeToTextVisitor( SmNode* pNode, OUString &rText )
+{
+ pNode->Accept( this );
+ rText = aCmdText.makeStringAndClear();
+}
+
void SmNodeToTextVisitor::Visit( SmTableNode* pNode )
{
if( pNode->GetToken( ).eType == TBINOM ) {