String -> OUString
Change-Id: I2f0acb27f85a230109e827d415aabc029b90cd45
This commit is contained in:
@@ -190,7 +190,7 @@ public:
|
|||||||
/** The tree as dot graph for graphviz, usable for debugging
|
/** The tree as dot graph for graphviz, usable for debugging
|
||||||
* Convert the output to a image using $ dot graph.gv -Tpng > graph.png
|
* 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;
|
int id = 0;
|
||||||
DumpAsDot(out, label, -1, id, -1);
|
DumpAsDot(out, label, -1, id, -1);
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ protected:
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
SmStructureNode* aParentNode;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@@ -556,18 +556,18 @@ const SmNode * SmNode::FindNodeWithAccessibleIndex(xub_StrLen nAccIdx) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLE_DUMPASDOT
|
#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 this is the root start the file
|
||||||
if(number == -1){
|
if(number == -1){
|
||||||
out<<"digraph {"<<std::endl;
|
out<<"digraph {"<<std::endl;
|
||||||
if(label){
|
if(label){
|
||||||
out<<"labelloc = \"t\";"<<std::endl;
|
out<<"labelloc = \"t\";"<<std::endl;
|
||||||
String eq(*label);
|
OUString eq(*label);
|
||||||
//CreateTextFromNode(eq);
|
//CreateTextFromNode(eq);
|
||||||
eq.SearchAndReplaceAll(String::CreateFromAscii("\n"), String::CreateFromAscii(" "));
|
eq = eq.replaceAll("\n", " ");
|
||||||
eq.SearchAndReplaceAll(String::CreateFromAscii("\\"), String::CreateFromAscii("\\\\"));
|
eq = eq.replaceAll("\\", "\\\\");
|
||||||
eq.SearchAndReplaceAll(String::CreateFromAscii("\""), String::CreateFromAscii("\\\""));
|
eq = eq.replaceAll("\"", "\\\"");
|
||||||
out<<"label= \"Equation: \\\"";
|
out<<"label= \"Equation: \\\"";
|
||||||
out<< rtl::OUStringToOString(eq, RTL_TEXTENCODING_UTF8).getStr();
|
out<< rtl::OUStringToOString(eq, RTL_TEXTENCODING_UTF8).getStr();
|
||||||
out<<"\\\"\";"<<std::endl;
|
out<<"\\\"\";"<<std::endl;
|
||||||
|
@@ -262,7 +262,7 @@ void SmSymbolManager::Load()
|
|||||||
SmLocalizedSymbolData aLocalizedData;
|
SmLocalizedSymbolData aLocalizedData;
|
||||||
const OUString aGreekSymbolSetName(aLocalizedData.GetUiSymbolSetName(OUString("Greek")));
|
const OUString aGreekSymbolSetName(aLocalizedData.GetUiSymbolSetName(OUString("Greek")));
|
||||||
const SymbolPtrVec_t aGreekSymbols( GetSymbolSet( aGreekSymbolSetName ) );
|
const SymbolPtrVec_t aGreekSymbols( GetSymbolSet( aGreekSymbolSetName ) );
|
||||||
String aSymbolSetName = OUString('i');
|
OUString aSymbolSetName('i');
|
||||||
aSymbolSetName += aGreekSymbolSetName;
|
aSymbolSetName += aGreekSymbolSetName;
|
||||||
size_t nSymbols = aGreekSymbols.size();
|
size_t nSymbols = aGreekSymbols.size();
|
||||||
for (size_t i = 0; i < nSymbols; ++i)
|
for (size_t i = 0; i < nSymbols; ++i)
|
||||||
@@ -272,7 +272,7 @@ void SmSymbolManager::Load()
|
|||||||
Font aFont( rSym.GetFace() );
|
Font aFont( rSym.GetFace() );
|
||||||
OSL_ENSURE( aFont.GetItalic() == ITALIC_NONE, "expected Font with ITALIC_NONE, failed." );
|
OSL_ENSURE( aFont.GetItalic() == ITALIC_NONE, "expected Font with ITALIC_NONE, failed." );
|
||||||
aFont.SetItalic( ITALIC_NORMAL );
|
aFont.SetItalic( ITALIC_NORMAL );
|
||||||
String aSymbolName = OUString('i');
|
OUString aSymbolName('i');
|
||||||
aSymbolName += rSym.GetName();
|
aSymbolName += rSym.GetName();
|
||||||
SmSym aSymbol( aSymbolName, aFont, rSym.GetCharacter(),
|
SmSym aSymbol( aSymbolName, aFont, rSym.GetCharacter(),
|
||||||
aSymbolSetName, true /*bIsPredefined*/ );
|
aSymbolSetName, true /*bIsPredefined*/ );
|
||||||
|
@@ -459,7 +459,7 @@ void SmGraphicWindow::KeyInput(const KeyEvent& rKEvt)
|
|||||||
else {
|
else {
|
||||||
SmNode *pTree = (SmNode*)pViewShell->GetDoc()->GetFormulaTree();
|
SmNode *pTree = (SmNode*)pViewShell->GetDoc()->GetFormulaTree();
|
||||||
std::fstream file("/tmp/smath-dump.gv", std::fstream::out);
|
std::fstream file("/tmp/smath-dump.gv", std::fstream::out);
|
||||||
String label(pViewShell->GetDoc()->GetText());
|
OUString label(pViewShell->GetDoc()->GetText());
|
||||||
pTree->DumpAsDot(file, &label);
|
pTree->DumpAsDot(file, &label);
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
@@ -1017,7 +1017,6 @@ Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, const String& rLine)
|
|||||||
{
|
{
|
||||||
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::GetTextLineSize" );
|
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::GetTextLineSize" );
|
||||||
|
|
||||||
String aText;
|
|
||||||
Size aSize(rDevice.GetTextWidth(rLine), rDevice.GetTextHeight());
|
Size aSize(rDevice.GetTextWidth(rLine), rDevice.GetTextHeight());
|
||||||
sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t');
|
sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t');
|
||||||
|
|
||||||
@@ -1032,7 +1031,7 @@ Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, const String& rLine)
|
|||||||
if (i > 0)
|
if (i > 0)
|
||||||
aSize.Width() = ((aSize.Width() / TabPos) + 1) * TabPos;
|
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::stripStart(aText, '\t');
|
||||||
aText = comphelper::string::stripEnd(aText, '\t');
|
aText = comphelper::string::stripEnd(aText, '\t');
|
||||||
aSize.Width() += rDevice.GetTextWidth(aText);
|
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" );
|
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::GetTextSize" );
|
||||||
|
|
||||||
Size aSize;
|
Size aSize;
|
||||||
String aLine;
|
|
||||||
Size TextSize;
|
Size TextSize;
|
||||||
String aText;
|
|
||||||
sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n');
|
sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n');
|
||||||
|
|
||||||
for (sal_uInt16 i = 0; i < nLines; i++)
|
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::remove(aLine, '\r');
|
||||||
aLine = comphelper::string::stripStart(aLine, '\n');
|
aLine = comphelper::string::stripStart(aLine, '\n');
|
||||||
aLine = comphelper::string::stripEnd(aLine, '\n');
|
aLine = comphelper::string::stripEnd(aLine, '\n');
|
||||||
@@ -1066,15 +1063,16 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const String& rText, long M
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
xub_StrLen m = aLine.Len();
|
OUString aText;
|
||||||
xub_StrLen nLen = m;
|
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'))
|
if ((cLineChar == ' ') || (cLineChar == '\t'))
|
||||||
{
|
{
|
||||||
aText = aLine.Copy(0, n);
|
aText = aLine.copy(0, n);
|
||||||
if (GetTextLineSize(rDevice, aText).Width() < MaxWidth)
|
if (GetTextLineSize(rDevice, aText).Width() < MaxWidth)
|
||||||
m = n;
|
m = n;
|
||||||
else
|
else
|
||||||
@@ -1082,8 +1080,8 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const String& rText, long M
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aText = aLine.Copy(0, m);
|
aText = aLine.copy(0, m);
|
||||||
aLine.Erase(0, m);
|
aLine = aLine.replaceAt(0, m, "");
|
||||||
aSize = GetTextLineSize(rDevice, aText);
|
aSize = GetTextLineSize(rDevice, aText);
|
||||||
TextSize.Height() += aSize.Height();
|
TextSize.Height() += aSize.Height();
|
||||||
TextSize.Width() = Max(TextSize.Width(), Min(aSize.Width(), MaxWidth));
|
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, '\t');
|
||||||
aLine = comphelper::string::stripStart(aLine, ' ');
|
aLine = comphelper::string::stripStart(aLine, ' ');
|
||||||
}
|
}
|
||||||
while (aLine.Len() > 0);
|
while (!aLine.isEmpty());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1109,7 +1107,6 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co
|
|||||||
{
|
{
|
||||||
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::DrawTextLine" );
|
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::DrawTextLine" );
|
||||||
|
|
||||||
String aText;
|
|
||||||
Point aPoint (rPosition);
|
Point aPoint (rPosition);
|
||||||
sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t');
|
sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t');
|
||||||
|
|
||||||
@@ -1122,7 +1119,7 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co
|
|||||||
if (i > 0)
|
if (i > 0)
|
||||||
aPoint.X() = ((aPoint.X() / TabPos) + 1) * TabPos;
|
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::stripStart(aText, '\t');
|
||||||
aText = comphelper::string::stripEnd(aText, '\t');
|
aText = comphelper::string::stripEnd(aText, '\t');
|
||||||
rDevice.DrawText(aPoint, aText);
|
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');
|
sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n');
|
||||||
Point aPoint (rPosition);
|
Point aPoint (rPosition);
|
||||||
Size aSize;
|
Size aSize;
|
||||||
String aLine;
|
|
||||||
String aText;
|
|
||||||
|
|
||||||
for (sal_uInt16 i = 0; i < nLines; i++)
|
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::remove(aLine, '\r');
|
||||||
aLine = comphelper::string::stripEnd(aLine, '\n');
|
aLine = comphelper::string::stripEnd(aLine, '\n');
|
||||||
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
|
do
|
||||||
{
|
{
|
||||||
xub_StrLen m = aLine.Len();
|
OUString aText;
|
||||||
xub_StrLen nLen = m;
|
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'))
|
if ((cLineChar == ' ') || (cLineChar == '\t'))
|
||||||
{
|
{
|
||||||
aText = aLine.Copy(0, n);
|
aText = aLine.copy(0, n);
|
||||||
if (GetTextLineSize(rDevice, aText).Width() < MaxWidth)
|
if (GetTextLineSize(rDevice, aText).Width() < MaxWidth)
|
||||||
m = n;
|
m = n;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aText = aLine.Copy(0, m);
|
aText = aLine.copy(0, m);
|
||||||
aLine.Erase(0, m);
|
aLine = aLine.replaceAt(0, m, "");
|
||||||
|
|
||||||
DrawTextLine(rDevice, aPoint, aText);
|
DrawTextLine(rDevice, aPoint, aText);
|
||||||
aPoint.Y() += aSize.Height();
|
aPoint.Y() += aSize.Height();
|
||||||
@@ -1183,7 +1179,7 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const
|
|||||||
while (GetTextLineSize(rDevice, aLine).Width() > MaxWidth);
|
while (GetTextLineSize(rDevice, aLine).Width() > MaxWidth);
|
||||||
|
|
||||||
// print the remaining text
|
// print the remaining text
|
||||||
if (aLine.Len() > 0)
|
if (!aLine.isEmpty())
|
||||||
{
|
{
|
||||||
DrawTextLine(rDevice, aPoint, aLine);
|
DrawTextLine(rDevice, aPoint, aLine);
|
||||||
aPoint.Y() += aSize.Height();
|
aPoint.Y() += aSize.Height();
|
||||||
@@ -1513,8 +1509,8 @@ bool SmViewShell::InsertFrom(SfxMedium &rMedium)
|
|||||||
|
|
||||||
if (pStream)
|
if (pStream)
|
||||||
{
|
{
|
||||||
const String& rFltName = rMedium.GetFilter()->GetFilterName();
|
const OUString& rFltName = rMedium.GetFilter()->GetFilterName();
|
||||||
if ( rFltName.EqualsAscii(MATHML_XML) )
|
if ( rFltName == MATHML_XML )
|
||||||
{
|
{
|
||||||
Reference<com::sun::star::frame::XModel> xModel( pDoc->GetModel() );
|
Reference<com::sun::star::frame::XModel> xModel( pDoc->GetModel() );
|
||||||
SmXMLImportWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !!
|
SmXMLImportWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !!
|
||||||
@@ -1643,7 +1639,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
|
|||||||
uno::Reference < embed::XStorage > xStorage =
|
uno::Reference < embed::XStorage > xStorage =
|
||||||
::comphelper::OStorageHelper::GetStorageFromInputStream( xStrm, ::comphelper::getProcessServiceFactory() );
|
::comphelper::OStorageHelper::GetStorageFromInputStream( xStrm, ::comphelper::getProcessServiceFactory() );
|
||||||
uno::Reference < beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY );
|
uno::Reference < beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY );
|
||||||
SfxMedium aMedium( xStorage, String() );
|
SfxMedium aMedium( xStorage, OUString() );
|
||||||
Insert( aMedium );
|
Insert( aMedium );
|
||||||
GetDoc()->UpdateText();
|
GetDoc()->UpdateText();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user