diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-11-20 23:20:20 +0400 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-11-21 18:21:59 +0400 |
commit | 45ccace028a4ad40fdbaffad050741db583259c9 (patch) | |
tree | 004f8175ae01402ce0e7d3ac37ca59499d2f2624 /starmath | |
parent | 7119a76da2f35fbfae65d3b71caec08d64700714 (diff) |
String -> OUString
Change-Id: I23e0181c1aefc9efbac81216a18cdd7042a7679e
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/parse.hxx | 2 | ||||
-rw-r--r-- | starmath/source/cursor.cxx | 16 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 19 | ||||
-rw-r--r-- | starmath/source/node.cxx | 6 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 92 | ||||
-rw-r--r-- | starmath/source/view.cxx | 2 |
6 files changed, 67 insertions, 70 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index e3a8d23c5154..d5affc7e84f0 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -111,7 +111,7 @@ enum SmTokenType struct SmToken { - String aText; // token text + OUString aText; // token text SmTokenType eType; // token info sal_Unicode cMathChar; diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 8ba0529bf2cf..4c91b8a2b26a 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -1022,7 +1022,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ { SmToken token; token.nGroup = TGBLANK; - token.aText.AssignAscii("~"); + token.aText = "~"; pNewNode = new SmBlankNode(token); }break; case FactorialElement: @@ -1037,7 +1037,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ token.cMathChar = MS_PLUS; token.nGroup = TGUNOPER | TGSUM; token.nLevel = 5; - token.aText.AssignAscii("+"); + token.aText = "+"; pNewNode = new SmMathSymbolNode(token); }break; case MinusElement: @@ -1047,7 +1047,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ token.cMathChar = MS_MINUS; token.nGroup = TGUNOPER | TGSUM; token.nLevel = 5; - token.aText.AssignAscii("-"); + token.aText = "-"; pNewNode = new SmMathSymbolNode(token); }break; case CDotElement: @@ -1056,7 +1056,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ token.eType = TCDOT; token.cMathChar = MS_CDOT; token.nGroup = TGPRODUCT; - token.aText.AssignAscii("cdot"); + token.aText = "cdot"; pNewNode = new SmMathSymbolNode(token); }break; case EqualElement: @@ -1065,7 +1065,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ token.eType = TASSIGN; token.cMathChar = MS_ASSIGN; token.nGroup = TGRELATION; - token.aText.AssignAscii("="); + token.aText = "="; pNewNode = new SmMathSymbolNode(token); }break; case LessThanElement: @@ -1074,7 +1074,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ token.eType = TLT; token.cMathChar = MS_LT; token.nGroup = TGRELATION; - token.aText.AssignAscii("<"); + token.aText = "<"; pNewNode = new SmMathSymbolNode(token); }break; case GreaterThanElement: @@ -1083,7 +1083,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ token.eType = TGT; token.cMathChar = MS_GT; token.nGroup = TGRELATION; - token.aText.AssignAscii(">"); + token.aText = ">"; pNewNode = new SmMathSymbolNode(token); }break; case PercentElement: @@ -1092,7 +1092,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ token.eType = TTEXT; token.cMathChar = MS_PERCENT; token.nGroup = 0; - token.aText.AssignAscii("\"%\""); + token.aText = "\"%\""; pNewNode = new SmMathSymbolNode(token); }break; default: diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index b63eab5a36a4..6bc1b936ed4a 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -1032,7 +1032,7 @@ void SmXMLFencedContext_Impl::EndElement() SmToken aToken; aToken.cMathChar = '\0'; aToken.nGroup = 0; - aToken.aText = ','; + aToken.aText = ","; aToken.eType = TLEFT; aToken.nLevel = 5; @@ -1049,7 +1049,7 @@ void SmXMLFencedContext_Impl::EndElement() SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); aToken.cMathChar = '\0'; - aToken.aText = ','; + aToken.aText = ","; aToken.eType = TIDENT; sal_uLong i = rNodeStack.size() - nElementCount; @@ -1252,10 +1252,7 @@ void SmXMLStringContext_Impl::TCharacters(const OUString &rChars) Obviously this isn't fully done here. */ - aToken.aText.Erase(); - aToken.aText += '\"'; - aToken.aText += String(rChars); - aToken.aText += '\"'; + aToken.aText = "\"" + rChars + "\""; } void SmXMLStringContext_Impl::EndElement() @@ -1295,8 +1292,8 @@ void SmXMLIdentifierContext_Impl::EndElement() SmTextNode *pNode = 0; //we will handle identifier italic/normal here instead of with a standalone //font node - if (((aStyleHelper.nIsItalic == -1) && (aToken.aText.Len() > 1)) - || ((aStyleHelper.nIsItalic == 0) && (aToken.aText.Len() == 1))) + if (((aStyleHelper.nIsItalic == -1) && (aToken.aText.getLength() > 1)) + || ((aStyleHelper.nIsItalic == 0) && (aToken.aText.getLength() == 1))) { pNode = new SmTextNode(aToken,FNT_FUNCTION); pNode->GetFont().SetItalic(ITALIC_NONE); @@ -1712,7 +1709,7 @@ void SmXMLNoneContext_Impl::EndElement(void) SmToken aToken; aToken.cMathChar = '\0'; aToken.nGroup = 0; - aToken.aText.Erase(); + aToken.aText = ""; aToken.nLevel = 5; aToken.eType = TIDENT; GetSmImport().GetNodeStack().push( @@ -2491,11 +2488,11 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript) SmNode *pScriptNode = lcl_popOrZero(aReverseStack); if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) || - (pScriptNode->GetToken().aText.Len()))) + (!pScriptNode->GetToken().aText.isEmpty()))) aSubNodes[eSub+1] = pScriptNode; pScriptNode = lcl_popOrZero(aReverseStack); if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) || - (pScriptNode->GetToken().aText.Len()))) + (!pScriptNode->GetToken().aText.isEmpty()))) aSubNodes[eSup+1] = pScriptNode; pNode->SetSubNodes(aSubNodes); diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 47adc291a7be..6710666a2c5f 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -462,7 +462,7 @@ const SmNode * SmNode::FindTokenAt(sal_uInt16 nRow, sal_uInt16 nCol) const { if ( IsVisible() && nRow == GetToken().nRow - && nCol >= GetToken().nCol && nCol < GetToken().nCol + GetToken().aText.Len()) + && nCol >= GetToken().nCol && nCol < GetToken().nCol + GetToken().aText.getLength()) return this; else { @@ -2367,7 +2367,7 @@ void SmTextNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell) // special handling for ':' where it is a token on it's own and is likely // to be used for mathematical notations. (E.g. a:b = 2:3) // In that case it should not be displayed in italic. - if (GetToken().aText.Len() == 1 && GetToken().aText.GetChar(0) == ':') + if (GetToken().aText.getLength() == 1 && GetToken().aText[0] == ':') Attributes() &= ~ATTR_ITALIC; }; @@ -2894,7 +2894,7 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell const SmSym *pSym; SmModule *pp = SM_MOD(); - String aName( GetToken().aText.Copy(1) ); + OUString aName(GetToken().aText.copy(1)); if (NULL != (pSym = pp->GetSymbolManager().GetSymbolByName( aName ))) { sal_UCS4 cChar = pSym->GetCharacter(); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 6fcf81712a89..f783c710e259 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -88,7 +88,7 @@ SmToken::SmToken(SmTokenType eTokenType, sal_uInt16 nTokenLevel) { eType = eTokenType; cMathChar = cMath; - aText.AssignAscii(pText); + aText = OUString::createFromAscii(pText); nGroup = nTokenGroup; nLevel = nTokenLevel; nCol = nRow = 0; @@ -491,7 +491,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = '\0'; m_aCurToken.nGroup = 0; m_aCurToken.nLevel = 0; - m_aCurToken.aText.Erase(); + m_aCurToken.aText = ""; } else if ((aRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER)) || (bNumStart && (aRes.TokenType & KParseType::IDENTNAME))) @@ -534,7 +534,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = pEntry->cMathChar; m_aCurToken.nGroup = pEntry->nGroup; m_aCurToken.nLevel = pEntry->nLevel; - m_aCurToken.aText.AssignAscii( pEntry->pIdent ); + m_aCurToken.aText = OUString::createFromAscii( pEntry->pIdent ); } else { @@ -558,7 +558,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = '\0'; m_aCurToken.nGroup = TGPOWER; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "_" ); + m_aCurToken.aText = "_"; aRes.EndPos = nRealStart + 1; } @@ -581,7 +581,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_LL; m_aCurToken.nGroup = TGRELATION; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "<<" ); + m_aCurToken.aText = "<<"; rnEndPos = nRealStart + 2; } @@ -592,7 +592,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_LE; m_aCurToken.nGroup = TGRELATION; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "<=" ); + m_aCurToken.aText = "<="; rnEndPos = nRealStart + 2; } @@ -603,7 +603,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_NEQ; m_aCurToken.nGroup = TGRELATION; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "<>" ); + m_aCurToken.aText = "<>"; rnEndPos = nRealStart + 2; } @@ -614,7 +614,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_PLACE; m_aCurToken.nGroup = 0; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "<?>" ); + m_aCurToken.aText = "<?>"; rnEndPos = nRealStart + 3; } @@ -624,7 +624,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_LT; m_aCurToken.nGroup = TGRELATION; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "<" ); + m_aCurToken.aText = "<"; } } break; @@ -637,7 +637,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_GE; m_aCurToken.nGroup = TGRELATION; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( ">=" ); + m_aCurToken.aText = ">="; rnEndPos = nRealStart + 2; } @@ -648,7 +648,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_GG; m_aCurToken.nGroup = TGRELATION; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( ">>" ); + m_aCurToken.aText = ">>"; rnEndPos = nRealStart + 2; } @@ -658,7 +658,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_GT; m_aCurToken.nGroup = TGRELATION; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( ">" ); + m_aCurToken.aText = ">"; } } break; @@ -734,7 +734,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_LBRACKET; m_aCurToken.nGroup = TGLBRACES; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "[" ); + m_aCurToken.aText = "["; } break; case '\\': @@ -743,7 +743,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = '\0'; m_aCurToken.nGroup = 0; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "\\" ); + m_aCurToken.aText = "\\"; } break; case ']': @@ -752,7 +752,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_RBRACKET; m_aCurToken.nGroup = TGRBRACES; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "]" ); + m_aCurToken.aText = "]"; } break; case '^': @@ -761,7 +761,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = '\0'; m_aCurToken.nGroup = TGPOWER; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "^" ); + m_aCurToken.aText = "^"; } break; case '`': @@ -770,7 +770,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = '\0'; m_aCurToken.nGroup = TGBLANK; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "`" ); + m_aCurToken.aText = "`"; } break; case '{': @@ -779,7 +779,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_LBRACE; m_aCurToken.nGroup = 0; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "{" ); + m_aCurToken.aText = "{"; } break; case '|': @@ -788,7 +788,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_OR; m_aCurToken.nGroup = TGSUM; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "|" ); + m_aCurToken.aText = "|"; } break; case '}': @@ -797,7 +797,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_RBRACE; m_aCurToken.nGroup = 0; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "}" ); + m_aCurToken.aText = "}"; } break; case '~': @@ -806,7 +806,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = '\0'; m_aCurToken.nGroup = TGBLANK; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "~" ); + m_aCurToken.aText = "~"; } break; case '#': @@ -818,7 +818,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = '\0'; m_aCurToken.nGroup = 0; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "##" ); + m_aCurToken.aText = "##"; rnEndPos = nRealStart + 2; } @@ -828,7 +828,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = '\0'; m_aCurToken.nGroup = 0; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "#" ); + m_aCurToken.aText = "#"; } } break; @@ -838,7 +838,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_AND; m_aCurToken.nGroup = TGPRODUCT; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "&" ); + m_aCurToken.aText = "&"; } break; case '(': @@ -847,7 +847,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_LPARENT; m_aCurToken.nGroup = TGLBRACES; m_aCurToken.nLevel = 5; //! 0 to continue expression - m_aCurToken.aText.AssignAscii( "(" ); + m_aCurToken.aText = "("; } break; case ')': @@ -856,7 +856,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_RPARENT; m_aCurToken.nGroup = TGRBRACES; m_aCurToken.nLevel = 0; //! 0 to terminate expression - m_aCurToken.aText.AssignAscii( ")" ); + m_aCurToken.aText = ")"; } break; case '*': @@ -865,7 +865,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_MULTIPLY; m_aCurToken.nGroup = TGPRODUCT; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "*" ); + m_aCurToken.aText = "*"; } break; case '+': @@ -877,7 +877,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_PLUSMINUS; m_aCurToken.nGroup = TGUNOPER | TGSUM; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "+-" ); + m_aCurToken.aText = "+-"; rnEndPos = nRealStart + 2; } @@ -887,7 +887,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_PLUS; m_aCurToken.nGroup = TGUNOPER | TGSUM; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "+" ); + m_aCurToken.aText = "+"; } } break; @@ -900,7 +900,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_MINUSPLUS; m_aCurToken.nGroup = TGUNOPER | TGSUM; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "-+" ); + m_aCurToken.aText = "-+"; rnEndPos = nRealStart + 2; } @@ -910,7 +910,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_MINUS; m_aCurToken.nGroup = TGUNOPER | TGSUM; m_aCurToken.nLevel = 5; - m_aCurToken.aText.AssignAscii( "-" ); + m_aCurToken.aText = "-"; } } break; @@ -943,7 +943,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_SLASH; m_aCurToken.nGroup = TGPRODUCT; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "/" ); + m_aCurToken.aText = "/"; } break; case '=': @@ -952,7 +952,7 @@ void SmParser::NextToken() m_aCurToken.cMathChar = MS_ASSIGN; m_aCurToken.nGroup = TGRELATION; m_aCurToken.nLevel = 0; - m_aCurToken.aText.AssignAscii( "=" ); + m_aCurToken.aText = "="; } break; default: @@ -1036,7 +1036,7 @@ void SmParser::Align() if (TokenInGroup(TGDISCARDED) || pSNode) { m_nBufferIndex = GetTokenIndex(); - m_aBufferString.Erase(m_nBufferIndex, m_aCurToken.aText.Len()); + m_aBufferString.Erase(m_nBufferIndex, m_aCurToken.aText.getLength()); } else pSNode = new SmAlignNode(m_aCurToken); @@ -1673,7 +1673,7 @@ void SmParser::Oper() break; } if( pLim ) - m_aCurToken.aText.AssignAscii( pLim ); + m_aCurToken.aText = OUString::createFromAscii(pLim); pNode = new SmTextNode(m_aCurToken, FNT_TEXT); } break; @@ -2314,31 +2314,31 @@ void SmParser::Matrix() void SmParser::Special() { bool bReplace = false; - String &rName = m_aCurToken.aText; - String aNewName; + OUString &rName = m_aCurToken.aText; + OUString aNewName; if (CONVERT_NONE == GetConversion()) { // conversion of symbol names for 6.0 (XML) file format // (name change on import / export. // UI uses localized names XML file format does not.) - if( rName.Len() && rName.GetChar( 0 ) == sal_Unicode( '%' ) ) + if (!rName.isEmpty() && rName[0] == '%') { if (IsImportSymbolNames()) { const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); - aNewName = rLSD.GetUiSymbolName( rName.Copy( 1 ) ); + aNewName = rLSD.GetUiSymbolName(rName.copy(1)); bReplace = true; } else if (IsExportSymbolNames()) { const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); - aNewName = rLSD.GetExportSymbolName( rName.Copy( 1 ) ); + aNewName = rLSD.GetExportSymbolName(rName.copy(1)); bReplace = true; } } - if( aNewName.Len() ) - aNewName.Insert( '%', 0 ); + if (!aNewName.isEmpty()) + aNewName = "%" + aNewName; } else // 5.0 <-> 6.0 formula text (symbol name) conversion { @@ -2375,15 +2375,15 @@ void SmParser::Special() // conversion not necessary } - if (bReplace && aNewName.Len() && rName != aNewName) + if (bReplace && !aNewName.isEmpty() && rName != aNewName) { - Replace( GetTokenIndex(), rName.Len(), aNewName ); + Replace(GetTokenIndex(), rName.getLength(), aNewName); rName = aNewName; } // add symbol name to list of used symbols - const String aSymbolName( m_aCurToken.aText.Copy( 1 ) ); - if (aSymbolName.Len() > 0 ) + const OUString aSymbolName(m_aCurToken.aText.copy(1)); + if (!aSymbolName.isEmpty()) AddToUsedSymbols( aSymbolName ); m_aNodeStack.push(new SmSpecialNode(m_aCurToken)); diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 58e031a8aeed..2c12b3c4cdef 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -187,7 +187,7 @@ void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt) ESelection aSel (aToken.nRow - 1, aToken.nCol - 1); if (rMEvt.GetClicks() != 1 || aToken.eType == TPLACE) - aSel.nEndPos = aSel.nEndPos + sal::static_int_cast< sal_uInt16 >(aToken.aText.Len()); + aSel.nEndPos = aSel.nEndPos + sal::static_int_cast< sal_uInt16 >(aToken.aText.getLength()); pEdit->SetSelection(aSel); SetCursor(pNode); |