summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-13 14:59:08 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-13 23:35:50 -0400
commitcd967bdb955f307ff0a2b22cd680b99bd493c4cd (patch)
tree60eb931db82f8300650eab34634fcd4399882b89
parent9432c51b350958162df7fa6cddb4aaf0536735df (diff)
UniString to rtl::OUString.
-rw-r--r--editeng/source/editeng/editdoc.cxx24
-rw-r--r--editeng/source/editeng/editdoc.hxx2
2 files changed, 14 insertions, 12 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index c791aa2be165..d2aca617e45c 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2030,9 +2030,9 @@ size_t EditDoc::Count() const
return maContents.size();
}
-XubString EditDoc::GetSepStr( LineEnd eEnd )
+rtl::OUString EditDoc::GetSepStr( LineEnd eEnd )
{
- XubString aSep;
+ rtl::OUString aSep;
if ( eEnd == LINEEND_CR )
aSep = aCR;
else if ( eEnd == LINEEND_LF )
@@ -2045,34 +2045,36 @@ XubString EditDoc::GetSepStr( LineEnd eEnd )
XubString EditDoc::GetText( LineEnd eEnd ) const
{
sal_uLong nLen = GetTextLen();
- sal_uInt16 nNodes = Count();
+ size_t nNodes = Count();
+ if (nNodes == 0)
+ return String();
- String aSep = EditDoc::GetSepStr( eEnd );
- sal_uInt16 nSepSize = aSep.Len();
+ rtl::OUString aSep = EditDoc::GetSepStr( eEnd );
+ sal_Int32 nSepSize = aSep.getLength();
if ( nSepSize )
nLen += nNodes * nSepSize;
if ( nLen > 0xFFFb / sizeof(xub_Unicode) )
{
- OSL_FAIL( "Text to large for String" );
- return XubString();
+ OSL_FAIL( "Text too large for String" );
+ return String();
}
xub_Unicode* pStr = new xub_Unicode[nLen+1];
xub_Unicode* pCur = pStr;
- sal_uInt16 nLastNode = nNodes-1;
+ size_t nLastNode = nNodes-1;
for ( sal_uInt16 nNode = 0; nNode < nNodes; nNode++ )
{
- XubString aTmp( GetParaAsString( GetObject(nNode) ) );
+ String aTmp( GetParaAsString( GetObject(nNode) ) );
memcpy( pCur, aTmp.GetBuffer(), aTmp.Len()*sizeof(sal_Unicode) );
pCur += aTmp.Len();
if ( nSepSize && ( nNode != nLastNode ) )
{
- memcpy( pCur, aSep.GetBuffer(), nSepSize*sizeof(sal_Unicode ) );
+ memcpy( pCur, aSep.getStr(), nSepSize*sizeof(sal_Unicode ) );
pCur += nSepSize;
}
}
*pCur = '\0';
- XubString aASCIIText( pStr );
+ String aASCIIText( pStr );
delete[] pStr;
return aASCIIText;
}
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index afd1398ef06e..3e17f74493e8 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -826,7 +826,7 @@ public:
/// does not delete
void Release(size_t nPos);
- static XubString GetSepStr( LineEnd eEnd );
+ static rtl::OUString GetSepStr( LineEnd eEnd );
};
inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, size_t nAttr)