summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-05-04 22:15:10 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-05-05 11:10:18 -0400
commite7dc75ace3ba42d8f7f4736bac66a218cec5f39e (patch)
tree8b4067f6641633b6725954cf37c948c1e252a6d0 /sc
parent204c898d7b69731a6a013bb02842400d4a828783 (diff)
Have ScEditFieldObj use the UNO field type values.
Change-Id: I300817bd0263f427c9f4c424ae86b608015ce3e8
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/fielduno.hxx10
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx3
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx69
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx35
-rw-r--r--sc/source/ui/unoobj/servuno.cxx23
5 files changed, 53 insertions, 87 deletions
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index 6874c0bb0cf7..c20949c3451e 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -213,15 +213,11 @@ class ScEditFieldObj : public cppu::WeakImplHelper4<
public ::cppu::OComponentHelper,
private boost::noncopyable
{
-public:
- enum FieldType { URL = 0, Page, Pages, Date, Time, ExtTime, Title, File, Sheet };
-
-private:
const SfxItemPropertySet* pPropSet;
ScEditSource* mpEditSource;
ESelection aSelection;
- FieldType meType;
+ sal_Int32 meType;
boost::scoped_ptr<SvxFieldData> mpData;
com::sun::star::uno::Reference<com::sun::star::text::XTextRange> mpContent;
@@ -247,10 +243,10 @@ public:
ScEditFieldObj(
const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rContent,
- ScEditSource* pEditSrc, FieldType eType, const ESelection& rSel);
+ ScEditSource* pEditSrc, sal_Int32 eType, const ESelection& rSel);
virtual ~ScEditFieldObj();
- FieldType GetFieldType() const;
+ sal_Int32 GetFieldType() const;
void DeleteField();
bool IsInserted() const;
SvxFieldItem CreateFieldItem();
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index db2d9b4d0f24..44fdff56b6a5 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -66,6 +66,7 @@
#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/text/textfield/Type.hpp>
#include "autoform.hxx"
#include "cellmergeoption.hxx"
@@ -6434,7 +6435,7 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRang
aSelection.nStartPos = aSelection.nEndPos;
}
- if (pCellField->GetFieldType() == ScEditFieldObj::Sheet)
+ if (pCellField->GetFieldType() == text::textfield::Type::TABLE)
pCellField->setPropertyValue("SheetPosition", uno::makeAny<sal_Int32>(aCellPos.Tab()));
SvxFieldItem aItem = pCellField->CreateFieldItem();
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 4b78a7f36a0e..f7ebbc1bf160 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -52,6 +52,7 @@
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/FilenameDisplayFormat.hpp>
+#include <com/sun/star/text/textfield/Type.hpp>
using namespace com::sun::star;
@@ -140,28 +141,28 @@ sal_Int16 lcl_SvxToUnoFileFormat( SvxFileFormat nSvxValue )
}
}
-ScEditFieldObj::FieldType getFieldType(sal_uInt16 nSvxType)
+sal_Int32 getFieldType(sal_uInt16 nSvxType)
{
switch (nSvxType)
{
case SVX_DATEFIELD:
- return ScEditFieldObj::Date;
+ return text::textfield::Type::DATE;
case SVX_URLFIELD:
- return ScEditFieldObj::URL;
+ return text::textfield::Type::URL;
case SVX_PAGEFIELD:
- return ScEditFieldObj::Page;
+ return text::textfield::Type::PAGE;
case SVX_PAGESFIELD:
- return ScEditFieldObj::Pages;
+ return text::textfield::Type::PAGES;
case SVX_TIMEFIELD:
- return ScEditFieldObj::Time;
+ return text::textfield::Type::TIME;
case SVX_EXT_TIMEFIELD:
- return ScEditFieldObj::ExtTime;
+ return text::textfield::Type::EXTENDED_TIME;
case SVX_FILEFIELD:
- return ScEditFieldObj::Title;
+ return text::textfield::Type::FILE;
case SVX_TABLEFIELD:
- return ScEditFieldObj::Sheet;
+ return text::textfield::Type::TABLE;
case SVX_EXT_FILEFIELD:
- return ScEditFieldObj::File;
+ return text::textfield::Type::EXTENDED_FILE;
case SVX_AUTHORFIELD:
case SVX_HEADERFIELD:
case SVX_FOOTERFIELD:
@@ -170,7 +171,7 @@ ScEditFieldObj::FieldType getFieldType(sal_uInt16 nSvxType)
default:
;
}
- return ScEditFieldObj::URL; // Default to URL for no good reason.
+ return text::textfield::Type::URL; // Default to URL for no good reason.
}
}
@@ -375,7 +376,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
- ScEditFieldObj::FieldType eType = getFieldType(pData->GetClassId());
+ sal_Int32 eType = getFieldType(pData->GetClassId());
uno::Reference<text::XTextField> xRet(
new ScEditFieldObj(mxContent, new ScCellEditSource(pDocShell, aCellPos), eType, aSelection));
return xRet;
@@ -556,7 +557,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
- ScEditFieldObj::FieldType eRealType = getFieldType(pData->GetClassId());
+ sal_Int32 eRealType = getFieldType(pData->GetClassId());
uno::Reference<text::XTextField> xRet(
new ScEditFieldObj(xTextRange, new ScHeaderFooterEditSource(mrData), eRealType, aSelection));
return xRet;
@@ -685,26 +686,26 @@ SvxFieldData* ScEditFieldObj::getData()
{
switch (meType)
{
- case Date:
+ case text::textfield::Type::DATE:
mpData.reset(new SvxDateField);
break;
- case File:
+ case text::textfield::Type::EXTENDED_FILE:
mpData.reset(
new SvxExtFileField(rtl::OUString(), SVXFILETYPE_VAR, SVXFILEFORMAT_NAME_EXT));
break;
- case Page:
+ case text::textfield::Type::PAGE:
mpData.reset(new SvxPageField);
break;
- case Pages:
+ case text::textfield::Type::PAGES:
mpData.reset(new SvxPagesField);
break;
- case Sheet:
+ case text::textfield::Type::TABLE:
mpData.reset(new SvxTableField);
break;
- case Time:
+ case text::textfield::Type::TIME:
mpData.reset(new SvxTimeField);
break;
- case ExtTime:
+ case text::textfield::Type::EXTENDED_TIME:
{
if (mbIsDate)
mpData.reset(new SvxDateField);
@@ -712,10 +713,10 @@ SvxFieldData* ScEditFieldObj::getData()
mpData.reset(new SvxExtTimeField);
}
break;
- case Title:
+ case text::textfield::Type::FILE:
mpData.reset(new SvxFileField);
break;
- case URL:
+ case text::textfield::Type::URL:
mpData.reset(
new SvxURLField(rtl::OUString(), rtl::OUString(), SVXURLFORMAT_APPDEFAULT));
break;
@@ -972,7 +973,7 @@ void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno
ScEditFieldObj::ScEditFieldObj(
const uno::Reference<text::XTextRange>& rContent,
- ScEditSource* pEditSrc, FieldType eType, const ESelection& rSel) :
+ ScEditSource* pEditSrc, sal_Int32 eType, const ESelection& rSel) :
OComponentHelper(getMutex()),
pPropSet(NULL),
mpEditSource(pEditSrc),
@@ -981,13 +982,13 @@ ScEditFieldObj::ScEditFieldObj(
{
switch (meType)
{
- case File:
+ case text::textfield::Type::EXTENDED_FILE:
pPropSet = lcl_GetFileFieldPropertySet();
break;
- case URL:
+ case text::textfield::Type::URL:
pPropSet = lcl_GetURLPropertySet();
break;
- case ExtTime:
+ case text::textfield::Type::EXTENDED_TIME:
pPropSet = getExtTimePropertySet();
break;
default:
@@ -1019,7 +1020,7 @@ SvxFieldItem ScEditFieldObj::CreateFieldItem()
return SvxFieldItem(*getData(), EE_FEATURE_FIELD);
}
-ScEditFieldObj::FieldType ScEditFieldObj::GetFieldType() const
+sal_Int32 ScEditFieldObj::GetFieldType() const
{
return meType;
}
@@ -1067,7 +1068,7 @@ rtl::OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand )
switch (meType)
{
- case URL:
+ case text::textfield::Type::URL:
{
if (pField->GetClassId() != SVX_URLFIELD)
// Not an URL field, but URL is expected.
@@ -1145,16 +1146,16 @@ void SAL_CALL ScEditFieldObj::setPropertyValue(
SolarMutexGuard aGuard;
switch (meType)
{
- case URL:
+ case text::textfield::Type::URL:
setPropertyValueURL(aPropertyName, aValue);
break;
- case File:
+ case text::textfield::Type::EXTENDED_FILE:
setPropertyValueFile(aPropertyName, aValue);
break;
- case ExtTime:
+ case text::textfield::Type::EXTENDED_TIME:
setPropertyValueExtTime(aPropertyName, aValue);
break;
- case Sheet:
+ case text::textfield::Type::TABLE:
setPropertyValueSheet(aPropertyName, aValue);
break;
default:
@@ -1190,9 +1191,9 @@ uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const rtl::OUString& aProper
switch (meType)
{
- case URL:
+ case text::textfield::Type::URL:
return getPropertyValueURL(aPropertyName);
- case File:
+ case text::textfield::Type::EXTENDED_FILE:
return getPropertyValueFile(aPropertyName);
default:
throw beans::UnknownPropertyException();
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index dd754206220e..1ed78c914fde 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -399,40 +399,7 @@ void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< tex
ScEditFieldObj* pField = ScEditFieldObj::getImplementation(xContent);
uno::Reference<text::XTextContent> xContent2 = xContent;
if (pField)
- {
- switch (pField->GetFieldType())
- {
- case ScEditFieldObj::Date:
- xContent2.set(new SvxUnoTextField(text::textfield::Type::DATE));
- break;
- case ScEditFieldObj::File:
- xContent2.set(new SvxUnoTextField(text::textfield::Type::EXTENDED_FILE));
- break;
- case ScEditFieldObj::Page:
- xContent2.set(new SvxUnoTextField(text::textfield::Type::PAGE));
- break;
- case ScEditFieldObj::Pages:
- xContent2.set(new SvxUnoTextField(text::textfield::Type::PAGES));
- break;
- case ScEditFieldObj::Sheet:
- xContent2.set(new SvxUnoTextField(text::textfield::Type::TABLE));
- break;
- case ScEditFieldObj::Time:
- xContent2.set(new SvxUnoTextField(text::textfield::Type::TIME));
- break;
- case ScEditFieldObj::ExtTime:
- xContent2.set(new SvxUnoTextField(text::textfield::Type::EXTENDED_TIME));
- break;
- case ScEditFieldObj::Title:
- xContent2.set(new SvxUnoTextField(text::textfield::Type::FILE));
- break;
- case ScEditFieldObj::URL:
- xContent2.set(new SvxUnoTextField(text::textfield::Type::URL));
- break;
- default:
- ;
- }
- }
+ xContent2.set(new SvxUnoTextField(pField->GetFieldType()));
GetUnoText().insertTextContent(xRange, xContent2, bAbsorb);
}
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index 50d3362cc782..e4c1558fc4fc 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -33,6 +33,7 @@
#include <editeng/unonrule.hxx>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/text/textfield/Type.hpp>
#include "servuno.hxx"
#include "unonames.hxx"
@@ -423,33 +424,33 @@ sal_uInt16 ScServiceProvider::GetProviderType(const String& rServiceName)
namespace {
-ScEditFieldObj::FieldType getFieldType(sal_uInt16 nOldType)
+sal_Int32 getFieldType(sal_uInt16 nOldType)
{
switch (nOldType)
{
case SC_SERVICE_URLFIELD:
- return ScEditFieldObj::URL;
+ return text::textfield::Type::URL;
case SC_SERVICE_PAGEFIELD:
- return ScEditFieldObj::Page;
+ return text::textfield::Type::PAGE;
case SC_SERVICE_PAGESFIELD:
- return ScEditFieldObj::Pages;
+ return text::textfield::Type::PAGES;
case SC_SERVICE_DATEFIELD:
- return ScEditFieldObj::Date;
+ return text::textfield::Type::DATE;
case SC_SERVICE_TIMEFIELD:
- return ScEditFieldObj::Time;
+ return text::textfield::Type::TIME;
case SC_SERVICE_EXT_TIMEFIELD:
- return ScEditFieldObj::ExtTime;
+ return text::textfield::Type::EXTENDED_TIME;
case SC_SERVICE_TITLEFIELD:
- return ScEditFieldObj::Title;
+ return text::textfield::Type::FILE;
case SC_SERVICE_FILEFIELD:
- return ScEditFieldObj::File;
+ return text::textfield::Type::EXTENDED_FILE;
case SC_SERVICE_SHEETFIELD:
- return ScEditFieldObj::Sheet;
+ return text::textfield::Type::TABLE;
default:
;
}
- return ScEditFieldObj::URL; // default to URL for no reason whatsoever.
+ return text::textfield::Type::URL; // default to URL for no reason whatsoever.
}
}