summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorIvan Timofeev <timofeev.i.s@gmail.com>2012-10-28 12:32:29 +0400
committerIvan Timofeev <timofeev.i.s@gmail.com>2012-10-28 12:32:29 +0400
commit8da658bd33b9c781d83c59181a2ff023b163042f (patch)
tree169b9b88fcb0a04f04400c170bfd933331fdf7e4 /starmath
parent72258d123467979ea7c4f1ecc029e6fb78907fad (diff)
String -> OUString
Change-Id: I2f0acb27f85a230109e827d415aabc029b90cd45
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/node.hxx4
-rw-r--r--starmath/source/node.cxx10
-rw-r--r--starmath/source/symbol.cxx4
-rw-r--r--starmath/source/view.cxx56
4 files changed, 35 insertions, 39 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index eb706dd86d1d..bfe89022f9a6 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -190,7 +190,7 @@ public:
/** The tree as dot graph for graphviz, usable for debugging
* Convert the output to a image using $ dot graph.gv -Tpng > graph.png
*/
- inline void DumpAsDot(std::ostream &out, String* label = NULL) const{
+ inline void DumpAsDot(std::ostream &out, OUString* label = NULL) const{
int id = 0;
DumpAsDot(out, label, -1, id, -1);
}
@@ -230,7 +230,7 @@ protected:
}
private:
SmStructureNode* aParentNode;
- void DumpAsDot(std::ostream &out, String* label, int number, int& id, int parent) const;
+ void DumpAsDot(std::ostream &out, OUString* label, int number, int& id, int parent) const;
};
////////////////////////////////////////////////////////////////////////////////
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index fc86c6ed6ea4..994c86c7d652 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -556,18 +556,18 @@ const SmNode * SmNode::FindNodeWithAccessibleIndex(xub_StrLen nAccIdx) const
}
#ifdef DEBUG_ENABLE_DUMPASDOT
-void SmNode::DumpAsDot(std::ostream &out, String* label, int number, int& id, int parent) const
+void SmNode::DumpAsDot(std::ostream &out, OUString* label, int number, int& id, int parent) const
{
//If this is the root start the file
if(number == -1){
out<<"digraph {"<<std::endl;
if(label){
out<<"labelloc = \"t\";"<<std::endl;
- String eq(*label);
+ OUString eq(*label);
//CreateTextFromNode(eq);
- eq.SearchAndReplaceAll(String::CreateFromAscii("\n"), String::CreateFromAscii(" "));
- eq.SearchAndReplaceAll(String::CreateFromAscii("\\"), String::CreateFromAscii("\\\\"));
- eq.SearchAndReplaceAll(String::CreateFromAscii("\""), String::CreateFromAscii("\\\""));
+ eq = eq.replaceAll("\n", " ");
+ eq = eq.replaceAll("\\", "\\\\");
+ eq = eq.replaceAll("\"", "\\\"");
out<<"label= \"Equation: \\\"";
out<< rtl::OUStringToOString(eq, RTL_TEXTENCODING_UTF8).getStr();
out<<"\\\"\";"<<std::endl;
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index 7ab9f024d4db..54e30e48c0d6 100644
--- a/starmath/source/symbol.cxx
+++ b/starmath/source/symbol.cxx
@@ -262,7 +262,7 @@ void SmSymbolManager::Load()
SmLocalizedSymbolData aLocalizedData;
const OUString aGreekSymbolSetName(aLocalizedData.GetUiSymbolSetName(OUString("Greek")));
const SymbolPtrVec_t aGreekSymbols( GetSymbolSet( aGreekSymbolSetName ) );
- String aSymbolSetName = OUString('i');
+ OUString aSymbolSetName('i');
aSymbolSetName += aGreekSymbolSetName;
size_t nSymbols = aGreekSymbols.size();
for (size_t i = 0; i < nSymbols; ++i)
@@ -272,7 +272,7 @@ void SmSymbolManager::Load()
Font aFont( rSym.GetFace() );
OSL_ENSURE( aFont.GetItalic() == ITALIC_NONE, "expected Font with ITALIC_NONE, failed." );
aFont.SetItalic( ITALIC_NORMAL );
- String aSymbolName = OUString('i');
+ OUString aSymbolName('i');
aSymbolName += rSym.GetName();
SmSym aSymbol( aSymbolName, aFont, rSym.GetCharacter(),
aSymbolSetName, true /*bIsPredefined*/ );
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 880b8dad6ccd..1450ed5af83c 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -459,7 +459,7 @@ void SmGraphicWindow::KeyInput(const KeyEvent& rKEvt)
else {
SmNode *pTree = (SmNode*)pViewShell->GetDoc()->GetFormulaTree();
std::fstream file("/tmp/smath-dump.gv", std::fstream::out);
- String label(pViewShell->GetDoc()->GetText());
+ OUString label(pViewShell->GetDoc()->GetText());
pTree->DumpAsDot(file, &label);
file.close();
}
@@ -1017,7 +1017,6 @@ Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, const String& rLine)
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::GetTextLineSize" );
- String aText;
Size aSize(rDevice.GetTextWidth(rLine), rDevice.GetTextHeight());
sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t');
@@ -1032,7 +1031,7 @@ Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, const String& rLine)
if (i > 0)
aSize.Width() = ((aSize.Width() / TabPos) + 1) * TabPos;
- aText = rLine.GetToken(i, '\t');
+ OUString aText = rLine.GetToken(i, '\t');
aText = comphelper::string::stripStart(aText, '\t');
aText = comphelper::string::stripEnd(aText, '\t');
aSize.Width() += rDevice.GetTextWidth(aText);
@@ -1048,14 +1047,12 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const String& rText, long M
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::GetTextSize" );
Size aSize;
- String aLine;
Size TextSize;
- String aText;
sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n');
for (sal_uInt16 i = 0; i < nLines; i++)
{
- aLine = rText.GetToken(i, '\n');
+ OUString aLine = rText.GetToken(i, '\n');
aLine = comphelper::string::remove(aLine, '\r');
aLine = comphelper::string::stripStart(aLine, '\n');
aLine = comphelper::string::stripEnd(aLine, '\n');
@@ -1066,15 +1063,16 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const String& rText, long M
{
do
{
- xub_StrLen m = aLine.Len();
- xub_StrLen nLen = m;
+ OUString aText;
+ sal_Int32 m = aLine.getLength();
+ sal_Int32 nLen = m;
- for (xub_StrLen n = 0; n < nLen; n++)
+ for (sal_Int32 n = 0; n < nLen; n++)
{
- sal_Unicode cLineChar = aLine.GetChar(n);
+ sal_Unicode cLineChar = aLine[n];
if ((cLineChar == ' ') || (cLineChar == '\t'))
{
- aText = aLine.Copy(0, n);
+ aText = aLine.copy(0, n);
if (GetTextLineSize(rDevice, aText).Width() < MaxWidth)
m = n;
else
@@ -1082,8 +1080,8 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const String& rText, long M
}
}
- aText = aLine.Copy(0, m);
- aLine.Erase(0, m);
+ aText = aLine.copy(0, m);
+ aLine = aLine.replaceAt(0, m, "");
aSize = GetTextLineSize(rDevice, aText);
TextSize.Height() += aSize.Height();
TextSize.Width() = Max(TextSize.Width(), Min(aSize.Width(), MaxWidth));
@@ -1092,7 +1090,7 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const String& rText, long M
aLine = comphelper::string::stripStart(aLine, '\t');
aLine = comphelper::string::stripStart(aLine, ' ');
}
- while (aLine.Len() > 0);
+ while (!aLine.isEmpty());
}
else
{
@@ -1109,7 +1107,6 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::DrawTextLine" );
- String aText;
Point aPoint (rPosition);
sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t');
@@ -1122,7 +1119,7 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co
if (i > 0)
aPoint.X() = ((aPoint.X() / TabPos) + 1) * TabPos;
- aText = rLine.GetToken(i, '\t');
+ OUString aText = rLine.GetToken(i, '\t');
aText = comphelper::string::stripStart(aText, '\t');
aText = comphelper::string::stripEnd(aText, '\t');
rDevice.DrawText(aPoint, aText);
@@ -1141,12 +1138,10 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const
sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n');
Point aPoint (rPosition);
Size aSize;
- String aLine;
- String aText;
for (sal_uInt16 i = 0; i < nLines; i++)
{
- aLine = rText.GetToken(i, '\n');
+ OUString aLine = rText.GetToken(i, '\n');
aLine = comphelper::string::remove(aLine, '\r');
aLine = comphelper::string::stripEnd(aLine, '\n');
aLine = comphelper::string::stripEnd(aLine, '\n');
@@ -1155,23 +1150,24 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const
{
do
{
- xub_StrLen m = aLine.Len();
- xub_StrLen nLen = m;
+ OUString aText;
+ sal_Int32 m = aLine.getLength();
+ sal_Int32 nLen = m;
- for (xub_StrLen n = 0; n < nLen; n++)
+ for (sal_Int32 n = 0; n < nLen; n++)
{
- sal_Unicode cLineChar = aLine.GetChar(n);
+ sal_Unicode cLineChar = aLine[n];
if ((cLineChar == ' ') || (cLineChar == '\t'))
{
- aText = aLine.Copy(0, n);
+ aText = aLine.copy(0, n);
if (GetTextLineSize(rDevice, aText).Width() < MaxWidth)
m = n;
else
break;
}
}
- aText = aLine.Copy(0, m);
- aLine.Erase(0, m);
+ aText = aLine.copy(0, m);
+ aLine = aLine.replaceAt(0, m, "");
DrawTextLine(rDevice, aPoint, aText);
aPoint.Y() += aSize.Height();
@@ -1183,7 +1179,7 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const
while (GetTextLineSize(rDevice, aLine).Width() > MaxWidth);
// print the remaining text
- if (aLine.Len() > 0)
+ if (!aLine.isEmpty())
{
DrawTextLine(rDevice, aPoint, aLine);
aPoint.Y() += aSize.Height();
@@ -1513,8 +1509,8 @@ bool SmViewShell::InsertFrom(SfxMedium &rMedium)
if (pStream)
{
- const String& rFltName = rMedium.GetFilter()->GetFilterName();
- if ( rFltName.EqualsAscii(MATHML_XML) )
+ const OUString& rFltName = rMedium.GetFilter()->GetFilterName();
+ if ( rFltName == MATHML_XML )
{
Reference<com::sun::star::frame::XModel> xModel( pDoc->GetModel() );
SmXMLImportWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !!
@@ -1643,7 +1639,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
uno::Reference < embed::XStorage > xStorage =
::comphelper::OStorageHelper::GetStorageFromInputStream( xStrm, ::comphelper::getProcessServiceFactory() );
uno::Reference < beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY );
- SfxMedium aMedium( xStorage, String() );
+ SfxMedium aMedium( xStorage, OUString() );
Insert( aMedium );
GetDoc()->UpdateText();
}