diff options
-rw-r--r-- | sc/inc/fielduno.hxx | 2 | ||||
-rw-r--r-- | sc/inc/unonames.hxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/editutil.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 29 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 2 |
5 files changed, 39 insertions, 5 deletions
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index 8f83eebd480f..f238cf1f1b70 100644 --- a/sc/inc/fielduno.hxx +++ b/sc/inc/fielduno.hxx @@ -225,6 +225,8 @@ private: boost::scoped_ptr<SvxFieldData> mpData; com::sun::star::uno::Reference<com::sun::star::text::XTextRange> mpContent; + bool mbIsDate:1; + private: ScEditFieldObj(); // disabled diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 44f1aea6cbae..5ba1a3b760e5 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -329,6 +329,11 @@ #define SC_UNONAME_TARGET "TargetFrame" #define SC_UNONAME_URL "URL" +// date time field +#define SC_UNONAME_ISDATE "IsDate" +#define SC_UNONAME_ISFIXED "IsFixed" +#define SC_UNONAME_DATETIME "DateTime" + // conditional format #define SC_UNONAME_OPERATOR "Operator" #define SC_UNONAME_FORMULA1 "Formula1" diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index af953e56f87b..19134d724be0 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -752,6 +752,12 @@ String ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField, aRet = pField->GetFormatted(*mpDoc->GetFormatTable(), ScGlobal::eLnge); } break; + case SVX_DATEFIELD: + { + Date aDate(Date::SYSTEM); + aRet = ScGlobal::pLocaleData->getDate(aDate); + } + break; default: aRet = "?"; } diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 9a047665c8bc..693c2c457bde 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -59,6 +59,20 @@ namespace { // alles ohne Which-ID, Map nur fuer PropertySetInfo +const SfxItemPropertySet* getExtTimePropertySet() +{ + static SfxItemPropertyMapEntry aMapContent[] = + { + { MAP_CHAR_LEN(SC_UNONAME_DATETIME), 0, &getCppuType((const util::DateTime*)0), 0, 0 }, + { MAP_CHAR_LEN(SC_UNONAME_ISFIXED), 0, &getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(SC_UNONAME_ISDATE), 0, &getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(SC_UNONAME_NUMFMT), 0, &getCppuType((const sal_Int32*)0), 0, 0 }, + {0,0,0,0,0,0} + }; + static SfxItemPropertySet aMap(aMapContent); + return &aMap; +} + const SfxItemPropertySet* lcl_GetURLPropertySet() { static SfxItemPropertyMapEntry aURLPropertyMap_Impl[] = @@ -691,7 +705,12 @@ SvxFieldData* ScEditFieldObj::getData() mpData.reset(new SvxTimeField); break; case ExtTime: - mpData.reset(new SvxExtTimeField); + { + if (mbIsDate) + mpData.reset(new SvxDateField); + else + mpData.reset(new SvxExtTimeField); + } break; case Title: mpData.reset(new SvxFileField); @@ -898,8 +917,7 @@ void ScEditFieldObj::setPropertyValueExtTime(const rtl::OUString& rName, const u { if (rName == "IsDate") { - // TODO: Find out what to do with this. - sal_Bool b = rVal.get<sal_Bool>(); + mbIsDate = rVal.get<sal_Bool>(); } } @@ -910,7 +928,7 @@ ScEditFieldObj::ScEditFieldObj( pPropSet(NULL), mpEditSource(pEditSrc), aSelection(rSel), - meType(eType), mpData(NULL), mpContent(rContent) + meType(eType), mpData(NULL), mpContent(rContent), mbIsDate(false) { switch (meType) { @@ -920,6 +938,9 @@ ScEditFieldObj::ScEditFieldObj( case URL: pPropSet = lcl_GetURLPropertySet(); break; + case ExtTime: + pPropSet = getExtTimePropertySet(); + break; default: pPropSet = lcl_GetHeaderFieldPropertySet(); } diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 197b0041d4ac..a1814030bef5 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -616,7 +616,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) break; case SID_INSERT_FIELD_TEST: { - SvxExtTimeField aField; + SvxDateField aField; SvxFieldItem aItem(aField, EE_FEATURE_FIELD); pTableView->InsertField(aItem); } |