summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/editutil.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-20 00:46:19 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-05-03 20:28:15 -0400
commit4aeb8aff9e418aef1fde4b2b60333216cc527f13 (patch)
tree95423fbf41b16708f4d8d91ac50d96981d9ebf0c /sc/source/core/tool/editutil.cxx
parent9b99bf09a25d9c9016a1c6b730fa0ef1cc5bc04a (diff)
New menu now inserts current time into cell.
Diffstat (limited to 'sc/source/core/tool/editutil.cxx')
-rw-r--r--sc/source/core/tool/editutil.cxx50
1 files changed, 30 insertions, 20 deletions
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index b513cb26a14c..af953e56f87b 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -696,11 +696,11 @@ String ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField,
//
//------------------------------------------------------------------------
-ScFieldEditEngine::ScFieldEditEngine( SfxItemPool* pEnginePoolP,
- SfxItemPool* pTextObjectPool, sal_Bool bDeleteEnginePoolP )
- :
+ScFieldEditEngine::ScFieldEditEngine(
+ ScDocument* pDoc, SfxItemPool* pEnginePoolP,
+ SfxItemPool* pTextObjectPool, bool bDeleteEnginePoolP) :
ScEditEngineDefaulter( pEnginePoolP, bDeleteEnginePoolP ),
- bExecuteURL( sal_True )
+ mpDoc(pDoc), bExecuteURL(true)
{
if ( pTextObjectPool )
SetEditTextObjectPool( pTextObjectPool );
@@ -713,41 +713,51 @@ String ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField,
sal_uInt16 /* nPara */, sal_uInt16 /* nPos */,
Color*& rTxtColor, Color*& /* rFldColor */ )
{
- String aRet;
+ rtl::OUString aRet;
const SvxFieldData* pFieldData = rField.GetField();
- if ( pFieldData )
- {
- TypeId aType = pFieldData->Type();
+ if (!pFieldData)
+ return rtl::OUString(" ");
- if (aType == TYPE(SvxURLField))
+ sal_uInt16 nClsId = pFieldData->GetClassId();
+ switch (nClsId)
+ {
+ case SVX_URLFIELD:
{
- String aURL = ((const SvxURLField*)pFieldData)->GetURL();
+ const SvxURLField* pField = static_cast<const SvxURLField*>(pFieldData);
+ rtl::OUString aURL = pField->GetURL();
- switch ( ((const SvxURLField*)pFieldData)->GetFormat() )
+ switch (pField->GetFormat())
{
case SVXURLFORMAT_APPDEFAULT: //!!! einstellbar an App???
case SVXURLFORMAT_REPR:
- aRet = ((const SvxURLField*)pFieldData)->GetRepresentation();
- break;
-
+ aRet = pField->GetRepresentation();
+ break;
case SVXURLFORMAT_URL:
aRet = aURL;
- break;
+ break;
+ default:
+ ;
}
svtools::ColorConfigEntry eEntry =
- INetURLHistory::GetOrCreate()->QueryUrl( aURL ) ? svtools::LINKSVISITED : svtools::LINKS;
+ INetURLHistory::GetOrCreate()->QueryUrl(String(aURL)) ? svtools::LINKSVISITED : svtools::LINKS;
rTxtColor = new Color( SC_MOD()->GetColorConfig().GetColorValue(eEntry).nColor );
}
- else
+ break;
+ case SVX_EXT_TIMEFIELD:
{
- aRet = '?';
+ const SvxExtTimeField* pField = static_cast<const SvxExtTimeField*>(pFieldData);
+ if (mpDoc)
+ aRet = pField->GetFormatted(*mpDoc->GetFormatTable(), ScGlobal::eLnge);
}
+ break;
+ default:
+ aRet = "?";
}
- if (!aRet.Len()) // leer ist baeh
- aRet = ' '; // Space ist Default der Editengine
+ if (aRet.isEmpty()) // leer ist baeh
+ aRet = " "; // Space ist Default der Editengine
return aRet;
}