summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-05-04 23:45:24 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-05-05 11:10:18 -0400
commit146a73e243bb54085055271f08156e2cf5dbd3f2 (patch)
tree4da15a32959a77f0253fe22d484a96e318c8c60b /sc
parent8f555e3be27768a7a9a80b5ce4cba95ea1cd2880 (diff)
Use UNO's field type values for the SvxFieldData class IDs too.
Change-Id: I Iae5abcd0936f176b0b8976b6ea50cfe3e18593b4
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/editutil.cxx12
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx45
2 files changed, 14 insertions, 43 deletions
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 65d21c315d07..29fe83d1f474 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -50,6 +50,8 @@
#include <svl/inethist.hxx>
#include <unotools/syslocale.hxx>
+#include <com/sun/star/text/textfield/Type.hpp>
+
#include "editutil.hxx"
#include "global.hxx"
#include "attrib.hxx"
@@ -60,6 +62,8 @@
#include "inputopt.hxx"
#include "compiler.hxx"
+using namespace com::sun::star;
+
// STATIC DATA -----------------------------------------------------------
// Delimiters zusaetzlich zu EditEngine-Default:
@@ -722,7 +726,7 @@ String ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField,
sal_uInt16 nClsId = pFieldData->GetClassId();
switch (nClsId)
{
- case SVX_URLFIELD:
+ case text::textfield::Type::URL:
{
const SvxURLField* pField = static_cast<const SvxURLField*>(pFieldData);
rtl::OUString aURL = pField->GetURL();
@@ -745,20 +749,20 @@ String ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField,
rTxtColor = new Color( SC_MOD()->GetColorConfig().GetColorValue(eEntry).nColor );
}
break;
- case SVX_EXT_TIMEFIELD:
+ case text::textfield::Type::EXTENDED_TIME:
{
const SvxExtTimeField* pField = static_cast<const SvxExtTimeField*>(pFieldData);
if (mpDoc)
aRet = pField->GetFormatted(*mpDoc->GetFormatTable(), ScGlobal::eLnge);
}
break;
- case SVX_DATEFIELD:
+ case text::textfield::Type::DATE:
{
Date aDate(Date::SYSTEM);
aRet = ScGlobal::pLocaleData->getDate(aDate);
}
break;
- case SVX_TABLEFIELD:
+ case text::textfield::Type::TABLE:
{
const SvxTableField* pField = static_cast<const SvxTableField*>(pFieldData);
SCTAB nTab = pField->GetTab();
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index f7ebbc1bf160..93f3b18b94fa 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -141,39 +141,6 @@ sal_Int16 lcl_SvxToUnoFileFormat( SvxFileFormat nSvxValue )
}
}
-sal_Int32 getFieldType(sal_uInt16 nSvxType)
-{
- switch (nSvxType)
- {
- case SVX_DATEFIELD:
- return text::textfield::Type::DATE;
- case SVX_URLFIELD:
- return text::textfield::Type::URL;
- case SVX_PAGEFIELD:
- return text::textfield::Type::PAGE;
- case SVX_PAGESFIELD:
- return text::textfield::Type::PAGES;
- case SVX_TIMEFIELD:
- return text::textfield::Type::TIME;
- case SVX_EXT_TIMEFIELD:
- return text::textfield::Type::EXTENDED_TIME;
- case SVX_FILEFIELD:
- return text::textfield::Type::FILE;
- case SVX_TABLEFIELD:
- return text::textfield::Type::TABLE;
- case SVX_EXT_FILEFIELD:
- return text::textfield::Type::EXTENDED_FILE;
- case SVX_AUTHORFIELD:
- case SVX_HEADERFIELD:
- case SVX_FOOTERFIELD:
- case SVX_DATEFIMEFIELD:
- // These are not supported yet.
- default:
- ;
- }
- return text::textfield::Type::URL; // Default to URL for no good reason.
-}
-
}
#define SCTEXTFIELD_SERVICE "com.sun.star.text.TextField"
@@ -376,7 +343,7 @@ uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3
xub_StrLen nPos = aTempEngine.GetFieldPos();
ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Feld ist 1 Zeichen
- sal_Int32 eType = getFieldType(pData->GetClassId());
+ sal_Int32 eType = pData->GetClassId();
uno::Reference<text::XTextField> xRet(
new ScEditFieldObj(mxContent, new ScCellEditSource(pDocShell, aCellPos), eType, aSelection));
return xRet;
@@ -557,7 +524,7 @@ uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_In
xub_StrLen nPos = aTempEngine.GetFieldPos();
ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Field is 1 character
- sal_Int32 eRealType = getFieldType(pData->GetClassId());
+ sal_Int32 eRealType = pData->GetClassId();
uno::Reference<text::XTextField> xRet(
new ScEditFieldObj(xTextRange, new ScHeaderFooterEditSource(mrData), eRealType, aSelection));
return xRet;
@@ -742,7 +709,7 @@ void ScEditFieldObj::setPropertyValueURL(const rtl::OUString& rName, const com::
if (!pField)
return;
- if (pField->GetClassId() != SVX_URLFIELD)
+ if (pField->GetClassId() != text::textfield::Type::URL)
// Make sure this is indeed a URL field.
return;
@@ -814,7 +781,7 @@ uno::Any ScEditFieldObj::getPropertyValueURL(const rtl::OUString& rName)
if (!pField)
throw uno::RuntimeException();
- if (pField->GetClassId() != SVX_URLFIELD)
+ if (pField->GetClassId() != text::textfield::Type::URL)
throw uno::RuntimeException();
const SvxURLField* pURL = static_cast<const SvxURLField*>(pField);
@@ -936,7 +903,7 @@ void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno
if (!pField)
return;
- if (pField->GetClassId() != SVX_TABLEFIELD)
+ if (pField->GetClassId() != text::textfield::Type::TABLE)
// Make sure this is indeed a URL field.
return;
@@ -1070,7 +1037,7 @@ rtl::OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand )
{
case text::textfield::Type::URL:
{
- if (pField->GetClassId() != SVX_URLFIELD)
+ if (pField->GetClassId() != text::textfield::Type::URL)
// Not an URL field, but URL is expected.
throw uno::RuntimeException();