summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorIvan Timofeev <timofeev.i.s@gmail.com>2012-10-29 19:15:56 +0400
committerIvan Timofeev <timofeev.i.s@gmail.com>2012-10-29 19:16:48 +0400
commita3d9253615078a35836c9e79dd694c4540dd5dde (patch)
tree0e865843b404c80171f9bc1c60512d410155f65c /starmath
parentf5d972265a4fec02639bbd68ecb0a6cd4f4253a7 (diff)
String -> OUString
Change-Id: I9d86ea5b27e8b8db75bf7a2ea9965621c857adb7
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/document.hxx4
-rw-r--r--starmath/inc/node.hxx8
-rw-r--r--starmath/source/accessibility.cxx26
-rw-r--r--starmath/source/document.cxx12
-rw-r--r--starmath/source/node.cxx18
5 files changed, 37 insertions, 31 deletions
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index 4d98b82c751d..638801371f19 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -96,7 +96,7 @@ class SmDocShell : public SfxObjectShell, public SfxListener
String aText;
SmFormat aFormat;
SmParser aInterpreter;
- String aAccText;
+ OUString aAccText;
SmNode *pTree;
SfxMenuBarManager *pMenuMgr;
SfxItemPool *pEditEngineItemPool;
@@ -198,7 +198,7 @@ public:
const std::set< rtl::OUString > & GetUsedSymbols() const { return aUsedSymbols; }
- String GetAccessibleText();
+ OUString GetAccessibleText();
EditEngine & GetEditEngine();
SfxItemPool & GetEditEngineItemPool();
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index bfe89022f9a6..7a89a7a2d64b 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -156,7 +156,7 @@ public:
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
virtual void CreateTextFromNode(String &rText);
- virtual void GetAccessibleText( String &rText ) const;
+ virtual void GetAccessibleText( OUStringBuffer &rText ) const;
sal_Int32 GetAccessibleIndex() const { return nAccIndex; }
const SmNode * FindNodeWithAccessibleIndex(xub_StrLen nAccIndex) const;
@@ -324,7 +324,7 @@ public:
SmStructureNode & operator = ( const SmStructureNode &rNode );
- virtual void GetAccessibleText( String &rText ) const;
+ virtual void GetAccessibleText( OUStringBuffer &rText ) const;
void SetSubNode(size_t nIndex, SmNode* pNode)
{
@@ -378,7 +378,7 @@ protected:
public:
- virtual void GetAccessibleText( String &rText ) const;
+ virtual void GetAccessibleText( OUStringBuffer &rText ) const;
};
@@ -490,7 +490,7 @@ public:
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
virtual void CreateTextFromNode(String &rText);
- virtual void GetAccessibleText( String &rText ) const;
+ virtual void GetAccessibleText( OUStringBuffer &rText ) const;
void Accept(SmVisitor* pVisitor);
/**
Converts the character from StarMath's private area symbols to a matching Unicode
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 331790a606e0..508208c27e81 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -514,10 +514,11 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde
OSL_ENSURE( nAccIndex >= 0, "invalid accessible index" );
OSL_ENSURE( nIndex >= nAccIndex, "index out of range" );
- String aNodeText;
- pNode->GetAccessibleText( aNodeText );
+ OUStringBuffer aBuf;
+ pNode->GetAccessibleText(aBuf);
+ OUString aNodeText = aBuf.makeStringAndClear();
sal_Int32 nNodeIndex = nIndex - nAccIndex;
- if (0 <= nNodeIndex && nNodeIndex < aNodeText.Len())
+ if (0 <= nNodeIndex && nNodeIndex < aNodeText.getLength())
{
// get appropriate rectangle
Point aOffset(pNode->GetTopLeft() - pTree->GetTopLeft());
@@ -525,9 +526,9 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde
aTLPos.X() -= 0;
Size aSize (pNode->GetSize());
- sal_Int32 *pXAry = new sal_Int32[ aNodeText.Len() ];
+ sal_Int32 *pXAry = new sal_Int32[ aNodeText.getLength() ];
pWin->SetFont( pNode->GetFont() );
- pWin->GetTextArray( aNodeText, pXAry, 0, aNodeText.Len() );
+ pWin->GetTextArray( aNodeText, pXAry, 0, aNodeText.getLength() );
aTLPos.X() += nNodeIndex > 0 ? pXAry[nNodeIndex - 1] : 0;
aSize.Width() = nNodeIndex > 0 ? pXAry[nNodeIndex] - pXAry[nNodeIndex - 1] : pXAry[nNodeIndex];
delete[] pXAry;
@@ -600,22 +601,23 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin
if (aRect.IsInside( aPos ))
{
OSL_ENSURE( pNode->IsVisible(), "node is not a leaf" );
- String aTxt;
- pNode->GetAccessibleText( aTxt );
- OSL_ENSURE( aTxt.Len(), "no accessible text available" );
+ OUStringBuffer aBuf;
+ pNode->GetAccessibleText(aBuf);
+ OUString aTxt = aBuf.makeStringAndClear();
+ OSL_ENSURE( !aTxt.isEmpty(), "no accessible text available" );
long nNodeX = pNode->GetLeft();
- sal_Int32 *pXAry = new sal_Int32[ aTxt.Len() ];
+ sal_Int32 *pXAry = new sal_Int32[ aTxt.getLength() ];
pWin->SetFont( pNode->GetFont() );
- pWin->GetTextArray( aTxt, pXAry, 0, aTxt.Len() );
- for (sal_Int32 i = 0; i < aTxt.Len() && nRes == -1; ++i)
+ pWin->GetTextArray( aTxt, pXAry, 0, aTxt.getLength() );
+ for (sal_Int32 i = 0; i < aTxt.getLength() && nRes == -1; ++i)
{
if (pXAry[i] + nNodeX > aPos.X())
nRes = i;
}
delete[] pXAry;
- OSL_ENSURE( nRes >= 0 && nRes < aTxt.Len(), "index out of range" );
+ OSL_ENSURE( nRes >= 0 && nRes < aTxt.getLength(), "index out of range" );
OSL_ENSURE( pNode->GetAccessibleIndex() >= 0,
"invalid accessible index" );
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index da9dd3e6ee1a..6dc19f5b9fa0 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -224,17 +224,21 @@ void SmDocShell::SetFormat(SmFormat& rFormat)
}
}
-String SmDocShell::GetAccessibleText()
+OUString SmDocShell::GetAccessibleText()
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::GetAccessibleText" );
if (!IsFormulaArranged())
ArrangeFormula();
- if (0 == aAccText.Len())
+ if (aAccText.isEmpty())
{
OSL_ENSURE( pTree, "Tree missing" );
if (pTree)
- pTree->GetAccessibleText( aAccText );
+ {
+ OUStringBuffer aBuf;
+ pTree->GetAccessibleText(aBuf);
+ aAccText = aBuf.makeStringAndClear();
+ }
}
return aAccText;
}
@@ -306,7 +310,7 @@ void SmDocShell::ArrangeFormula()
SetFormulaArranged(true);
// invalidate accessible text
- aAccText = String();
+ aAccText = OUString();
}
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 994c86c7d652..4760d9279824 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -520,7 +520,7 @@ const SmNode * SmNode::FindRectClosestTo(const Point &rPoint) const
return pResult;
}
-void SmNode::GetAccessibleText( String &/*rText*/ ) const
+void SmNode::GetAccessibleText( OUStringBuffer &/*rText*/ ) const
{
OSL_FAIL( "SmNode: GetAccessibleText not overloaded" );
}
@@ -530,12 +530,12 @@ const SmNode * SmNode::FindNodeWithAccessibleIndex(xub_StrLen nAccIdx) const
const SmNode *pResult = 0;
sal_Int32 nIdx = GetAccessibleIndex();
- String aTxt;
+ OUStringBuffer aTxt;
if (nIdx >= 0)
GetAccessibleText( aTxt ); // get text if used in following 'if' statement
if (nIdx >= 0
- && nIdx <= nAccIdx && nAccIdx < nIdx + aTxt.Len())
+ && nIdx <= nAccIdx && nAccIdx < nIdx + aTxt.getLength())
pResult = this;
else
{
@@ -749,7 +749,7 @@ SmNode * SmStructureNode::GetSubNode(sal_uInt16 nIndex)
}
-void SmStructureNode::GetAccessibleText( String &rText ) const
+void SmStructureNode::GetAccessibleText( OUStringBuffer &rText ) const
{
sal_uInt16 nNodes = GetNumSubNodes();
for (sal_uInt16 i = 0; i < nNodes; ++i)
@@ -758,7 +758,7 @@ void SmStructureNode::GetAccessibleText( String &rText ) const
if (pNode)
{
if (pNode->IsVisible())
- ((SmStructureNode *) pNode)->nAccIndex = rText.Len();
+ ((SmStructureNode *) pNode)->nAccIndex = rText.getLength();
pNode->GetAccessibleText( rText );
}
}
@@ -787,9 +787,9 @@ SmNode * SmVisibleNode::GetSubNode(sal_uInt16 /*nIndex*/)
///////////////////////////////////////////////////////////////////////////
-void SmGraphicNode::GetAccessibleText( String &rText ) const
+void SmGraphicNode::GetAccessibleText( OUStringBuffer &rText ) const
{
- rText += GetToken().aText;
+ rText.append(GetToken().aText);
}
///////////////////////////////////////////////////////////////////////////
@@ -2440,9 +2440,9 @@ void SmTextNode::CreateTextFromNode(String &rText)
}
-void SmTextNode::GetAccessibleText( String &rText ) const
+void SmTextNode::GetAccessibleText( OUStringBuffer &rText ) const
{
- rText += aText;
+ rText.append(aText);
}
void SmTextNode::AdjustFontDesc()