Kaydet (Commit) a3d92536 authored tarafından Ivan Timofeev's avatar Ivan Timofeev

String -> OUString

Change-Id: I9d86ea5b27e8b8db75bf7a2ea9965621c857adb7
üst f5d97226
...@@ -96,7 +96,7 @@ class SmDocShell : public SfxObjectShell, public SfxListener ...@@ -96,7 +96,7 @@ class SmDocShell : public SfxObjectShell, public SfxListener
String aText; String aText;
SmFormat aFormat; SmFormat aFormat;
SmParser aInterpreter; SmParser aInterpreter;
String aAccText; OUString aAccText;
SmNode *pTree; SmNode *pTree;
SfxMenuBarManager *pMenuMgr; SfxMenuBarManager *pMenuMgr;
SfxItemPool *pEditEngineItemPool; SfxItemPool *pEditEngineItemPool;
...@@ -198,7 +198,7 @@ public: ...@@ -198,7 +198,7 @@ public:
const std::set< rtl::OUString > & GetUsedSymbols() const { return aUsedSymbols; } const std::set< rtl::OUString > & GetUsedSymbols() const { return aUsedSymbols; }
String GetAccessibleText(); OUString GetAccessibleText();
EditEngine & GetEditEngine(); EditEngine & GetEditEngine();
SfxItemPool & GetEditEngineItemPool(); SfxItemPool & GetEditEngineItemPool();
......
...@@ -156,7 +156,7 @@ public: ...@@ -156,7 +156,7 @@ public:
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
virtual void CreateTextFromNode(String &rText); virtual void CreateTextFromNode(String &rText);
virtual void GetAccessibleText( String &rText ) const; virtual void GetAccessibleText( OUStringBuffer &rText ) const;
sal_Int32 GetAccessibleIndex() const { return nAccIndex; } sal_Int32 GetAccessibleIndex() const { return nAccIndex; }
const SmNode * FindNodeWithAccessibleIndex(xub_StrLen nAccIndex) const; const SmNode * FindNodeWithAccessibleIndex(xub_StrLen nAccIndex) const;
...@@ -324,7 +324,7 @@ public: ...@@ -324,7 +324,7 @@ public:
SmStructureNode & operator = ( const SmStructureNode &rNode ); SmStructureNode & operator = ( const SmStructureNode &rNode );
virtual void GetAccessibleText( String &rText ) const; virtual void GetAccessibleText( OUStringBuffer &rText ) const;
void SetSubNode(size_t nIndex, SmNode* pNode) void SetSubNode(size_t nIndex, SmNode* pNode)
{ {
...@@ -378,7 +378,7 @@ protected: ...@@ -378,7 +378,7 @@ protected:
public: public:
virtual void GetAccessibleText( String &rText ) const; virtual void GetAccessibleText( OUStringBuffer &rText ) const;
}; };
...@@ -490,7 +490,7 @@ public: ...@@ -490,7 +490,7 @@ public:
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
virtual void CreateTextFromNode(String &rText); virtual void CreateTextFromNode(String &rText);
virtual void GetAccessibleText( String &rText ) const; virtual void GetAccessibleText( OUStringBuffer &rText ) const;
void Accept(SmVisitor* pVisitor); void Accept(SmVisitor* pVisitor);
/** /**
Converts the character from StarMath's private area symbols to a matching Unicode Converts the character from StarMath's private area symbols to a matching Unicode
......
...@@ -514,10 +514,11 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde ...@@ -514,10 +514,11 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde
OSL_ENSURE( nAccIndex >= 0, "invalid accessible index" ); OSL_ENSURE( nAccIndex >= 0, "invalid accessible index" );
OSL_ENSURE( nIndex >= nAccIndex, "index out of range" ); OSL_ENSURE( nIndex >= nAccIndex, "index out of range" );
String aNodeText; OUStringBuffer aBuf;
pNode->GetAccessibleText( aNodeText ); pNode->GetAccessibleText(aBuf);
OUString aNodeText = aBuf.makeStringAndClear();
sal_Int32 nNodeIndex = nIndex - nAccIndex; sal_Int32 nNodeIndex = nIndex - nAccIndex;
if (0 <= nNodeIndex && nNodeIndex < aNodeText.Len()) if (0 <= nNodeIndex && nNodeIndex < aNodeText.getLength())
{ {
// get appropriate rectangle // get appropriate rectangle
Point aOffset(pNode->GetTopLeft() - pTree->GetTopLeft()); Point aOffset(pNode->GetTopLeft() - pTree->GetTopLeft());
...@@ -525,9 +526,9 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde ...@@ -525,9 +526,9 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde
aTLPos.X() -= 0; aTLPos.X() -= 0;
Size aSize (pNode->GetSize()); 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->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; aTLPos.X() += nNodeIndex > 0 ? pXAry[nNodeIndex - 1] : 0;
aSize.Width() = nNodeIndex > 0 ? pXAry[nNodeIndex] - pXAry[nNodeIndex - 1] : pXAry[nNodeIndex]; aSize.Width() = nNodeIndex > 0 ? pXAry[nNodeIndex] - pXAry[nNodeIndex - 1] : pXAry[nNodeIndex];
delete[] pXAry; delete[] pXAry;
...@@ -600,22 +601,23 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin ...@@ -600,22 +601,23 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin
if (aRect.IsInside( aPos )) if (aRect.IsInside( aPos ))
{ {
OSL_ENSURE( pNode->IsVisible(), "node is not a leaf" ); OSL_ENSURE( pNode->IsVisible(), "node is not a leaf" );
String aTxt; OUStringBuffer aBuf;
pNode->GetAccessibleText( aTxt ); pNode->GetAccessibleText(aBuf);
OSL_ENSURE( aTxt.Len(), "no accessible text available" ); OUString aTxt = aBuf.makeStringAndClear();
OSL_ENSURE( !aTxt.isEmpty(), "no accessible text available" );
long nNodeX = pNode->GetLeft(); 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->SetFont( pNode->GetFont() );
pWin->GetTextArray( aTxt, pXAry, 0, aTxt.Len() ); pWin->GetTextArray( aTxt, pXAry, 0, aTxt.getLength() );
for (sal_Int32 i = 0; i < aTxt.Len() && nRes == -1; ++i) for (sal_Int32 i = 0; i < aTxt.getLength() && nRes == -1; ++i)
{ {
if (pXAry[i] + nNodeX > aPos.X()) if (pXAry[i] + nNodeX > aPos.X())
nRes = i; nRes = i;
} }
delete[] pXAry; 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, OSL_ENSURE( pNode->GetAccessibleIndex() >= 0,
"invalid accessible index" ); "invalid accessible index" );
......
...@@ -224,17 +224,21 @@ void SmDocShell::SetFormat(SmFormat& rFormat) ...@@ -224,17 +224,21 @@ void SmDocShell::SetFormat(SmFormat& rFormat)
} }
} }
String SmDocShell::GetAccessibleText() OUString SmDocShell::GetAccessibleText()
{ {
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::GetAccessibleText" ); RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::GetAccessibleText" );
if (!IsFormulaArranged()) if (!IsFormulaArranged())
ArrangeFormula(); ArrangeFormula();
if (0 == aAccText.Len()) if (aAccText.isEmpty())
{ {
OSL_ENSURE( pTree, "Tree missing" ); OSL_ENSURE( pTree, "Tree missing" );
if (pTree) if (pTree)
pTree->GetAccessibleText( aAccText ); {
OUStringBuffer aBuf;
pTree->GetAccessibleText(aBuf);
aAccText = aBuf.makeStringAndClear();
}
} }
return aAccText; return aAccText;
} }
...@@ -306,7 +310,7 @@ void SmDocShell::ArrangeFormula() ...@@ -306,7 +310,7 @@ void SmDocShell::ArrangeFormula()
SetFormulaArranged(true); SetFormulaArranged(true);
// invalidate accessible text // invalidate accessible text
aAccText = String(); aAccText = OUString();
} }
......
...@@ -520,7 +520,7 @@ const SmNode * SmNode::FindRectClosestTo(const Point &rPoint) const ...@@ -520,7 +520,7 @@ const SmNode * SmNode::FindRectClosestTo(const Point &rPoint) const
return pResult; return pResult;
} }
void SmNode::GetAccessibleText( String &/*rText*/ ) const void SmNode::GetAccessibleText( OUStringBuffer &/*rText*/ ) const
{ {
OSL_FAIL( "SmNode: GetAccessibleText not overloaded" ); OSL_FAIL( "SmNode: GetAccessibleText not overloaded" );
} }
...@@ -530,12 +530,12 @@ const SmNode * SmNode::FindNodeWithAccessibleIndex(xub_StrLen nAccIdx) const ...@@ -530,12 +530,12 @@ const SmNode * SmNode::FindNodeWithAccessibleIndex(xub_StrLen nAccIdx) const
const SmNode *pResult = 0; const SmNode *pResult = 0;
sal_Int32 nIdx = GetAccessibleIndex(); sal_Int32 nIdx = GetAccessibleIndex();
String aTxt; OUStringBuffer aTxt;
if (nIdx >= 0) if (nIdx >= 0)
GetAccessibleText( aTxt ); // get text if used in following 'if' statement GetAccessibleText( aTxt ); // get text if used in following 'if' statement
if (nIdx >= 0 if (nIdx >= 0
&& nIdx <= nAccIdx && nAccIdx < nIdx + aTxt.Len()) && nIdx <= nAccIdx && nAccIdx < nIdx + aTxt.getLength())
pResult = this; pResult = this;
else else
{ {
...@@ -749,7 +749,7 @@ SmNode * SmStructureNode::GetSubNode(sal_uInt16 nIndex) ...@@ -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(); sal_uInt16 nNodes = GetNumSubNodes();
for (sal_uInt16 i = 0; i < nNodes; ++i) for (sal_uInt16 i = 0; i < nNodes; ++i)
...@@ -758,7 +758,7 @@ void SmStructureNode::GetAccessibleText( String &rText ) const ...@@ -758,7 +758,7 @@ void SmStructureNode::GetAccessibleText( String &rText ) const
if (pNode) if (pNode)
{ {
if (pNode->IsVisible()) if (pNode->IsVisible())
((SmStructureNode *) pNode)->nAccIndex = rText.Len(); ((SmStructureNode *) pNode)->nAccIndex = rText.getLength();
pNode->GetAccessibleText( rText ); pNode->GetAccessibleText( rText );
} }
} }
...@@ -787,9 +787,9 @@ SmNode * SmVisibleNode::GetSubNode(sal_uInt16 /*nIndex*/) ...@@ -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) ...@@ -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() void SmTextNode::AdjustFontDesc()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment