Kaydet (Commit) b03eab35 authored tarafından Ivan Timofeev's avatar Ivan Timofeev

String -> OUString

Change-Id: Icdb39e5b5ba38d48f5cc3a4ae371fb77cb981242
üst 77366748
...@@ -453,11 +453,9 @@ private: ...@@ -453,11 +453,9 @@ private:
class SmNodeToTextVisitor : public SmVisitor class SmNodeToTextVisitor : public SmVisitor
{ {
public: public:
SmNodeToTextVisitor( SmNode* pNode, String &rText ) SmNodeToTextVisitor( SmNode* pNode, OUString &rText );
: rCmdText( rText ) {
pNode->Accept( this );
}
virtual ~SmNodeToTextVisitor() {} virtual ~SmNodeToTextVisitor() {}
void Visit( SmTableNode* pNode ); void Visit( SmTableNode* pNode );
void Visit( SmBraceNode* pNode ); void Visit( SmBraceNode* pNode );
void Visit( SmBracebodyNode* pNode ); void Visit( SmBracebodyNode* pNode );
...@@ -493,19 +491,16 @@ private: ...@@ -493,19 +491,16 @@ private:
pNode->Accept( this ); pNode->Accept( this );
Separate( ); Separate( );
} }
inline void Append( const sal_Char* pCharStr ) { void Append( const OUString &rText ) {
rCmdText.AppendAscii( pCharStr ); aCmdText.append( rText );
}
inline void Append( const String &rText ) {
rCmdText.Append( rText );
} }
/** Append a blank for separation, if needed */ /** Append a blank for separation, if needed */
inline void Separate( ){ inline void Separate( ){
if( !rCmdText.Len() || rCmdText.GetChar( rCmdText.Len( ) - 1 ) != ' ' ) if( !aCmdText.getLength() || aCmdText[ aCmdText.getLength() - 1 ] != ' ' )
rCmdText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " " ) ); aCmdText.append(' ');
} }
/** Output text generated from the pNodes */ /** Output text generated from the pNodes */
String &rCmdText; OUStringBuffer aCmdText;
}; };
#endif /* SMVISITORS_H */ #endif /* SMVISITORS_H */
......
...@@ -494,11 +494,11 @@ void Test::SimpleSpecialChars() ...@@ -494,11 +494,11 @@ void Test::SimpleSpecialChars()
*/ */
void Test::parseandparseagain(const char *formula, const char *test_name) void Test::parseandparseagain(const char *formula, const char *test_name)
{ {
String input, output1, output2; OUString output1, output2;
SmNode *pNode1, *pNode2; SmNode *pNode1, *pNode2;
// parse 1 // parse 1
input.AppendAscii(formula); OUString input = OUString::createFromAscii(formula);
pNode1 = SmParser().ParseExpression(input); pNode1 = SmParser().ParseExpression(input);
pNode1->Prepare(xDocShRef->GetFormat(), *xDocShRef); pNode1->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmNodeToTextVisitor(pNode1, output1); SmNodeToTextVisitor(pNode1, output1);
...@@ -519,17 +519,17 @@ void Test::parseandparseagain(const char *formula, const char *test_name) ...@@ -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) void Test::ParseAndCheck(const char *formula, const char * expected, const char *test_name)
{ {
String sInput, sOutput, sExpected; OUString sOutput;
SmNode *pNode; SmNode *pNode;
// parse // parse
sInput.AppendAscii(formula); OUString sInput = OUString::createFromAscii(formula);
pNode = SmParser().ParseExpression(sInput); pNode = SmParser().ParseExpression(sInput);
pNode->Prepare(xDocShRef->GetFormat(), *xDocShRef); pNode->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmNodeToTextVisitor(pNode, sOutput); SmNodeToTextVisitor(pNode, sOutput);
// compare // compare
sExpected.AppendAscii(expected); OUString sExpected = OUString::createFromAscii(expected);
CPPUNIT_ASSERT_EQUAL_MESSAGE(test_name, CPPUNIT_ASSERT_EQUAL_MESSAGE(test_name,
sExpected, sExpected,
sOutput); sOutput);
......
...@@ -1462,7 +1462,7 @@ void SmCursor::EndEdit(){ ...@@ -1462,7 +1462,7 @@ void SmCursor::EndEdit(){
RequestRepaint(); RequestRepaint();
//Update the edit engine and text of the document //Update the edit engine and text of the document
String formula; OUString formula;
SmNodeToTextVisitor(pTree, formula); SmNodeToTextVisitor(pTree, formula);
//pTree->CreateTextFromNode(formula); //pTree->CreateTextFromNode(formula);
pDocShell->aText = formula; pDocShell->aText = formula;
......
...@@ -2117,6 +2117,12 @@ void SmSelectionDrawingVisitor::Visit( SmTextNode* pNode ) ...@@ -2117,6 +2117,12 @@ void SmSelectionDrawingVisitor::Visit( SmTextNode* pNode )
/////////////////////////////// SmNodeToTextVisitor /////////////////////////////// /////////////////////////////// SmNodeToTextVisitor ///////////////////////////////
SmNodeToTextVisitor::SmNodeToTextVisitor( SmNode* pNode, OUString &rText )
{
pNode->Accept( this );
rText = aCmdText.makeStringAndClear();
}
void SmNodeToTextVisitor::Visit( SmTableNode* pNode ) void SmNodeToTextVisitor::Visit( SmTableNode* pNode )
{ {
if( pNode->GetToken( ).eType == TBINOM ) { if( pNode->GetToken( ).eType == TBINOM ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment