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

String -> OUString

Change-Id: Icdb39e5b5ba38d48f5cc3a4ae371fb77cb981242
üst 77366748
......@@ -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 */
......
......@@ -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);
......
......@@ -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;
......
......@@ -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 ) {
......
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