summaryrefslogtreecommitdiff
path: root/sc/source/core/data/conditio.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-07-25 15:33:49 +0200
committerEike Rathke <erack@redhat.com>2013-07-25 16:11:09 +0200
commit1ecdc7aaf661e97a33cf521f553481d79cd26de2 (patch)
tree34811d2f9f17691c749622ff61a42b79f1da15d5 /sc/source/core/data/conditio.cxx
parentbb98778dbf761a0c88c96117add00a66e5cc6c95 (diff)
resolved fdo#67249 use ScFieldEditEngine to resolve field content
ScEditUtil::GetString() iterated over the paragraphs of an EditTextObject where GetText() does not resolve field content but returns the embedded field markers. To resolve field content an ScFieldEditEngine is needed. This makes it necessary to pass an ScDocument* to obtain the ScFieldEditEngine from, or for cases where there is no ScDocument in the context use a static ScFieldEditEngine which unfortunately is not capable of resolving document specific fields of course, such as DOCINFO_TITLE and TABLE. Also added unit test. Change-Id: Ife3c23b2fec2514b32303239d276c49869786eb5
Diffstat (limited to 'sc/source/core/data/conditio.cxx')
-rw-r--r--sc/source/core/data/conditio.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index fe438af0a694..baef65684fdc 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -734,7 +734,8 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
bFirstRun = false;
}
-static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& rArg, OUString& rArgStr )
+static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& rArg, OUString& rArgStr,
+ const ScDocument* pDoc )
{
if (rCell.isEmpty())
@@ -762,7 +763,7 @@ static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& rAr
if (rCell.meType == CELLTYPE_STRING)
rArgStr = *rCell.mpString;
else if (rCell.mpEditText)
- rArgStr = ScEditUtil::GetString(*rCell.mpEditText);
+ rArgStr = ScEditUtil::GetString(*rCell.mpEditText, pDoc);
break;
default:
;
@@ -806,7 +807,7 @@ void ScConditionEntry::FillCache() const
double nVal = 0.0;
OUString aStr;
- if (!lcl_GetCellContent(aCell, false, nVal, aStr))
+ if (!lcl_GetCellContent(aCell, false, nVal, aStr, mpDoc))
{
std::pair<ScConditionEntryCache::StringCacheType::iterator, bool> aResult =
mpCache->maStrings.insert(
@@ -1270,7 +1271,7 @@ bool ScConditionEntry::IsCellValid( ScRefCellValue& rCell, const ScAddress& rPos
double nArg = 0.0;
OUString aArgStr;
- bool bVal = lcl_GetCellContent( rCell, bIsStr1, nArg, aArgStr );
+ bool bVal = lcl_GetCellContent( rCell, bIsStr1, nArg, aArgStr, mpDoc );
if (bVal)
return IsValid( nArg, rPos );
else