summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-10-13 17:41:05 +0200
committerAndras Timar <atimar@suse.com>2012-10-13 17:41:05 +0200
commite5ce011c3f32f53ef073aec5485450b2588b656a (patch)
tree8a838a53bcdd70cc3d4cdbca0ebe07504790952e /starmath
parentc6b26144c93aa5222e4260c5b0ef45ce5bdc18d2 (diff)
parente74fc93e4aba7887e6a278cc44c4bc0962471065 (diff)
Merge branch 'master' into feature/killsdf
Conflicts: Makefile.top Module_tail_build.mk RepositoryExternal.mk RepositoryFixes.mk accessibility/source/standard/vclxaccessibletoolbox.cxx basic/source/uno/dlgcont.cxx connectivity/Library_ado.mk cross_tail_build/prj/build.lst desktop/source/offacc/acceptor.cxx filter/Library_PptImporter.mk filter/source/t602/filterenv.cxx i18npool/Library_textconv_dict.mk ooo.lst.in saxon/ExternalProject_saxon.mk saxon/build.xml sc/sdi/scalc.sdi sc/source/filter/xml/xmlstyli.cxx sc/source/ui/condformat/condformatdlg.cxx sc/source/ui/condformat/condformatmgr.cxx sc/source/ui/view/cellsh1.cxx sdext/source/pdfimport/misc/pwdinteract.cxx shell/qa/zip/makefile.mk shell/qa/zip/testimpl/makefile.mk solenv/gbuild/CppunitTest.mk solenv/gbuild/gbuild.mk solenv/gbuild/platform/android.mk solenv/gbuild/platform/com_GCC_defs.mk solenv/gbuild/platform/macosx.mk soltools/Executable_adjustvisibility.mk soltools/Executable_checkdll.mk soltools/Executable_cpp.mk soltools/Executable_javadep.mk soltools/Executable_makedepend.mk sw/qa/extras/rtfimport/rtfimport.cxx tail_build/prj/build.lst tomcat/ExternalProject_tomcat.mk ucb/source/ucp/webdav/webdavcontent.cxx xml2cmp/Executable_xml2cmp.mk
Diffstat (limited to 'starmath')
-rw-r--r--starmath/Library_smd.mk5
-rw-r--r--starmath/README3
-rw-r--r--starmath/inc/caret.hxx2
-rw-r--r--starmath/inc/cursor.hxx2
-rw-r--r--starmath/inc/dialog.hxx28
-rw-r--r--starmath/inc/edit.hxx4
-rw-r--r--starmath/inc/node.hxx20
-rw-r--r--starmath/inc/parse.hxx2
-rw-r--r--starmath/inc/symbol.hxx56
-rw-r--r--starmath/inc/utility.hxx10
-rw-r--r--starmath/inc/visitors.hxx19
-rw-r--r--starmath/qa/cppunit/test_nodetotextvisitors.cxx10
-rw-r--r--starmath/source/accessibility.cxx94
-rw-r--r--starmath/source/accessibility.hxx6
-rw-r--r--starmath/source/cfgitem.cxx2
-rw-r--r--starmath/source/cursor.cxx40
-rw-r--r--starmath/source/dialog.cxx90
-rw-r--r--starmath/source/edit.cxx64
-rw-r--r--starmath/source/mathmlexport.cxx20
-rw-r--r--starmath/source/mathmlimport.cxx16
-rw-r--r--starmath/source/mathtype.cxx22
-rw-r--r--starmath/source/node.cxx24
-rw-r--r--starmath/source/ooxmlexport.cxx12
-rw-r--r--starmath/source/parse.cxx4
-rw-r--r--starmath/source/rtfexport.cxx10
-rw-r--r--starmath/source/symbol.cxx40
-rw-r--r--starmath/source/unomodel.cxx24
-rw-r--r--starmath/source/utility.cxx29
-rw-r--r--starmath/source/view.cxx12
-rw-r--r--starmath/source/visitors.cxx22
-rw-r--r--starmath/source/wordexportbase.cxx2
31 files changed, 320 insertions, 374 deletions
diff --git a/starmath/Library_smd.mk b/starmath/Library_smd.mk
index a8db56e8b6ad..92961c7b01f6 100644
--- a/starmath/Library_smd.mk
+++ b/starmath/Library_smd.mk
@@ -22,6 +22,11 @@
$(eval $(call gb_Library_Library,smd))
+$(eval $(call gb_Library_use_packages,smd,\
+ editeng_inc \
+ oox_inc \
+))
+
$(eval $(call gb_Library_set_componentfile,smd,starmath/util/smd))
$(eval $(call gb_Library_set_include,smd,\
diff --git a/starmath/README b/starmath/README
index a5a0a4efd619..d84b3d8e0483 100644
--- a/starmath/README
+++ b/starmath/README
@@ -1 +1,4 @@
Formula editor code for writer ([[sw]]).
+
+Good overview from the original developer:
+http://www.mail-archive.com/dev@sw.openoffice.org/msg00200.html
diff --git a/starmath/inc/caret.hxx b/starmath/inc/caret.hxx
index b97e00305e36..c38685d1a326 100644
--- a/starmath/inc/caret.hxx
+++ b/starmath/inc/caret.hxx
@@ -64,7 +64,7 @@ struct SmCaretPos{
*/
static SmCaretPos GetPosAfter(SmNode* pNode) {
if(pNode && pNode->GetType() == NTEXT)
- return SmCaretPos(pNode, ((SmTextNode*)pNode)->GetText().Len());
+ return SmCaretPos(pNode, ((SmTextNode*)pNode)->GetText().getLength());
return SmCaretPos(pNode, 1);
}
};
diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx
index 3c274cb7b7d2..b7a0d9c618e9 100644
--- a/starmath/inc/cursor.hxx
+++ b/starmath/inc/cursor.hxx
@@ -155,7 +155,7 @@ public:
* This will work for stuff like "A intersection B". But stuff spaning multiple lines
* or dependent on the context which position is placed in will not work!
*/
- void InsertCommandText(String aCommandText);
+ void InsertCommandText(OUString aCommandText);
/** Insert a special node created from aString
*
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 571c4c074db5..6636ad0330e4 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -44,7 +44,7 @@ class SubsetMap;
/**************************************************************************/
-void SetFontStyle(const XubString &rStyleName, Font &rFont);
+void SetFontStyle(const OUString &rStyleName, Font &rFont);
/**************************************************************************/
@@ -382,7 +382,7 @@ public:
SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell, bool bFreeRes = true);
virtual ~SmSymbolDialog();
- bool SelectSymbolSet(const XubString &rSymbolSetName);
+ bool SelectSymbolSet(const OUString &rSymbolSetName);
void SelectSymbol(sal_uInt16 nSymbolPos);
sal_uInt16 GetSelectedSymbol() const { return aSymbolSetDisplay.GetSelectSymbol(); }
};
@@ -462,16 +462,16 @@ class SmSymDefineDialog : public ModalDialog
void FillStyles(bool bDeleteText = true);
void SetSymbolSetManager(const SmSymbolManager &rMgr);
- void SetFont(const XubString &rFontName, const XubString &rStyleName);
- void SetOrigSymbol(const SmSym *pSymbol, const XubString &rSymbolSetName);
+ void SetFont(const OUString &rFontName, const OUString &rStyleName);
+ void SetOrigSymbol(const SmSym *pSymbol, const OUString &rSymbolSetName);
void UpdateButtons();
- bool SelectSymbolSet(ComboBox &rComboBox, const XubString &rSymbolSetName,
+ bool SelectSymbolSet(ComboBox &rComboBox, const OUString &rSymbolSetName,
bool bDeleteText);
- bool SelectSymbol(ComboBox &rComboBox, const XubString &rSymbolName,
+ bool SelectSymbol(ComboBox &rComboBox, const OUString &rSymbolName,
bool bDeleteText);
- bool SelectFont(const XubString &rFontName, bool bApplyFont);
- bool SelectStyle(const XubString &rStyleName, bool bApplyFont);
+ bool SelectFont(const OUString &rFontName, bool bApplyFont);
+ bool SelectStyle(const OUString &rStyleName, bool bApplyFont);
SmSym * GetSymbol(const ComboBox &rComboBox);
const SmSym * GetSymbol(const ComboBox &rComboBox) const
@@ -492,28 +492,28 @@ public:
// Dialog
virtual short Execute();
- bool SelectOldSymbolSet(const XubString &rSymbolSetName)
+ bool SelectOldSymbolSet(const OUString &rSymbolSetName)
{
return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, false);
}
- bool SelectOldSymbol(const XubString &rSymbolName)
+ bool SelectOldSymbol(const OUString &rSymbolName)
{
return SelectSymbol(aOldSymbols, rSymbolName, false);
}
- bool SelectSymbolSet(const XubString &rSymbolSetName)
+ bool SelectSymbolSet(const OUString &rSymbolSetName)
{
return SelectSymbolSet(aSymbolSets, rSymbolSetName, false);
}
- bool SelectSymbol(const XubString &rSymbolName)
+ bool SelectSymbol(const OUString &rSymbolName)
{
return SelectSymbol(aSymbols, rSymbolName, false);
}
- bool SelectFont(const XubString &rFontName) { return SelectFont(rFontName, true); }
- bool SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, true); };
+ bool SelectFont(const OUString &rFontName) { return SelectFont(rFontName, true); }
+ bool SelectStyle(const OUString &rStyleName) { return SelectStyle(rStyleName, true); };
void SelectChar(xub_Unicode cChar);
};
diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index 2096b926ce21..be7b52d8c397 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -113,12 +113,12 @@ public:
void Paste();
void Delete();
void SelectAll();
- void InsertText(const String &rText);
+ void InsertText(const OUString &rText);
void InsertCommand(sal_uInt16 nCommand);
void MarkError(const Point &rPos);
void SelNextMark();
void SelPrevMark();
- bool HasMark(const String &rText) const;
+ bool HasMark(const OUString &rText) const;
void Flush();
void DeleteEditView( SmViewShell &rView );
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 78167251c563..45c96696d433 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -443,16 +443,16 @@ public:
*/
class SmTextNode : public SmVisibleNode
{
- XubString aText;
+ OUString aText;
sal_uInt16 nFontDesc;
/** Index within text where the selection starts
* @remarks Only valid if SmNode::IsSelected() is true
*/
- xub_StrLen nSelectionStart;
+ sal_Int32 nSelectionStart;
/** Index within text where the selection ends
* @remarks Only valid if SmNode::IsSelected() is true
*/
- xub_StrLen nSelectionEnd;
+ sal_Int32 nSelectionEnd;
protected:
SmTextNode(SmNodeType eNodeType, const SmToken &rNodeToken, sal_uInt16 nFontDescP );
@@ -461,10 +461,10 @@ public:
SmTextNode(const SmToken &rNodeToken, sal_uInt16 nFontDescP );
sal_uInt16 GetFontDesc() const { return nFontDesc; }
- void SetText(const XubString &rText) { aText = rText; }
- const XubString & GetText() const { return aText; }
+ void SetText(const OUString &rText) { aText = rText; }
+ const OUString & GetText() const { return aText; }
/** Change the text of this node, including the underlying token */
- void ChangeText(const XubString &rText) {
+ void ChangeText(const OUString &rText) {
aText = rText;
SmToken token = GetToken();
token.aText = rText;
@@ -476,15 +476,15 @@ public:
/** Index within GetText() where the selection starts
* @remarks Only valid of SmNode::IsSelected() is true
*/
- xub_StrLen GetSelectionStart() const {return nSelectionStart;}
+ sal_Int32 GetSelectionStart() const {return nSelectionStart;}
/** Index within GetText() where the selection end
* @remarks Only valid of SmNode::IsSelected() is true
*/
- xub_StrLen GetSelectionEnd() const {return nSelectionEnd;}
+ sal_Int32 GetSelectionEnd() const {return nSelectionEnd;}
/** Set the index within GetText() where the selection starts */
- void SetSelectionStart(xub_StrLen index) {nSelectionStart = index;}
+ void SetSelectionStart(sal_Int32 index) {nSelectionStart = index;}
/** Set the index within GetText() where the selection end */
- void SetSelectionEnd(xub_StrLen index) {nSelectionEnd = index;}
+ void SetSelectionEnd(sal_Int32 index) {nSelectionEnd = index;}
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index e4f1c6a9a10c..e3a8d23c5154 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -263,7 +263,7 @@ public:
/** Parse rBuffer to formula tree */
SmNode *Parse(const String &rBuffer);
/** Parse rBuffer to formula subtree that constitutes an expression */
- SmNode *ParseExpression(const String &rBuffer);
+ SmNode *ParseExpression(const OUString &rBuffer);
const String & GetText() const { return m_aBufferString; };
diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx
index b6d0224cb2b7..615f75266a62 100644
--- a/starmath/inc/symbol.hxx
+++ b/starmath/inc/symbol.hxx
@@ -40,24 +40,24 @@
////////////////////////////////////////////////////////////////////////////////
-inline const String GetExportSymbolName( const String &rUiSymbolName )
+inline const OUString GetExportSymbolName( const OUString &rUiSymbolName )
{
return SM_MOD()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName );
}
-inline const String GetUiSymbolName( const String &rExportSymbolName )
+inline const OUString GetUiSymbolName( const OUString &rExportSymbolName )
{
return SM_MOD()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName );
}
-inline const String GetExportSymbolSetName( const String &rUiSymbolSetName )
+inline const OUString GetExportSymbolSetName( const OUString &rUiSymbolSetName )
{
return SM_MOD()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName );
}
-inline const String GetUiSymbolSetName( const String &rExportSymbolSetName )
+inline const OUString GetUiSymbolSetName( const OUString &rExportSymbolSetName )
{
return SM_MOD()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName );
}
@@ -68,37 +68,33 @@ class SmSym
{
private:
SmFace m_aFace;
- String m_aName;
- String m_aExportName;
- String m_aSetName;
+ OUString m_aName;
+ OUString m_aExportName;
+ OUString m_aSetName;
sal_UCS4 m_cChar;
bool m_bPredefined;
bool m_bDocSymbol;
public:
SmSym();
- SmSym(const String& rName, const Font& rFont, sal_UCS4 cChar,
- const String& rSet, bool bIsPredefined = false);
+ SmSym(const OUString& rName, const Font& rFont, sal_UCS4 cChar,
+ const OUString& rSet, bool bIsPredefined = false);
SmSym(const SmSym& rSymbol);
SmSym& operator = (const SmSym& rSymbol);
const Font& GetFace() const { return m_aFace; }
sal_UCS4 GetCharacter() const { return m_cChar; }
- const String& GetName() const { return m_aName; }
+ const OUString& GetName() const { return m_aName; }
void SetFace( const Font& rFont ) { m_aFace = rFont; }
void SetCharacter( sal_UCS4 cChar ) { m_cChar = cChar; }
-//! since the symbol name is also used as key in the map it should not be possible to change the name
-//! because ten the key would not be the same as its supposed copy here
-// void SetName( const String &rTxt ) { m_aName = rTxt; }
-
bool IsPredefined() const { return m_bPredefined; }
- const String & GetSymbolSetName() const { return m_aSetName; }
- void SetSymbolSetName( const String &rName ) { m_aSetName = rName; }
- const String & GetExportName() const { return m_aExportName; }
- void SetExportName( const String &rName ) { m_aExportName = rName; }
+ const OUString& GetSymbolSetName() const { return m_aSetName; }
+ void SetSymbolSetName( const OUString &rName ) { m_aSetName = rName; }
+ const OUString& GetExportName() const { return m_aExportName; }
+ void SetExportName( const OUString &rName ) { m_aExportName = rName; }
bool IsDocSymbol() const { return m_bDocSymbol; }
void SetDocSymbol( bool bVal ) { m_bDocSymbol = bVal; }
@@ -107,20 +103,8 @@ public:
bool IsEqualInUI( const SmSym& rSymbol ) const;
};
-/**************************************************************************/
-
-struct lt_String
-{
- bool operator()( const String &r1, const String &r2 ) const
- {
- // r1 < r2 ?
- return r1.CompareTo( r2 ) == COMPARE_LESS;
- }
-};
-
-
// type of the actual container to hold the symbols
-typedef std::map< String, SmSym, lt_String > SymbolMap_t;
+typedef std::map< OUString, SmSym > SymbolMap_t;
// vector of pointers to the actual symbols in the above container
typedef std::vector< const SmSym * > SymbolPtrVec_t;
@@ -151,16 +135,16 @@ public:
SmSymbolManager & operator = (const SmSymbolManager& rSymbolSetManager);
// symbol sets are for UI purpose only, thus we assemble them here
- std::set< String > GetSymbolSetNames() const;
- const SymbolPtrVec_t GetSymbolSet( const String& rSymbolSetName );
+ std::set< OUString > GetSymbolSetNames() const;
+ const SymbolPtrVec_t GetSymbolSet( const OUString& rSymbolSetName );
sal_uInt16 GetSymbolCount() const { return static_cast< sal_uInt16 >(m_aSymbols.size()); }
const SymbolPtrVec_t GetSymbols() const;
bool AddOrReplaceSymbol( const SmSym & rSymbol, bool bForceChange = false );
- void RemoveSymbol( const String & rSymbolName );
+ void RemoveSymbol( const OUString & rSymbolName );
- SmSym * GetSymbolByName(const String& rSymbolName);
- const SmSym * GetSymbolByName(const String& rSymbolName) const
+ SmSym * GetSymbolByName(const OUString& rSymbolName);
+ const SmSym * GetSymbolByName(const OUString& rSymbolName) const
{
return ((SmSymbolManager *) this)->GetSymbolByName(rSymbolName);
}
diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index 9ea1281eb96f..1184c8522afd 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -27,10 +27,6 @@
#include <tools/fract.hxx>
-class String;
-
-/////////////////////////////////////////////////////////////////
-
inline long SmPtsTo100th_mm(long nNumPts)
// returns the length (in 100th of mm) that corresponds to the length
// 'nNumPts' (in units points).
@@ -126,13 +122,12 @@ class SmPickList : public SfxPtrArr
protected:
sal_uInt16 nSize;
- virtual void *CreateItem(const String& rString) = 0;
virtual void *CreateItem(const void *pItem) = 0;
virtual void DestroyItem(void *pItem) = 0;
virtual bool CompareItem(const void *pFirstItem, const void *pSecondItem) const = 0;
- virtual String GetStringItem(void *pItem) = 0;
+ virtual OUString GetStringItem(void *pItem) = 0;
void *GetPtr(sal_uInt16 nPos) const { return SfxPtrArr::GetObject(nPos); }
void *&GetPtr(sal_uInt16 nPos) { return SfxPtrArr::GetObject(nPos); }
@@ -172,13 +167,12 @@ class SmFontDialog;
class SmFontPickList : public SmPickList
{
protected:
- virtual void *CreateItem(const String& rString);
virtual void *CreateItem(const void *pItem);
virtual void DestroyItem(void *pItem);
virtual bool CompareItem(const void *pFirstItem, const void *pSecondItem) const;
- virtual String GetStringItem(void *pItem);
+ virtual OUString GetStringItem(void *pItem);
public:
SmFontPickList()
diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx
index 9f792124d1c4..f20379d4df20 100644
--- a/starmath/inc/visitors.hxx
+++ b/starmath/inc/visitors.hxx
@@ -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 */
diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
index 5e24fb04781c..b7e363ca4818 100644
--- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx
+++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
@@ -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);
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index b271773f332c..331790a606e0 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -105,7 +105,7 @@ static awt::Point lcl_GetLocationOnScreen( Window *pWin )
//////////////////////////////////////////////////////////////////////
SmGraphicAccessible::SmGraphicAccessible( SmGraphicWindow *pGraphicWin ) :
- aAccName ( String(SmResId(RID_DOCUMENTSTR)) ),
+ aAccName (SM_RESSTR(RID_DOCUMENTSTR)),
nClientId (0),
pWin (pGraphicWin)
{
@@ -115,7 +115,7 @@ SmGraphicAccessible::SmGraphicAccessible( SmGraphicWindow *pGraphicWin ) :
SmGraphicAccessible::SmGraphicAccessible( const SmGraphicAccessible &rSmAcc ) :
SmGraphicAccessibleBaseClass(),
- aAccName ( String(SmResId(RID_DOCUMENTSTR)) ),
+ aAccName (SM_RESSTR(RID_DOCUMENTSTR)),
nClientId (0)
{
pWin = rSmAcc.pWin;
@@ -134,9 +134,9 @@ SmDocShell * SmGraphicAccessible::GetDoc_Impl()
return pView ? pView->GetDoc() : 0;
}
-String SmGraphicAccessible::GetAccessibleText_Impl()
+OUString SmGraphicAccessible::GetAccessibleText_Impl()
{
- String aTxt;
+ OUString aTxt;
SmDocShell *pDoc = GetDoc_Impl();
if (pDoc)
aTxt = pDoc->GetAccessibleText();
@@ -451,9 +451,8 @@ sal_Bool SAL_CALL SmGraphicAccessible::setCaretPosition( sal_Int32 nIndex )
throw (IndexOutOfBoundsException, RuntimeException)
{
SolarMutexGuard aGuard;
- xub_StrLen nIdx = (xub_StrLen) nIndex;
- String aTxt( GetAccessibleText_Impl() );
- if (!(nIdx < aTxt.Len()))
+ OUString aTxt( GetAccessibleText_Impl() );
+ if (!(nIndex < aTxt.getLength()))
throw IndexOutOfBoundsException();
return sal_False;
}
@@ -462,12 +461,10 @@ sal_Unicode SAL_CALL SmGraphicAccessible::getCharacter( sal_Int32 nIndex )
throw (IndexOutOfBoundsException, RuntimeException)
{
SolarMutexGuard aGuard;
-
- xub_StrLen nIdx = (xub_StrLen) nIndex;
- String aTxt( GetAccessibleText_Impl() );
- if (!(nIdx < aTxt.Len()))
+ OUString aTxt( GetAccessibleText_Impl() );
+ if (!(nIndex < aTxt.getLength()))
throw IndexOutOfBoundsException();
- return aTxt.GetChar( nIdx );
+ return aTxt[nIndex];
}
Sequence< beans::PropertyValue > SAL_CALL SmGraphicAccessible::getCharacterAttributes(
@@ -476,7 +473,7 @@ Sequence< beans::PropertyValue > SAL_CALL SmGraphicAccessible::getCharacterAttri
throw (IndexOutOfBoundsException, RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nLen = GetAccessibleText_Impl().Len();
+ sal_Int32 nLen = GetAccessibleText_Impl().getLength();
if (!(0 <= nIndex && nIndex < nLen))
throw IndexOutOfBoundsException();
return Sequence< beans::PropertyValue >();
@@ -498,12 +495,12 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde
SmDocShell *pDoc = pView ? pView->GetDoc() : 0;
if (!pDoc)
throw RuntimeException();
- String aTxt( GetAccessibleText_Impl() );
- if (!(0 <= nIndex && nIndex <= aTxt.Len())) // aTxt.Len() is valid
+ OUString aTxt( GetAccessibleText_Impl() );
+ if (!(0 <= nIndex && nIndex <= aTxt.getLength())) // aTxt.getLength() is valid
throw IndexOutOfBoundsException();
- // find a reasonable rectangle for position aTxt.Len().
- bool bWasBehindText = (nIndex == aTxt.Len());
+ // find a reasonable rectangle for position aTxt.getLength().
+ bool bWasBehindText = (nIndex == aTxt.getLength());
if (bWasBehindText && nIndex)
--nIndex;
@@ -560,7 +557,7 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getCharacterCount()
throw (RuntimeException)
{
SolarMutexGuard aGuard;
- return GetAccessibleText_Impl().Len();
+ return GetAccessibleText_Impl().getLength();
}
sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoint )
@@ -656,7 +653,7 @@ sal_Bool SAL_CALL SmGraphicAccessible::setSelection(
throw (IndexOutOfBoundsException, RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nLen = GetAccessibleText_Impl().Len();
+ sal_Int32 nLen = GetAccessibleText_Impl().getLength();
if (!(0 <= nStartIndex && nStartIndex < nLen) ||
!(0 <= nEndIndex && nEndIndex < nLen))
throw IndexOutOfBoundsException();
@@ -680,32 +677,31 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
//!! may be switched.
SolarMutexGuard aGuard;
- String aTxt( GetAccessibleText_Impl() );
- xub_StrLen nStart = (xub_StrLen) Min(nStartIndex, nEndIndex);
- xub_StrLen nEnd = (xub_StrLen) Max(nStartIndex, nEndIndex);
- if (!(nStart <= aTxt.Len()) ||
- !(nEnd <= aTxt.Len()))
+ OUString aTxt( GetAccessibleText_Impl() );
+ sal_Int32 nStart = Min(nStartIndex, nEndIndex);
+ sal_Int32 nEnd = Max(nStartIndex, nEndIndex);
+ if (!(nStart <= aTxt.getLength()) ||
+ !(nEnd <= aTxt.getLength()))
throw IndexOutOfBoundsException();
- return aTxt.Copy( nStart, nEnd - nStart );
+ return aTxt.copy( nStart, nEnd - nStart );
}
::com::sun::star::accessibility::TextSegment SAL_CALL SmGraphicAccessible::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- String aTxt( GetAccessibleText_Impl() );
- xub_StrLen nIdx = (xub_StrLen) nIndex;
+ OUString aTxt( GetAccessibleText_Impl() );
//!! nIndex is allowed to be the string length
- if (!(nIdx <= aTxt.Len()))
+ if (!(nIndex <= aTxt.getLength()))
throw IndexOutOfBoundsException();
::com::sun::star::accessibility::TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
- if ( (AccessibleTextType::CHARACTER == aTextType) && (nIdx < aTxt.Len()) )
+ if ( (AccessibleTextType::CHARACTER == aTextType) && (nIndex < aTxt.getLength()) )
{
- aResult.SegmentText = aTxt.Copy(nIdx, 1);
- aResult.SegmentStart = nIdx;
- aResult.SegmentEnd = nIdx+1;
+ aResult.SegmentText = aTxt.copy(nIndex, 1);
+ aResult.SegmentStart = nIndex;
+ aResult.SegmentEnd = nIndex+1;
}
return aResult;
}
@@ -713,21 +709,20 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
::com::sun::star::accessibility::TextSegment SAL_CALL SmGraphicAccessible::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- String aTxt( GetAccessibleText_Impl() );
- xub_StrLen nIdx = (xub_StrLen) nIndex;
+ OUString aTxt( GetAccessibleText_Impl() );
//!! nIndex is allowed to be the string length
- if (!(nIdx <= aTxt.Len()))
+ if (!(nIndex <= aTxt.getLength()))
throw IndexOutOfBoundsException();
::com::sun::star::accessibility::TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
- if ( (AccessibleTextType::CHARACTER == aTextType) && nIdx )
+ if ( (AccessibleTextType::CHARACTER == aTextType) && nIndex )
{
- aResult.SegmentText = aTxt.Copy(nIdx-1, 1);
- aResult.SegmentStart = nIdx-1;
- aResult.SegmentEnd = nIdx;
+ aResult.SegmentText = aTxt.copy(nIndex-1, 1);
+ aResult.SegmentStart = nIndex-1;
+ aResult.SegmentEnd = nIndex;
}
return aResult;
}
@@ -735,22 +730,21 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
::com::sun::star::accessibility::TextSegment SAL_CALL SmGraphicAccessible::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- String aTxt( GetAccessibleText_Impl() );
- xub_StrLen nIdx = (xub_StrLen) nIndex;
+ OUString aTxt( GetAccessibleText_Impl() );
//!! nIndex is allowed to be the string length
- if (!(nIdx <= aTxt.Len()))
+ if (!(nIndex <= aTxt.getLength()))
throw IndexOutOfBoundsException();
::com::sun::star::accessibility::TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
- nIdx++; // text *behind*
- if ( (AccessibleTextType::CHARACTER == aTextType) && (nIdx < aTxt.Len()) )
+ nIndex++; // text *behind*
+ if ( (AccessibleTextType::CHARACTER == aTextType) && (nIndex < aTxt.getLength()) )
{
- aResult.SegmentText = aTxt.Copy(nIdx, 1);
- aResult.SegmentStart = nIdx;
- aResult.SegmentEnd = nIdx+1;
+ aResult.SegmentText = aTxt.copy(nIndex, 1);
+ aResult.SegmentStart = nIndex;
+ aResult.SegmentEnd = nIndex+1;
}
return aResult;
}
@@ -1129,7 +1123,7 @@ void SmTextForwarder::FieldClicked(const SvxFieldItem&, sal_uInt16, sal_uInt16)
{
}
-sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
+static sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
{
std::vector<EECharAttrib> aAttribs;
@@ -1631,7 +1625,7 @@ sal_Bool SmEditViewForwarder::Paste()
//------------------------------------------------------------------------
SmEditAccessible::SmEditAccessible( SmEditWindow *pEditWin ) :
- aAccName ( String(SmResId(STR_CMDBOXWINDOW)) ),
+ aAccName (SM_RESSTR(STR_CMDBOXWINDOW)),
pTextHelper (0),
pWin (pEditWin)
{
@@ -1641,7 +1635,7 @@ SmEditAccessible::SmEditAccessible( SmEditWindow *pEditWin ) :
SmEditAccessible::SmEditAccessible( const SmEditAccessible &rSmAcc ) :
SmEditAccessibleBaseClass(),
- aAccName ( String(SmResId(STR_CMDBOXWINDOW)) )
+ aAccName (SM_RESSTR(STR_CMDBOXWINDOW))
{
pWin = rSmAcc.pWin;
OSL_ENSURE( pWin, "SmEditAccessible: window missing" );
diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx
index b9918ddbd866..6a05823e22c1 100644
--- a/starmath/source/accessibility.hxx
+++ b/starmath/source/accessibility.hxx
@@ -72,7 +72,7 @@ class SmGraphicAccessible :
public SmGraphicAccessibleBaseClass
{
osl::Mutex aListenerMutex;
- String aAccName;
+ OUString aAccName;
/// client id in the AccessibleEventNotifier queue
sal_uInt32 nClientId;
@@ -84,7 +84,7 @@ class SmGraphicAccessible :
protected:
SmDocShell * GetDoc_Impl();
- String GetAccessibleText_Impl();
+ OUString GetAccessibleText_Impl();
public:
SmGraphicAccessible( SmGraphicWindow *pGraphicWin );
@@ -326,7 +326,7 @@ class SmEditAccessible :
public SmEditAccessibleBaseClass
{
osl::Mutex aListenerMutex;
- String aAccName;
+ OUString aAccName;
::accessibility::AccessibleTextHelper *pTextHelper;
SmEditWindow *pWin;
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 1d363163cbc1..939dd2c93e75 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -809,7 +809,7 @@ void SmMathConfig::StripFontFormatList( const std::vector< SmSym > &rSymbols )
SmFontFormatList aUsedList;
for (i = 0; i < rSymbols.size(); ++i)
{
- OSL_ENSURE( rSymbols[i].GetName().Len() > 0, "non named symbol" );
+ OSL_ENSURE( rSymbols[i].GetName().getLength() > 0, "non named symbol" );
aUsedList.GetFontFormatId( SmFontFormat( rSymbols[i].GetFace() ) , true );
}
const SmFormat & rStdFmt = GetStandardFormat();
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 9edb83ea1e2f..8ba0529bf2cf 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -338,7 +338,7 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){
if(newIt == pNewNodes->begin())
patchIt = insIt;
if((*newIt)->GetType() == NTEXT)
- PosAfterInsert = SmCaretPos(*newIt, ((SmTextNode*)*newIt)->GetText().Len());
+ PosAfterInsert = SmCaretPos(*newIt, ((SmTextNode*)*newIt)->GetText().getLength());
else
PosAfterInsert = SmCaretPos(*newIt, 1);
}
@@ -362,12 +362,12 @@ SmNodeList::iterator SmCursor::FindPositionInLineList(SmNodeList* pLineList, SmC
//Split textnode if needed
if(aCaretPos.Index > 0){
SmTextNode* pText = (SmTextNode*)aCaretPos.pSelectedNode;
- XubString str1 = pText->GetText().Copy(0, aCaretPos.Index);
- XubString str2 = pText->GetText().Copy(aCaretPos.Index);
+ OUString str1 = pText->GetText().copy(0, aCaretPos.Index);
+ OUString str2 = pText->GetText().copy(aCaretPos.Index);
pText->ChangeText(str1);
++it;
//Insert str2 as new text node
- if(str2.Len() > 0){
+ if(!str2.isEmpty()){
SmTextNode* pNewText = new SmTextNode(pText->GetToken(), pText->GetFontDesc());
pNewText->ChangeText(str2);
it = pLineList->insert(it, pNewText);
@@ -405,8 +405,8 @@ SmCaretPos SmCursor::PatchLineList(SmNodeList* pLineList, SmNodeList::iterator a
next->GetToken().eType == TNUMBER) ){
SmTextNode *pText = (SmTextNode*)prev,
*pOldN = (SmTextNode*)next;
- SmCaretPos retval(pText, pText->GetText().Len());
- String newText;
+ SmCaretPos retval(pText, pText->GetText().getLength());
+ OUString newText;
newText += pText->GetText();
newText += pOldN->GetText();
pText->ChangeText(newText);
@@ -426,14 +426,14 @@ SmCaretPos SmCursor::PatchLineList(SmNodeList* pLineList, SmNodeList::iterator a
if(aIter == pLineList->begin())
return SmCaretPos();
if((*aIter)->GetType() == NTEXT)
- return SmCaretPos(*aIter, ((SmTextNode*)*aIter)->GetText().Len());
+ return SmCaretPos(*aIter, ((SmTextNode*)*aIter)->GetText().getLength());
return SmCaretPos(*aIter, 1);
}
if(prev && next && next->GetType() == NPLACE && !SmNodeListParser::IsOperator(prev->GetToken())){
aIter = pLineList->erase(aIter);
delete next;
if(prev->GetType() == NTEXT)
- return SmCaretPos(prev, ((SmTextNode*)prev)->GetText().Len());
+ return SmCaretPos(prev, ((SmTextNode*)prev)->GetText().getLength());
return SmCaretPos(prev, 1);
}
@@ -441,7 +441,7 @@ SmCaretPos SmCursor::PatchLineList(SmNodeList* pLineList, SmNodeList::iterator a
if(!prev) //return an invalid to indicate we're in front of line
return SmCaretPos();
if(prev->GetType() == NTEXT)
- return SmCaretPos(prev, ((SmTextNode*)prev)->GetText().Len());
+ return SmCaretPos(prev, ((SmTextNode*)prev)->GetText().getLength());
return SmCaretPos(prev, 1);
}
@@ -454,19 +454,19 @@ SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList,
//Split text nodes
if((*it)->GetType() == NTEXT) {
SmTextNode* pText = (SmTextNode*)*it;
- String aText = pText->GetText();
+ OUString aText = pText->GetText();
//Start and lengths of the segments, 2 is the selected segment
int start2 = pText->GetSelectionStart(),
start3 = pText->GetSelectionEnd(),
len1 = start2 - 0,
len2 = start3 - start2,
- len3 = aText.Len() - start3;
+ len3 = aText.getLength() - start3;
SmToken aToken = pText->GetToken();
sal_uInt16 eFontDesc = pText->GetFontDesc();
//If we need make segment 1
if(len1 > 0) {
int start1 = 0;
- String str = aText.Copy(start1, len1);
+ OUString str = aText.copy(start1, len1);
pText->ChangeText(str);
++it;
} else {//Remove it if not needed
@@ -477,14 +477,14 @@ SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList,
retval = it;
//if we need make segment 3
if(len3 > 0) {
- String str = aText.Copy(start3, len3);
+ OUString str = aText.copy(start3, len3);
SmTextNode* pSeg3 = new SmTextNode(aToken, eFontDesc);
pSeg3->ChangeText(str);
retval = pLineList->insert(it, pSeg3);
}
//If we need to save the selected text
if(pSelectedNodes && len2 > 0) {
- String str = aText.Copy(start2, len2);
+ OUString str = aText.copy(start2, len2);
SmTextNode* pSeg2 = new SmTextNode(aToken, eFontDesc);
pSeg2->ChangeText(str);
pSelectedNodes->push_back(pSeg2);
@@ -1156,12 +1156,12 @@ void SmCursor::InsertCommand(sal_uInt16 nCommand) {
InsertLimit(CSUP, true);
break;
default:
- InsertCommandText(SmResId(nCommand));
+ InsertCommandText(SM_RESSTR(nCommand));
break;
}
}
-void SmCursor::InsertCommandText(XubString aCommandText) {
+void SmCursor::InsertCommandText(OUString aCommandText) {
//Parse the the sub expression
SmNode* pSubExpr = SmParser().ParseExpression(aCommandText);
@@ -1203,7 +1203,7 @@ void SmCursor::Copy(){
SmTextNode *pClone = new SmTextNode( pText->GetToken(), pText->GetFontDesc() );
int start = pText->GetSelectionStart(),
length = pText->GetSelectionEnd() - pText->GetSelectionStart();
- pClone->ChangeText(pText->GetText().Copy(start, length));
+ pClone->ChangeText(pText->GetText().copy(start, length));
pClone->SetScaleMode(pText->GetScaleMode());
pList->push_front(pClone);
} else {
@@ -1323,7 +1323,7 @@ SmNodeList* SmCursor::CloneLineToList(SmStructureNode* pLine, bool bOnlyIfSelect
SmTextNode *pClone = new SmTextNode( it->GetToken(), pText->GetFontDesc() );
int start = pText->GetSelectionStart(),
length = pText->GetSelectionEnd() - pText->GetSelectionStart();
- pClone->ChangeText(pText->GetText().Copy(start, length));
+ pClone->ChangeText(pText->GetText().copy(start, length));
pClone->SetScaleMode(pText->GetScaleMode());
pList->push_back(pClone);
} else
@@ -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;
@@ -1490,7 +1490,7 @@ bool SmCursor::IsAtTailOfBracket(SmBracketType eBracketType, SmBraceNode** ppBra
if (pNode->GetType() == NTEXT) {
SmTextNode* pTextNode = static_cast<SmTextNode*>(pNode);
- if (pos.Index < pTextNode->GetText().Len()) {
+ if (pos.Index < pTextNode->GetText().getLength()) {
// The cursor is on a text node and at the middle of it.
return false;
}
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index a94a4b9d2b01..82a0e7228068 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -59,18 +59,18 @@ using ::rtl::OUString;
class SmFontStyles
{
- String aNormal;
- String aBold;
- String aItalic;
- String aBoldItalic;
- String aEmpty;
+ OUString aNormal;
+ OUString aBold;
+ OUString aItalic;
+ OUString aBoldItalic;
+ OUString aEmpty;
public:
SmFontStyles();
sal_uInt16 GetCount() const { return 4; }
- const String & GetStyleName( const Font &rFont ) const;
- const String & GetStyleName( sal_uInt16 nIdx ) const;
+ const OUString& GetStyleName( const Font &rFont ) const;
+ const OUString& GetStyleName( sal_uInt16 nIdx ) const;
};
@@ -81,12 +81,12 @@ SmFontStyles::SmFontStyles() :
{
aBoldItalic = aBold;
- aBoldItalic.AppendAscii( ", " );
+ aBoldItalic += ", ";
aBoldItalic += aItalic;
}
-const String & SmFontStyles::GetStyleName( const Font &rFont ) const
+const OUString& SmFontStyles::GetStyleName( const Font &rFont ) const
{
//! compare also SmSpecialNode::Prepare
bool bBold = IsBold( rFont ),
@@ -98,12 +98,11 @@ const String & SmFontStyles::GetStyleName( const Font &rFont ) const
return aItalic;
else if (bBold)
return aBold;
- else
- return aNormal;
+ return aNormal;
}
-const String & SmFontStyles::GetStyleName( sal_uInt16 nIdx ) const
+const OUString& SmFontStyles::GetStyleName( sal_uInt16 nIdx ) const
{
// 0 = "normal", 1 = "italic",
// 2 = "bold", 3 = "bold italic"
@@ -130,17 +129,17 @@ const SmFontStyles & GetFontStyles()
/////////////////////////////////////////////////////////////////
-void SetFontStyle(const XubString &rStyleName, Font &rFont)
+void SetFontStyle(const OUString &rStyleName, Font &rFont)
{
// Find index related to StyleName. For an empty StyleName it's assumed to be
// 0 (neither bold nor italic).
sal_uInt16 nIndex = 0;
- if (rStyleName.Len())
+ if (!rStyleName.isEmpty())
{
sal_uInt16 i;
const SmFontStyles &rStyles = GetFontStyles();
- for (i = 0; i < rStyles.GetCount(); i++)
- if (rStyleName.CompareTo( rStyles.GetStyleName(i) ) == COMPARE_EQUAL)
+ for (i = 0; i < rStyles.GetCount(); ++i)
+ if (rStyleName == rStyles.GetStyleName(i))
break;
#if OSL_DEBUG_LEVEL > 1
OSL_ENSURE(i < rStyles.GetCount(), "style-name unknown");
@@ -242,7 +241,7 @@ void SmShowFont::Paint(const Rectangle& rRect )
{
Control::Paint( rRect );
- XubString Text (GetFont().GetName());
+ OUString Text (GetFont().GetName());
Size TextSize(GetTextWidth(Text), GetTextHeight());
DrawText(Point((GetOutputSize().Width() - TextSize.Width()) / 2,
@@ -801,10 +800,7 @@ void SmDistanceDialog::SetHelpId(MetricField &rField, const rtl::OString& sHelpI
// HelpIDs which are explicitly set in this way have to be defined in the
// util directory in the file "hidother.src" with the help of "hidspecial"!
- const XubString aEmptyText;
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE(aEmptyText.Len() == 0, "Sm: Ooops...");
-#endif
+ const OUString aEmptyText;
rField.SetHelpId(sHelpId);
rField.SetHelpText(aEmptyText);
@@ -1360,7 +1356,7 @@ void SmShowSymbol::Paint(const Rectangle &rRect)
{
Control::Paint( rRect );
- const XubString &rText = GetText();
+ const OUString &rText = GetText();
Size aTextSize(GetTextWidth(rText), GetTextHeight());
DrawText(Point((GetOutputSize().Width() - aTextSize.Width()) / 2,
@@ -1407,8 +1403,8 @@ void SmSymbolDialog::FillSymbolSets(bool bDeleteText)
if (bDeleteText)
aSymbolSets.SetNoSelection();
- std::set< String > aSybolSetNames( rSymbolMgr.GetSymbolSetNames() );
- std::set< String >::const_iterator aIt( aSybolSetNames.begin() );
+ std::set< OUString > aSybolSetNames( rSymbolMgr.GetSymbolSetNames() );
+ std::set< OUString >::const_iterator aIt( aSybolSetNames.begin() );
for ( ; aIt != aSybolSetNames.end(); ++aIt)
aSymbolSets.InsertEntry( *aIt );
}
@@ -1447,7 +1443,7 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton )
SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, pFontListDev, rSymbolMgr);
// set current symbol and SymbolSet for the new dialog
- const XubString aSymSetName (aSymbolSets.GetSelectEntry()),
+ const OUString aSymSetName (aSymbolSets.GetSelectEntry()),
aSymName (aSymbolName.GetText());
pDialog->SelectOldSymbolSet(aSymSetName);
pDialog->SelectOldSymbol(aSymName);
@@ -1455,7 +1451,7 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton )
pDialog->SelectSymbol(aSymName);
// remember old SymbolSet
- XubString aOldSymbolSet (aSymbolSets.GetSelectEntry());
+ OUString aOldSymbolSet (aSymbolSets.GetSelectEntry());
sal_uInt16 nSymPos = GetSelectedSymbol();
@@ -1625,7 +1621,7 @@ void SmSymbolDialog::DataChanged( const DataChangedEvent& rDCEvt )
}
-bool SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName)
+bool SmSymbolDialog::SelectSymbolSet(const OUString &rSymbolSetName)
{
bool bRet = false;
sal_uInt16 nPos = aSymbolSets.GetEntryPos(rSymbolSetName);
@@ -1663,7 +1659,7 @@ void SmSymbolDialog::SelectSymbol(sal_uInt16 nSymbolNo)
aSymbolSetDisplay.SelectSymbol(nSymbolNo);
aSymbolDisplay.SetSymbol(pSym);
- aSymbolName.SetText(pSym ? pSym->GetName() : XubString());
+ aSymbolName.SetText(pSym ? pSym->GetName() : OUString());
}
@@ -1751,8 +1747,8 @@ void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, bool bDeleteText)
if (bDeleteText)
rComboBox.SetText(rtl::OUString());
- const std::set< String > aSymbolSetNames( aSymbolMgrCopy.GetSymbolSetNames() );
- std::set< String >::const_iterator aIt( aSymbolSetNames.begin() );
+ const std::set< OUString > aSymbolSetNames( aSymbolMgrCopy.GetSymbolSetNames() );
+ std::set< OUString >::const_iterator aIt( aSymbolSetNames.begin() );
for ( ; aIt != aSymbolSetNames.end(); ++aIt)
rComboBox.InsertEntry( *aIt );
}
@@ -1782,8 +1778,8 @@ void SmSymDefineDialog::FillStyles(bool bDeleteText)
if (bDeleteText)
aStyles.SetText(rtl::OUString());
- XubString aText (aFonts.GetSelectEntry());
- if (aText.Len() != 0)
+ OUString aText (aFonts.GetSelectEntry());
+ if (!aText.isEmpty())
{
// use own StyleNames
const SmFontStyles &rStyles = GetFontStyles();
@@ -2040,16 +2036,16 @@ void SmSymDefineDialog::UpdateButtons()
bool bAdd = false,
bChange = false,
bDelete = false;
- XubString aTmpSymbolName (aSymbols.GetText()),
+ OUString aTmpSymbolName (aSymbols.GetText()),
aTmpSymbolSetName (aSymbolSets.GetText());
- if (aTmpSymbolName.Len() > 0 && aTmpSymbolSetName.Len() > 0)
+ if (aTmpSymbolName.getLength() > 0 && aTmpSymbolSetName.getLength() > 0)
{
// are all settings equal?
//! (Font-, Style- und SymbolSet name comparison is not case sensitive)
bool bEqual = pOrigSymbol
- && aTmpSymbolSetName.EqualsIgnoreCaseAscii(aOldSymbolSetName.GetText())
- && aTmpSymbolName.Equals(pOrigSymbol->GetName())
+ && aTmpSymbolSetName.equalsIgnoreAsciiCase(aOldSymbolSetName.GetText())
+ && aTmpSymbolName.equals(pOrigSymbol->GetName())
&& aFonts.GetSelectEntry().EqualsIgnoreCaseAscii(
pOrigSymbol->GetFace().GetName())
&& aStyles.GetText().EqualsIgnoreCaseAscii(
@@ -2245,7 +2241,7 @@ void SmSymDefineDialog::SetSymbolSetManager(const SmSymbolManager &rMgr)
bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
- const XubString &rSymbolSetName, bool bDeleteText)
+ const OUString &rSymbolSetName, bool bDeleteText)
{
#if OSL_DEBUG_LEVEL > 1
OSL_ENSURE(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets,
@@ -2253,7 +2249,7 @@ bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
#endif
// trim SymbolName (no leading and trailing blanks)
- XubString aNormName (rSymbolSetName);
+ OUString aNormName (rSymbolSetName);
aNormName = comphelper::string::stripStart(aNormName, ' ');
aNormName = comphelper::string::stripEnd(aNormName, ' ');
// and remove possible deviations within the input
@@ -2283,7 +2279,7 @@ bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
// display a valid respectively no symbol when changing the SymbolSets
if (bIsOld)
{
- XubString aTmpOldSymbolName;
+ OUString aTmpOldSymbolName;
if (aOldSymbols.GetEntryCount() > 0)
aTmpOldSymbolName = aOldSymbols.GetEntry(0);
SelectSymbol(aOldSymbols, aTmpOldSymbolName, true);
@@ -2296,13 +2292,13 @@ bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
void SmSymDefineDialog::SetOrigSymbol(const SmSym *pSymbol,
- const XubString &rSymbolSetName)
+ const OUString &rSymbolSetName)
{
// clear old symbol
delete pOrigSymbol;
pOrigSymbol = 0;
- XubString aSymName,
+ OUString aSymName,
aSymSetName;
if (pSymbol)
{
@@ -2324,7 +2320,7 @@ void SmSymDefineDialog::SetOrigSymbol(const SmSym *pSymbol,
bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
- const XubString &rSymbolName, bool bDeleteText)
+ const OUString &rSymbolName, bool bDeleteText)
{
#if OSL_DEBUG_LEVEL > 1
OSL_ENSURE(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols,
@@ -2332,7 +2328,7 @@ bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
#endif
// trim SymbolName (no blanks)
- XubString aNormName(comphelper::string::remove(rSymbolName, ' '));
+ OUString aNormName(comphelper::string::remove(rSymbolName, ' '));
// and remove possible deviations within the input
rComboBox.SetText(aNormName);
@@ -2379,7 +2375,7 @@ bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
{
// if there's a change of the old symbol, show only the available ones, otherwise show none
const SmSym *pOldSymbol = NULL;
- XubString aTmpOldSymbolSetName;
+ OUString aTmpOldSymbolSetName;
if (nPos != COMBOBOX_ENTRY_NOTFOUND)
{
pOldSymbol = aSymbolMgrCopy.GetSymbolByName(aNormName);
@@ -2396,7 +2392,7 @@ bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
}
-void SmSymDefineDialog::SetFont(const XubString &rFontName, const XubString &rStyleName)
+void SmSymDefineDialog::SetFont(const OUString &rFontName, const OUString &rStyleName)
{
// get Font (FontInfo) matching name and style
FontInfo aFI;
@@ -2432,7 +2428,7 @@ void SmSymDefineDialog::SetFont(const XubString &rFontName, const XubString &rSt
}
-bool SmSymDefineDialog::SelectFont(const XubString &rFontName, bool bApplyFont)
+bool SmSymDefineDialog::SelectFont(const OUString &rFontName, bool bApplyFont)
{
bool bRet = false;
sal_uInt16 nPos = aFonts.GetEntryPos(rFontName);
@@ -2460,7 +2456,7 @@ bool SmSymDefineDialog::SelectFont(const XubString &rFontName, bool bApplyFont)
}
-bool SmSymDefineDialog::SelectStyle(const XubString &rStyleName, bool bApplyFont)
+bool SmSymDefineDialog::SelectStyle(const OUString &rStyleName, bool bApplyFont)
{
bool bRet = false;
sal_uInt16 nPos = aStyles.GetEntryPos(rStyleName);
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 5091d409aedc..b6d83e0f6e9f 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -237,7 +237,7 @@ void SmEditWindow::DataChanged( const DataChangedEvent& )
// forces new settings to be used
// unfortunately this resets the whole edit engine
// thus we need to save at least the text
- String aTxt( pEditEngine->GetText( LINEEND_LF ) );
+ OUString aTxt( pEditEngine->GetText( LINEEND_LF ) );
pEditEngine->Clear(); //incorrect font size
pEditEngine->SetText( aTxt );
}
@@ -686,8 +686,8 @@ bool SmEditWindow::IsAllSelected() const
sal_Int32 nParaCnt = pEditEngine->GetParagraphCount();
if (!(nParaCnt - 1))
{
- String Text( pEditEngine->GetText( LINEEND_LF ) );
- bRes = !eSelection.nStartPos && (eSelection.nEndPos == Text.Len () - 1);
+ sal_uInt16 nTextLen = pEditEngine->GetText( LINEEND_LF ).Len();
+ bRes = !eSelection.nStartPos && (eSelection.nEndPos == nTextLen - 1);
}
else
{
@@ -719,7 +719,7 @@ void SmEditWindow::InsertCommand(sal_uInt16 nCommand)
aSelection.nEndPara = aSelection.nStartPara;
OSL_ENSURE( pEditView, "NULL pointer" );
- String aText = String(SmResId(nCommand));
+ OUString aText = SM_RESSTR(nCommand);
pEditView->InsertText(aText);
if (HasMark(aText))
@@ -729,7 +729,7 @@ void SmEditWindow::InsertCommand(sal_uInt16 nCommand)
}
else
{ // set selection after inserted text
- aSelection.nEndPos = aSelection.nEndPos + sal::static_int_cast< xub_StrLen >(aText.Len());
+ aSelection.nEndPos += aText.getLength();
aSelection.nStartPos = aSelection.nEndPos;
pEditView->SetSelection(aSelection);
}
@@ -761,23 +761,21 @@ void SmEditWindow::SelNextMark()
if (pEditEngine && pEditView)
{
ESelection eSelection = pEditView->GetSelection();
- sal_uInt16 Pos = eSelection.nEndPos;
- rtl::OUString aMark("<?>");
- String aText;
+ sal_Int32 nPos = eSelection.nEndPos;
sal_uInt16 nCounts = pEditEngine->GetParagraphCount();
while (eSelection.nEndPara < nCounts)
{
- aText = pEditEngine->GetText( eSelection.nEndPara );
- Pos = aText.Search(aMark, Pos);
-
- if (Pos != STRING_NOTFOUND)
+ OUString aText = pEditEngine->GetText(eSelection.nEndPara);
+ nPos = aText.indexOf("<?>", nPos);
+ if (nPos != -1)
{
- pEditView->SetSelection(ESelection (eSelection.nEndPara, Pos, eSelection.nEndPara, Pos + 3));
+ pEditView->SetSelection(ESelection(
+ eSelection.nEndPara, nPos, eSelection.nEndPara, nPos + 3));
break;
}
- Pos = 0;
+ nPos = 0;
eSelection.nEndPara++;
}
}
@@ -791,43 +789,43 @@ void SmEditWindow::SelPrevMark()
if (pEditEngine && pEditView)
{
ESelection eSelection = pEditView->GetSelection();
- sal_uInt16 Pos = STRING_NOTFOUND;
- xub_StrLen Max = eSelection.nStartPos;
- String Text( pEditEngine->GetText( eSelection.nStartPara ) );
- rtl::OUString aMark("<?>");
+ sal_Int32 nPos = -1;
+ sal_Int32 nMax = eSelection.nStartPos;
+ OUString aText(pEditEngine->GetText(eSelection.nStartPara));
+ OUString aMark("<?>");
sal_uInt16 nCounts = pEditEngine->GetParagraphCount();
do
{
- sal_uInt16 Fnd = Text.Search(aMark, 0);
-
- while ((Fnd < Max) && (Fnd != STRING_NOTFOUND))
+ sal_Int32 nMarkIndex = aText.indexOf(aMark);
+ while ((nMarkIndex < nMax) && (nMarkIndex != -1))
{
- Pos = Fnd;
- Fnd = Text.Search(aMark, Fnd + 1);
+ nPos = nMarkIndex;
+ nMarkIndex = aText.indexOf(aMark, nMarkIndex + 1);
}
- if (Pos == STRING_NOTFOUND)
+ if (nPos == -1)
{
eSelection.nStartPara--;
- Text = pEditEngine->GetText( eSelection.nStartPara );
- Max = Text.Len();
+ aText = pEditEngine->GetText(eSelection.nStartPara);
+ nMax = aText.getLength();
}
}
while ((eSelection.nStartPara < nCounts) &&
- (Pos == STRING_NOTFOUND));
+ (nPos == -1));
- if (Pos != STRING_NOTFOUND)
+ if (nPos != -1)
{
- pEditView->SetSelection(ESelection (eSelection.nStartPara, Pos, eSelection.nStartPara, Pos + 3));
+ pEditView->SetSelection(ESelection(
+ eSelection.nStartPara, nPos, eSelection.nStartPara, nPos + 3));
}
}
}
-bool SmEditWindow::HasMark(const String& rText) const
+bool SmEditWindow::HasMark(const OUString& rText) const
// returns true iff 'rText' contains a mark
{
- return rText.SearchAscii("<?>", 0) != STRING_NOTFOUND;
+ return rText.indexOf("<?>") != -1;
}
void SmEditWindow::MouseMove(const MouseEvent &rEvt)
@@ -914,12 +912,12 @@ void SmEditWindow::Delete()
}
}
-void SmEditWindow::InsertText(const String& Text)
+void SmEditWindow::InsertText(const OUString& rText)
{
OSL_ENSURE( pEditView, "EditView missing" );
if (pEditView)
{
- pEditView->InsertText(Text);
+ pEditView->InsertText(rText);
aModifyTimer.Start();
StartCursorMove();
}
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 20a3e74bcb0c..1ecaff1db896 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -134,7 +134,7 @@ sal_Bool SmXMLExportWrapper::Export(SfxMedium &rMedium)
if (xStatusIndicator.is())
{
sal_Int32 nProgressRange = bFlat ? 1 : 3;
- xStatusIndicator->start(String(SmResId(STR_STATSTR_WRITING)),
+ xStatusIndicator->start(SM_RESSTR(STR_STATSTR_WRITING),
nProgressRange);
}
}
@@ -391,7 +391,7 @@ sal_Int64 SAL_CALL SmXMLExport::getSomething(
throw(uno::RuntimeException)
{
if ( rId.getLength() == 16 &&
- 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ 0 == memcmp( getUnoTunnelId().getConstArray(),
rId.getConstArray(), 16 ) )
return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this));
@@ -824,7 +824,7 @@ void SmXMLExport::ExportMath(const SmNode *pNode, int /*nLevel*/)
const SmMathSymbolNode *pTemp = static_cast<const SmMathSymbolNode *>(pNode);
SvXMLElementExport aMath(*this, XML_NAMESPACE_MATH, XML_MO, sal_True, sal_False);
sal_Unicode nArse[2];
- nArse[0] = pTemp->GetText().GetChar(0);
+ nArse[0] = pTemp->GetText()[0];
sal_Unicode cTmp = ConvertMathToMathML( nArse[0] );
if (cTmp != 0)
nArse[0] = cTmp;
@@ -845,9 +845,9 @@ void SmXMLExport::ExportText(const SmNode *pNode, int /*nLevel*/)
//Note that we change the fontstyle to italic for strings that
//are italic and longer than a single character.
sal_Bool bIsItalic = IsItalic( pTemp->GetFont() );
- if ((pTemp->GetText().Len() > 1) && bIsItalic)
+ if ((pTemp->GetText().getLength() > 1) && bIsItalic)
AddAttribute(XML_NAMESPACE_MATH, XML_MATHVARIANT, XML_ITALIC);
- else if ((pTemp->GetText().Len() == 1) && !bIsItalic)
+ else if ((pTemp->GetText().getLength() == 1) && !bIsItalic)
AddAttribute(XML_NAMESPACE_MATH, XML_MATHVARIANT, XML_NORMAL);
pText = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MI,sal_True,sal_False);
break;
@@ -859,7 +859,7 @@ void SmXMLExport::ExportText(const SmNode *pNode, int /*nLevel*/)
pText = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MTEXT,sal_True,sal_False);
break;
}
- GetDocHandler()->characters(OUString(pTemp->GetText().GetBuffer()));
+ GetDocHandler()->characters(pTemp->GetText());
delete pText;
}
@@ -1030,11 +1030,11 @@ void SmXMLExport::ExportBrace(const SmNode *pNode, int nLevel)
sal_Unicode nArse[2];
nArse[1] = 0;
nArse[0] = static_cast<
- const SmMathSymbolNode* >(pLeft)->GetText().GetChar(0);
+ const SmMathSymbolNode* >(pLeft)->GetText()[0];
OSL_ENSURE(nArse[0] != 0xffff,"Non existent symbol");
AddAttribute(XML_NAMESPACE_MATH, XML_OPEN,nArse);
nArse[0] = static_cast<
- const SmMathSymbolNode* >(pRight)->GetText().GetChar(0);
+ const SmMathSymbolNode* >(pRight)->GetText()[0];
OSL_ENSURE(nArse[0] != 0xffff,"Non existent symbol");
AddAttribute(XML_NAMESPACE_MATH, XML_CLOSE,nArse);
pFences = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MFENCED,
@@ -1406,8 +1406,8 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel)
{
sal_Unicode cTmp = 0;
const SmTextNode *pTemp = static_cast< const SmTextNode * >(pNode);
- if (pTemp->GetText().Len() > 0)
- cTmp = ConvertMathToMathML( pTemp->GetText().GetChar(0) );
+ if (!pTemp->GetText().isEmpty())
+ cTmp = ConvertMathToMathML( pTemp->GetText()[0] );
if (cTmp == 0)
{
// no conversion to MathML implemented -> export it as text
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index a57b83b51899..2273c10a4b46 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -26,7 +26,7 @@ one go*/
#include <com/sun/star/xml/sax/XEntityResolver.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XDTDHandler.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XActiveDataControl.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -38,6 +38,7 @@ one go*/
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/uno/Any.h>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/genericpropertyset.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
@@ -171,8 +172,7 @@ sal_uLong SmXMLImportWrapper::Import(SfxMedium &rMedium)
sal_Int32 nProgressRange(nSteps);
if (xStatusIndicator.is())
{
- xStatusIndicator->start(String(SmResId(STR_STATSTR_READING)),
- nProgressRange);
+ xStatusIndicator->start(SM_RESSTR(STR_STATSTR_READING), nProgressRange);
}
nSteps=0;
@@ -274,13 +274,7 @@ sal_uLong SmXMLImportWrapper::ReadThroughComponent(
aParserInput.aInputStream = xInputStream;
// get parser
- Reference< xml::sax::XParser > xParser(
- rFactory->createInstance(
- "com.sun.star.xml.sax.Parser"),
- UNO_QUERY );
- OSL_ENSURE( xParser.is(), "Can't create parser" );
- if ( !xParser.is() )
- return nError;
+ Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(rFactory));
Sequence<Any> aArgs( 1 );
aArgs[0] <<= rPropSet;
@@ -543,7 +537,7 @@ sal_Int64 SAL_CALL SmXMLImport::getSomething(
throw(uno::RuntimeException)
{
if ( rId.getLength() == 16 &&
- 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ 0 == memcmp( getUnoTunnelId().getConstArray(),
rId.getConstArray(), 16 ) )
return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this));
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 1fb812baf268..69aeabe2ce77 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -1995,7 +1995,7 @@ sal_uInt8 MathType::HandleNodes(SmNode *pNode,int nLevel)
SmTextNode *pText=(SmTextNode *)pNode;
//if the token str and the result text are the same then this
//is to be seen as text, else assume its a mathchar
- if (pText->GetText() == pText->GetToken().aText)
+ if (pText->GetText() == OUString(pText->GetToken().aText))
HandleText(pText,nLevel);
else
HandleMath(pText,nLevel);
@@ -3078,16 +3078,16 @@ void MathType::HandleMath(SmNode *pNode, int /*nLevel*/)
return;
}
SmMathSymbolNode *pTemp=(SmMathSymbolNode *)pNode;
- for(xub_StrLen i=0;i<pTemp->GetText().Len();i++)
+ for(sal_Int32 i=0;i<pTemp->GetText().getLength();i++)
{
- sal_Unicode nArse = SmTextNode::ConvertSymbolToUnicode(pTemp->GetText().GetChar(i));
+ sal_Unicode nArse = SmTextNode::ConvertSymbolToUnicode(pTemp->GetText()[i]);
if ((nArse == 0x2224) || (nArse == 0x2288) || (nArse == 0x2285) ||
(nArse == 0x2289))
{
*pS << sal_uInt8(CHAR|0x20);
}
else if ((nPendingAttributes) &&
- (i == ((pTemp->GetText().Len()+1)/2)-1))
+ (i == ((pTemp->GetText().getLength()+1)/2)-1))
{
*pS << sal_uInt8(0x22);
}
@@ -3209,7 +3209,7 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel)
case TOVERLINE: //If the next node is not text
//or text with more than one char
if ((pIsText->GetToken().eType != TTEXT) ||
- (pIsText->GetText().Len() > 1))
+ (pIsText->GetText().getLength() > 1))
nOldPending = StartTemplate(0x11);
break;
default:
@@ -3229,7 +3229,7 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel)
break;
case TOVERLINE:
if ((pIsText->GetToken().eType != TTEXT) ||
- (pIsText->GetText().Len() > 1))
+ (pIsText->GetText().getLength() > 1))
EndTemplate(nOldPending);
break;
default:
@@ -3276,7 +3276,7 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel)
break;
case TOVERLINE:
if ((pIsText->GetToken().eType == TTEXT) &&
- (pIsText->GetText().Len() == 1))
+ (pIsText->GetText().getLength() == 1))
*pS << sal_uInt8(17);
break;
case TBREVE:
@@ -3302,10 +3302,10 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel)
void MathType::HandleText(SmNode *pNode, int /*nLevel*/)
{
SmTextNode *pTemp=(SmTextNode *)pNode;
- for(xub_StrLen i=0;i<pTemp->GetText().Len();i++)
+ for(sal_Int32 i=0;i<pTemp->GetText().getLength();i++)
{
if ((nPendingAttributes) &&
- (i == ((pTemp->GetText().Len()+1)/2)-1))
+ (i == ((pTemp->GetText().getLength()+1)/2)-1))
{
*pS << sal_uInt8(0x22); //char, with attributes right
//after the character
@@ -3319,7 +3319,7 @@ void MathType::HandleText(SmNode *pNode, int /*nLevel*/)
else if (pNode->GetFont().GetWeight() == WEIGHT_BOLD)
nFace = 0x7;
*pS << sal_uInt8(nFace+128); //typeface
- sal_uInt16 nChar = pTemp->GetText().GetChar(i);
+ sal_uInt16 nChar = pTemp->GetText()[i];
*pS << SmTextNode::ConvertSymbolToUnicode(nChar);
//Mathtype can only have these sort of character
@@ -3335,7 +3335,7 @@ void MathType::HandleText(SmNode *pNode, int /*nLevel*/)
//entities which cannot occur in mathtype e.g. a Summation
//symbol so these attributes may be lost
if ((nPendingAttributes) &&
- (i == ((pTemp->GetText().Len()+1)/2)-1))
+ (i == ((pTemp->GetText().getLength()+1)/2)-1))
{
*pS << sal_uInt8(EMBEL);
while (nPendingAttributes)
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index e8bd3b4f5213..972f725827a0 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -2458,11 +2458,11 @@ void SmTextNode::AdjustFontDesc()
nTok = pEntry->eType;
nFontDesc = FNT_FUNCTION;
} else {
- sal_Unicode firstChar = aText.GetChar(0);
+ sal_Unicode firstChar = aText[0];
if( ('0' <= firstChar && firstChar <= '9') || firstChar == '.' || firstChar == ',') {
nFontDesc = FNT_NUMBER;
nTok = TNUMBER;
- } else if (aText.Len() > 1) {
+ } else if (aText.getLength() > 1) {
nFontDesc = FNT_VARIABLE;
nTok = TIDENT;
} else {
@@ -2734,9 +2734,9 @@ void SmMathSymbolNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocSh
void SmMathSymbolNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
{
- const XubString &rText = GetText();
+ const OUString &rText = GetText();
- if (rText.Len() == 0 || rText.GetChar(0) == xub_Unicode('\0'))
+ if (rText.isEmpty() || rText[0] == '\0')
{ SmRect::operator = (SmRect());
return;
}
@@ -2860,7 +2860,7 @@ void SmAttributNode::CreateTextFromNode(String &rText)
/**************************************************************************/
-bool lcl_IsFromGreekSymbolSet( const String &rTokenText )
+static bool lcl_IsFromGreekSymbolSet( const String &rTokenText )
{
bool bRes = false;
@@ -2869,7 +2869,7 @@ bool lcl_IsFromGreekSymbolSet( const String &rTokenText )
{
String aName( rTokenText.Copy(1) );
SmSym *pSymbol = SM_MOD()->GetSymbolManager().GetSymbolByName( aName );
- if (pSymbol && GetExportSymbolSetName( pSymbol->GetSymbolSetName() ).EqualsAscii( "Greek" ) )
+ if (pSymbol && GetExportSymbolSetName(pSymbol->GetSymbolSetName()) == "Greek")
bRes = true;
}
@@ -2902,7 +2902,7 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell
if (NULL != (pSym = pp->GetSymbolManager().GetSymbolByName( aName )))
{
sal_UCS4 cChar = pSym->GetCharacter();
- String aTmp( OUString( &cChar, 1 ) );
+ OUString aTmp( &cChar, 1 );
SetText( aTmp );
GetFont() = pSym->GetFace();
}
@@ -2928,7 +2928,7 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell
if (bIsFromGreekSymbolSet)
{
- OSL_ENSURE( GetText().Len() == 1, "a symbol should only consist of 1 char!" );
+ OSL_ENSURE( GetText().getLength() == 1, "a symbol should only consist of 1 char!" );
bool bItalic = false;
sal_Int16 nStyle = rFormat.GetGreekCharStyle();
OSL_ENSURE( nStyle >= 0 && nStyle <= 2, "unexpected value for GreekCharStyle" );
@@ -2936,12 +2936,12 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell
bItalic = true;
else if (nStyle == 2)
{
- String aTmp( GetText() );
- if (aTmp.Len() > 0)
+ const OUString& rTmp(GetText());
+ if (rTmp.isEmpty())
{
const sal_Unicode cUppercaseAlpha = 0x0391;
const sal_Unicode cUppercaseOmega = 0x03A9;
- sal_Unicode cChar = aTmp.GetBuffer()[0];
+ sal_Unicode cChar = rTmp[0];
// uppercase letters should be straight and lowercase letters italic
bItalic = !(cUppercaseAlpha <= cChar && cChar <= cUppercaseOmega);
}
@@ -3023,7 +3023,7 @@ void SmErrorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
SmTmpDevice aTmpDev ((OutputDevice &) rDev, true);
aTmpDev.SetFont(GetFont());
- const XubString &rText = GetText();
+ const OUString &rText = GetText();
SmRect::operator = (SmRect(aTmpDev, &rFormat, rText, GetFont().GetBorderWidth()));
}
diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index f9b716237461..a918cb295265 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -85,11 +85,11 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
m_pSerializer->startElementNS( XML_m, XML_t, FSNS( XML_xml, XML_space ), "preserve", FSEND );
SmTextNode* pTemp=(SmTextNode* )pNode;
SAL_INFO( "starmath.ooxml", "Text:" << OUStringToOString( pTemp->GetText(), RTL_TEXTENCODING_UTF8 ).getStr());
- for(xub_StrLen i=0;i<pTemp->GetText().Len();i++)
+ for(sal_Int32 i=0;i<pTemp->GetText().getLength();i++)
{
#if 0
if ((nPendingAttributes) &&
- (i == ((pTemp->GetText().Len()+1)/2)-1))
+ (i == ((pTemp->GetText().getLength()+1)/2)-1))
{
*pS << sal_uInt8(0x22); //char, with attributes right
//after the character
@@ -104,7 +104,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
nFace = 0x7;
*pS << sal_uInt8(nFace+128); //typeface
#endif
- sal_uInt16 nChar = pTemp->GetText().GetChar(i);
+ sal_uInt16 nChar = pTemp->GetText()[i];
m_pSerializer->writeEscaped( OUString( SmTextNode::ConvertSymbolToUnicode(nChar)));
#if 0
@@ -121,7 +121,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
//entities which cannot occur in mathtype e.g. a Summation
//symbol so these attributes may be lost
if ((nPendingAttributes) &&
- (i == ((pTemp->GetText().Len()+1)/2)-1))
+ (i == ((pTemp->GetText().getLength()+1)/2)-1))
{
*pS << sal_uInt8(EMBEL);
while (nPendingAttributes)
@@ -250,8 +250,8 @@ static OString mathSymbolToString( const SmNode* node )
{
assert( node->GetType() == NMATH );
const SmTextNode* txtnode = static_cast< const SmTextNode* >( node );
- assert( txtnode->GetText().Len() == 1 );
- sal_Unicode chr = SmTextNode::ConvertSymbolToUnicode( txtnode->GetText().GetChar( 0 ));
+ assert( txtnode->GetText().getLength() == 1 );
+ sal_Unicode chr = SmTextNode::ConvertSymbolToUnicode( txtnode->GetText()[0] );
return OUStringToOString( OUString( chr ), RTL_TEXTENCODING_UTF8 );
}
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 827ff16251d5..6fcf81712a89 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1901,7 +1901,7 @@ void SmParser::Font()
// gets number used as arguments in Math formulas (e.g. 'size' command)
// Format: no negative numbers, must start with a digit, no exponent notation, ...
-bool lcl_IsNumber(const rtl::OUString& rText)
+static bool lcl_IsNumber(const rtl::OUString& rText)
{
bool bPoint = false;
const sal_Unicode* pBuffer = rText.getStr();
@@ -2452,7 +2452,7 @@ SmNode *SmParser::Parse(const String &rBuffer)
return result;
}
-SmNode *SmParser::ParseExpression(const String &rBuffer)
+SmNode *SmParser::ParseExpression(const OUString &rBuffer)
{
m_aBufferString = convertLineEnd(rBuffer, LINEEND_LF);
m_nBufferIndex = 0;
diff --git a/starmath/source/rtfexport.cxx b/starmath/source/rtfexport.cxx
index 7e37ac39de76..5d9695f71cdc 100644
--- a/starmath/source/rtfexport.cxx
+++ b/starmath/source/rtfexport.cxx
@@ -73,9 +73,9 @@ void SmRtfExport::HandleText(const SmNode* pNode, int /*nLevel*/)
SmTextNode* pTemp=(SmTextNode* )pNode;
SAL_INFO("starmath.rtf", "Text: " << pTemp->GetText());
- for (xub_StrLen i = 0; i < pTemp->GetText().Len(); i++)
+ for (sal_Int32 i = 0; i < pTemp->GetText().getLength(); i++)
{
- sal_uInt16 nChar = pTemp->GetText().GetChar(i);
+ sal_uInt16 nChar = pTemp->GetText()[i];
OUString aValue(SmTextNode::ConvertSymbolToUnicode(nChar));
m_pBuffer->append(msfilter::rtfutil::OutString(aValue, m_nEncoding));
}
@@ -197,10 +197,10 @@ OString mathSymbolToString(const SmNode* node, rtl_TextEncoding nEncoding)
{
assert(node->GetType() == NMATH);
const SmTextNode* txtnode = static_cast<const SmTextNode*>(node);
- if (txtnode->GetText().Len() == 0)
+ if (txtnode->GetText().isEmpty())
return OString();
- assert(txtnode->GetText().Len() == 1);
- sal_Unicode chr = SmTextNode::ConvertSymbolToUnicode(txtnode->GetText().GetChar(0));
+ assert(txtnode->GetText().getLength() == 1);
+ sal_Unicode chr = SmTextNode::ConvertSymbolToUnicode(txtnode->GetText()[0]);
OUString aValue(chr);
return msfilter::rtfutil::OutString(aValue, nEncoding);
}
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index 0cb52c93509b..7ab9f024d4db 100644
--- a/starmath/source/symbol.cxx
+++ b/starmath/source/symbol.cxx
@@ -47,8 +47,8 @@ using namespace ::rtl;
/**************************************************************************/
SmSym::SmSym() :
- m_aName(rtl::OUString("unknown")),
- m_aSetName(rtl::OUString("unknown")),
+ m_aName(OUString("unknown")),
+ m_aSetName(OUString("unknown")),
m_cChar('\0'),
m_bPredefined(false),
m_bDocSymbol(false)
@@ -65,8 +65,8 @@ SmSym::SmSym(const SmSym& rSymbol)
}
-SmSym::SmSym(const String& rName, const Font& rFont, sal_UCS4 cChar,
- const String& rSet, bool bIsPredefined)
+SmSym::SmSym(const OUString& rName, const Font& rFont, sal_UCS4 cChar,
+ const OUString& rSet, bool bIsPredefined)
{
m_aName = m_aExportName = rName;
@@ -141,7 +141,7 @@ SmSymbolManager& SmSymbolManager::operator = (const SmSymbolManager& rSymbolSetM
}
-SmSym *SmSymbolManager::GetSymbolByName(const String& rSymbolName)
+SmSym *SmSymbolManager::GetSymbolByName(const OUString& rSymbolName)
{
SmSym *pRes = NULL;
SymbolMap_t::iterator aIt( m_aSymbols.find( rSymbolName ) );
@@ -166,8 +166,8 @@ bool SmSymbolManager::AddOrReplaceSymbol( const SmSym &rSymbol, bool bForceChang
{
bool bAdded = false;
- const String aSymbolName( rSymbol.GetName() );
- if (aSymbolName.Len() > 0 && rSymbol.GetSymbolSetName().Len() > 0)
+ const OUString aSymbolName( rSymbol.GetName() );
+ if (aSymbolName.getLength() > 0 && rSymbol.GetSymbolSetName().getLength() > 0)
{
const SmSym *pFound = GetSymbolByName( aSymbolName );
const bool bSymbolConflict = pFound && !pFound->IsEqualInUI( rSymbol );
@@ -198,9 +198,9 @@ bool SmSymbolManager::AddOrReplaceSymbol( const SmSym &rSymbol, bool bForceChang
}
-void SmSymbolManager::RemoveSymbol( const String & rSymbolName )
+void SmSymbolManager::RemoveSymbol( const OUString & rSymbolName )
{
- if (rSymbolName.Len() > 0)
+ if (rSymbolName.getLength() > 0)
{
size_t nOldSize = m_aSymbols.size();
m_aSymbols.erase( rSymbolName );
@@ -209,9 +209,9 @@ void SmSymbolManager::RemoveSymbol( const String & rSymbolName )
}
-std::set< String > SmSymbolManager::GetSymbolSetNames() const
+std::set< OUString > SmSymbolManager::GetSymbolSetNames() const
{
- std::set< String > aRes;
+ std::set< OUString > aRes;
SymbolMap_t::const_iterator aIt( m_aSymbols.begin() );
for ( ; aIt != m_aSymbols.end(); ++aIt )
aRes.insert( aIt->second.GetSymbolSetName() );
@@ -219,10 +219,10 @@ std::set< String > SmSymbolManager::GetSymbolSetNames() const
}
-const SymbolPtrVec_t SmSymbolManager::GetSymbolSet( const String& rSymbolSetName )
+const SymbolPtrVec_t SmSymbolManager::GetSymbolSet( const OUString& rSymbolSetName )
{
SymbolPtrVec_t aRes;
- if (rSymbolSetName.Len() > 0)
+ if (rSymbolSetName.getLength() > 0)
{
SymbolMap_t::const_iterator aIt( m_aSymbols.begin() );
for ( ; aIt != m_aSymbols.end(); ++aIt )
@@ -246,8 +246,8 @@ void SmSymbolManager::Load()
for (size_t i = 0; i < nSymbolCount; ++i)
{
const SmSym &rSym = aSymbols[i];
- OSL_ENSURE( rSym.GetName().Len() > 0, "symbol without name!" );
- if (rSym.GetName().Len() > 0)
+ OSL_ENSURE( rSym.GetName().getLength() > 0, "symbol without name!" );
+ if (rSym.GetName().getLength() > 0)
AddOrReplaceSymbol( rSym );
}
m_bModified = true;
@@ -260,9 +260,9 @@ void SmSymbolManager::Load()
// now add a %i... symbol to the 'iGreek' set for every symbol found in the 'Greek' set.
SmLocalizedSymbolData aLocalizedData;
- const String aGreekSymbolSetName( aLocalizedData.GetUiSymbolSetName( OUString::createFromAscii( "Greek" ) ));
+ const OUString aGreekSymbolSetName(aLocalizedData.GetUiSymbolSetName(OUString("Greek")));
const SymbolPtrVec_t aGreekSymbols( GetSymbolSet( aGreekSymbolSetName ) );
- String aSymbolSetName = rtl::OUString('i');
+ String aSymbolSetName = OUString('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 = rtl::OUString('i');
+ String aSymbolName = OUString('i');
aSymbolName += rSym.GetName();
SmSym aSymbol( aSymbolName, aFont, rSym.GetCharacter(),
aSymbolSetName, true /*bIsPredefined*/ );
@@ -289,8 +289,8 @@ void SmSymbolManager::Save()
// prepare to skip symbols from iGreek on saving
SmLocalizedSymbolData aLocalizedData;
- String aSymbolSetName = rtl::OUString('i');
- aSymbolSetName += aLocalizedData.GetUiSymbolSetName( OUString::createFromAscii( "Greek" ));
+ OUString aSymbolSetName('i');
+ aSymbolSetName += aLocalizedData.GetUiSymbolSetName(OUString("Greek"));
SymbolPtrVec_t aTmp( GetSymbols() );
std::vector< SmSym > aSymbols;
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 07e4535a8765..7bfce092c64a 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -58,9 +58,6 @@ using namespace ::com::sun::star::formula;
using namespace ::com::sun::star::view;
using namespace ::com::sun::star::script;
-
-using rtl::OUString;
-
#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
@@ -91,9 +88,9 @@ SmPrintUIOptions::SmPrintUIOptions()
// create Section for formula (results in an extra tab page in dialog)
SvtModuleOptions aOpt;
- String aAppGroupname( aLocalizedStrings.GetString( 0 ) );
- aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ),
- aOpt.GetModuleName( SvtModuleOptions::E_SMATH ) );
+ OUString aAppGroupname(
+ aLocalizedStrings.GetString( 0 ).
+ replaceFirst( "%s", aOpt.GetModuleName( SvtModuleOptions::E_SMATH ) ) );
m_aUIProperties[nIdx++].Value = setGroupControlOpt("tabcontrol-page2", aAppGroupname, ".HelpID:vcl:PrintDialog:TabPage:AppPage");
// create subgroup for print options
@@ -234,7 +231,7 @@ enum SmModelPropertyHandles
HANDLE_BASELINE
};
-PropertySetInfo * lcl_createModelPropertyInfo ()
+static PropertySetInfo * lcl_createModelPropertyInfo ()
{
static PropertyMapEntry aModelPropertyInfoMap[] =
{
@@ -381,7 +378,7 @@ sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId )
throw(uno::RuntimeException)
{
if( rId.getLength() == 16
- && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ && 0 == memcmp( getUnoTunnelId().getConstArray(),
rId.getConstArray(), 16 ) )
{
return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this));
@@ -390,7 +387,7 @@ sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId )
return SfxBaseModel::getSomething( rId );
}
-sal_Int16 lcl_AnyToINT16(const uno::Any& rAny)
+static sal_Int16 lcl_AnyToINT16(const uno::Any& rAny)
{
uno::TypeClass eType = rAny.getValueType().getTypeClass();
@@ -473,13 +470,12 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
case HANDLE_CUSTOM_FONT_NAME_SANS :
case HANDLE_CUSTOM_FONT_NAME_FIXED :
{
- OUString aText;
- *pValues >>= aText;
- String sFontName = aText;
- if(!sFontName.Len())
+ OUString sFontName;
+ *pValues >>= sFontName;
+ if(sFontName.isEmpty())
throw IllegalArgumentException();
- if(aFormat.GetFont((*ppEntries)->mnMemberId).GetName() != sFontName)
+ if(OUString(aFormat.GetFont((*ppEntries)->mnMemberId).GetName()) != sFontName)
{
const SmFace rOld = aFormat.GetFont((*ppEntries)->mnMemberId);
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index f1d64400073b..cde1b35a4769 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -19,7 +19,6 @@
#include <sfx2/app.hxx>
#include <vcl/virdev.hxx>
-#include <tools/string.hxx>
#include <tools/tenccvt.hxx>
#include <osl/thread.h>
@@ -129,11 +128,6 @@ void SmPickList::Clear()
/**************************************************************************/
-void * SmFontPickList::CreateItem(const String& /*rString*/)
-{
- return new Font();
-}
-
void * SmFontPickList::CreateItem(const void *pItem)
{
return new Font(*((Font *) pItem));
@@ -161,28 +155,23 @@ bool SmFontPickList::CompareItem(const void *pFirstItem, const void *pSecondItem
return false;
}
-String SmFontPickList::GetStringItem(void *pItem)
+OUString SmFontPickList::GetStringItem(void *pItem)
{
- Font *pFont;
- String aString;
- const sal_Char *pDelim = ", ";
-
- pFont = (Font *)pItem;
-
- aString = pFont->GetName();
+ Font *pFont = (Font *)pItem;
+ OUStringBuffer aString(pFont->GetName());
if (IsItalic( *pFont ))
{
- aString.AppendAscii( pDelim );
- aString += String(SmResId(RID_FONTITALIC));
+ aString.append(", ");
+ aString.append(SM_RESSTR(RID_FONTITALIC));
}
if (IsBold( *pFont ))
{
- aString.AppendAscii( pDelim );
- aString += String(SmResId(RID_FONTBOLD));
+ aString.append(", ");
+ aString.append(SM_RESSTR(RID_FONTBOLD));
}
- return (aString);
+ return aString.makeStringAndClear();
}
void SmFontPickList::Insert(const Font &rFont)
@@ -218,7 +207,7 @@ void SmFontPickList::WriteTo(SmFontDialog& rDialog) const
IMPL_LINK( SmFontPickListBox, SelectHdl, ListBox *, /*pListBox*/ )
{
sal_uInt16 nPos;
- String aString;
+ OUString aString;
nPos = GetSelectEntryPos();
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 5707439852fe..2f7e0a7a4baf 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1466,8 +1466,6 @@ bool SmViewShell::Insert( SfxMedium& rMedium )
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Insert" );
SmDocShell *pDoc = GetDoc();
- String aText( pDoc->GetText() );
- String aTemp = aText;
bool bRet = false;
uno::Reference < embed::XStorage > xStorage = rMedium.GetStorage();
@@ -1485,15 +1483,13 @@ bool SmViewShell::Insert( SfxMedium& rMedium )
if( bRet )
{
- aText = pDoc->GetText();
+ OUString aText = pDoc->GetText();
SmEditWindow *pEditWin = GetEditWindow();
if (pEditWin)
pEditWin->InsertText( aText );
else
{
OSL_FAIL( "EditWindow missing" );
- aTemp += aText;
- aText = aTemp;
}
pDoc->Parse();
@@ -1514,8 +1510,6 @@ bool SmViewShell::InsertFrom(SfxMedium &rMedium)
bool bSuccess = false;
SmDocShell *pDoc = GetDoc();
SvStream *pStream = rMedium.GetInStream();
- String aText( pDoc->GetText() );
- String aTemp = aText;
if (pStream)
{
@@ -1530,15 +1524,13 @@ bool SmViewShell::InsertFrom(SfxMedium &rMedium)
if( bSuccess )
{
- aText = pDoc->GetText();
+ OUString aText = pDoc->GetText();
SmEditWindow *pEditWin = GetEditWindow();
if (pEditWin)
pEditWin->InsertText( aText );
else
{
OSL_FAIL( "EditWindow missing" );
- aTemp += aText;
- aText = aTemp;
}
pDoc->Parse();
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 9c279702d057..dc930ecc65ea 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -742,7 +742,7 @@ void SmDrawingVisitor::Visit( SmRectangleNode* pNode )
void SmDrawingVisitor::DrawTextNode( SmTextNode* pNode )
{
- if ( pNode->IsPhantom( ) || pNode->GetText( ).Len( ) == 0 || pNode->GetText( ).GetChar( 0 ) == xub_Unicode( '\0' ) )
+ if ( pNode->IsPhantom() || pNode->GetText().isEmpty() || pNode->GetText()[0] == '\0' )
return;
SmTmpDevice2 aTmpDev ( ( OutputDevice & ) rDev, false );
@@ -936,15 +936,15 @@ void SmSetSelectionVisitor::Visit( SmTextNode* pNode ) {
IsSelecting = false;
} else if( !IsSelecting && i1 != -1 ) {
start = i1;
- end = pNode->GetText( ).Len( );
+ end = pNode->GetText().getLength();
IsSelecting = true;
} else if( !IsSelecting && i2 != -1 ) {
start = i2;
- end = pNode->GetText( ).Len( );
+ end = pNode->GetText().getLength();
IsSelecting = true;
} else if( IsSelecting ) {
start = 0;
- end = pNode->GetText( ).Len( );
+ end = pNode->GetText().getLength();
} else {
pNode->SetSelected( false );
start = 0;
@@ -1329,9 +1329,9 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmMatrixNode* pNode )
*/
void SmCaretPosGraphBuildingVisitor::Visit( SmTextNode* pNode )
{
- OSL_ENSURE( pNode->GetText( ).Len( ) > 0, "Empty SmTextNode is bad" );
+ OSL_ENSURE( !pNode->GetText().isEmpty(), "Empty SmTextNode is bad" );
- int size = pNode->GetText( ).Len( );
+ int size = pNode->GetText().getLength();
for( int i = 1; i <= size; i++ ){
SmCaretPosGraphEntry* pRight = pRightMost;
pRightMost = pGraph->Add( SmCaretPos( pNode, i ), pRight );
@@ -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 ) {
@@ -2296,10 +2302,10 @@ void SmNodeToTextVisitor::Visit( SmFontNode* pNode )
default:
break;
}
- Append( String( ::rtl::math::doubleToUString(
+ Append( ::rtl::math::doubleToUString(
static_cast<double>( pNode->GetSizeParameter( ) ),
rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', sal_True ) ) );
+ rtl_math_DecimalPlaces_Max, '.', sal_True ) );
Append( " " );
}
break;
diff --git a/starmath/source/wordexportbase.cxx b/starmath/source/wordexportbase.cxx
index 3181697edf9f..1e720b4b6f1c 100644
--- a/starmath/source/wordexportbase.cxx
+++ b/starmath/source/wordexportbase.cxx
@@ -77,7 +77,7 @@ void SmWordExportBase::HandleNode( const SmNode* pNode, int nLevel )
const SmTextNode* pText= static_cast< const SmTextNode* >( pNode );
//if the token str and the result text are the same then this
//is to be seen as text, else assume its a mathchar
- if (pText->GetText() == pText->GetToken().aText)
+ if (pText->GetText() == OUString(pText->GetToken().aText))
HandleText(pText,nLevel);
else
HandleMath(pText,nLevel);