import performance : do not use EditEngine anymore

Change-Id: I5849add3444cff15a201a276c8917fabc4b33262
Reviewed-on: https://gerrit.libreoffice.org/5317
Reviewed-by: Kohei Yoshida <kohei.yoshida@suse.de>
Tested-by: Kohei Yoshida <kohei.yoshida@suse.de>
This commit is contained in:
Laurent Godard
2013-08-08 17:18:29 +02:00
committed by Kohei Yoshida
parent af53d7a181
commit f807403faa
3 changed files with 27 additions and 6 deletions

View File

@@ -55,9 +55,11 @@ public:
/// Retrieves string with paragraphs delimited by spaces
static OUString GetSpaceDelimitedString( const EditEngine& rEngine );
static OUString GetSpaceDelimitedString( const EditTextObject& rEdit );
/// Retrieves string with paragraphs delimited by new lines ('\n').
static OUString GetMultilineString( const EditEngine& rEngine );
static OUString GetMultilineString( const EditTextObject& rEdit );
/** Retrieves string with paragraphs delimited by new lines ('\n').

View File

@@ -72,11 +72,7 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurrences( const String& rN
{
const EditTextObject* p = aIter.getEditText();
if (p)
{
ScFieldEditEngine& rEngine = pDoc->GetEditEngine();
rEngine.SetText(*p);
aStr = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs
}
aStr = ScEditUtil::GetMultilineString(*p); // string with line separators between paragraphs
}
break;
case CELLTYPE_NONE:

View File

@@ -29,7 +29,7 @@
#include <editeng/flditem.hxx>
#include <editeng/numitem.hxx>
#include <editeng/justifyitem.hxx>
#include "editeng/editobj.hxx"
#include <editeng/editobj.hxx>
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
#include <svl/inethist.hxx>
@@ -81,16 +81,39 @@ static OUString lcl_GetDelimitedString( const EditEngine& rEngine, const sal_Cha
return aRet.makeStringAndClear();
}
static OUString lcl_GetDelimitedString( const EditTextObject& rEdit, const sal_Char c )
{
sal_Int32 nParCount = rEdit.GetParagraphCount();
OUStringBuffer aRet( nParCount * 80 );
for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
{
if (nPar > 0)
aRet.append(c);
aRet.append( rEdit.GetText( nPar ));
}
return aRet.makeStringAndClear();
}
OUString ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine )
{
return lcl_GetDelimitedString(rEngine, ' ');
}
OUString ScEditUtil::GetSpaceDelimitedString( const EditTextObject& rEdit )
{
return lcl_GetDelimitedString(rEdit, ' ');
}
OUString ScEditUtil::GetMultilineString( const EditEngine& rEngine )
{
return lcl_GetDelimitedString(rEngine, '\n');
}
OUString ScEditUtil::GetMultilineString( const EditTextObject& rEdit )
{
return lcl_GetDelimitedString(rEdit, '\n');
}
OUString ScEditUtil::GetString( const EditTextObject& rEditText, const ScDocument* pDoc )
{
// ScFieldEditEngine is needed to resolve field contents.