[Libreoffice-commits] .: 7 commits - editeng/inc editeng/source filter/source offapi/com offapi/UnoApi_offapi.mk sc/inc sc/source sd/source svx/source tools/inc tools/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Sat May 5 08:11:56 PDT 2012
editeng/inc/editeng/flditem.hxx | 47 ++----
editeng/inc/editeng/measfld.hxx | 4
editeng/inc/editeng/unofield.hxx | 19 --
editeng/source/editeng/fieldupdater.cxx | 6
editeng/source/uno/unofield.cxx | 198 ++++++++++++++--------------
editeng/source/xml/xmltxtexp.cxx | 2
filter/source/svg/svgexport.cxx | 17 +-
offapi/UnoApi_offapi.mk | 3
offapi/com/sun/star/text/textfield/Type.idl | 67 +++++++++
sc/inc/fielduno.hxx | 10 -
sc/source/core/tool/editutil.cxx | 12 +
sc/source/ui/unoobj/cellsuno.cxx | 3
sc/source/ui/unoobj/fielduno.cxx | 88 +++---------
sc/source/ui/unoobj/notesuno.cxx | 35 ----
sc/source/ui/unoobj/servuno.cxx | 23 +--
sc/source/ui/unoobj/shapeuno.cxx | 2
sd/source/ui/unoidl/unomodel.cxx | 8 -
svx/source/unodraw/unomod.cxx | 4
tools/inc/tools/pstm.hxx | 14 -
tools/source/ref/pstm.cxx | 4
20 files changed, 275 insertions(+), 291 deletions(-)
New commits:
commit 146a73e243bb54085055271f08156e2cf5dbd3f2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 4 23:45:24 2012 -0400
Use UNO's field type values for the SvxFieldData class IDs too.
Change-Id: I Iae5abcd0936f176b0b8976b6ea50cfe3e18593b4
diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx
index e3eda9f..14a3980 100644
--- a/editeng/inc/editeng/flditem.hxx
+++ b/editeng/inc/editeng/flditem.hxx
@@ -35,6 +35,8 @@
#include <tools/pstm.hxx>
#include "editeng/editengdllapi.h"
+#include <com/sun/star/text/textfield/Type.hpp>
+
class SvNumberFormatter;
class MetaAction;
@@ -45,7 +47,7 @@ class MetaAction;
class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase
{
public:
- SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, 1 )
+ SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, -1 )
SvxFieldData();
virtual ~SvxFieldData();
@@ -89,21 +91,6 @@ public:
// The following are the derivatives of SvxFieldData ...
// =================================================================
-#define SVX_DATEFIELD 2
-#define SVX_URLFIELD 3
-
-#define SVX_PAGEFIELD 100 // Ex-Calc Fields
-#define SVX_PAGESFIELD 101
-#define SVX_TIMEFIELD 102
-#define SVX_FILEFIELD 103
-#define SVX_TABLEFIELD 104
-#define SVX_EXT_TIMEFIELD 105
-#define SVX_EXT_FILEFIELD 106
-#define SVX_AUTHORFIELD 107
-#define SVX_HEADERFIELD 108
-#define SVX_FOOTERFIELD 109
-#define SVX_DATEFIMEFIELD 110
-
enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR };
enum SvxDateFormat { SVXDATEFORMAT_APPDEFAULT, // Set as in App
SVXDATEFORMAT_SYSTEM, // Set as in System
@@ -124,7 +111,7 @@ class EDITENG_DLLPUBLIC SvxDateField : public SvxFieldData
SvxDateFormat eFormat;
public:
- SV_DECL_PERSIST1( SvxDateField, SvxFieldData, SVX_DATEFIELD )
+ SV_DECL_PERSIST1( SvxDateField, SvxFieldData, com::sun::star::text::textfield::Type::DATE )
SvxDateField();
SvxDateField( const Date& rDate,
@@ -166,7 +153,7 @@ private:
rtl::OUString aTargetFrame; // In what Frame
public:
- SV_DECL_PERSIST1( SvxURLField, SvxFieldData, SVX_URLFIELD )
+ SV_DECL_PERSIST1( SvxURLField, SvxFieldData, com::sun::star::text::textfield::Type::URL )
SvxURLField();
SvxURLField( const rtl::OUString& rURL, const rtl::OUString& rRepres, SvxURLFormat eFmt = SVXURLFORMAT_URL );
@@ -192,7 +179,7 @@ public:
class EDITENG_DLLPUBLIC SvxPageField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxPageField, SvxFieldData, SVX_PAGEFIELD )
+ SV_DECL_PERSIST1( SvxPageField, SvxFieldData, com::sun::star::text::textfield::Type::PAGE )
SvxPageField();
virtual SvxFieldData* Clone() const;
@@ -204,7 +191,7 @@ public:
class EDITENG_DLLPUBLIC SvxPagesField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxPagesField, SvxFieldData, SVX_PAGESFIELD )
+ SV_DECL_PERSIST1( SvxPagesField, SvxFieldData, com::sun::star::text::textfield::Type::PAGES )
SvxPagesField();
virtual SvxFieldData* Clone() const;
@@ -214,7 +201,7 @@ public:
class EDITENG_DLLPUBLIC SvxTimeField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxTimeField, SvxFieldData, SVX_TIMEFIELD )
+ SV_DECL_PERSIST1( SvxTimeField, SvxFieldData, com::sun::star::text::textfield::Type::TIME )
SvxTimeField();
virtual SvxFieldData* Clone() const;
@@ -226,7 +213,7 @@ public:
class EDITENG_DLLPUBLIC SvxFileField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxFileField, SvxFieldData, SVX_FILEFIELD )
+ SV_DECL_PERSIST1( SvxFileField, SvxFieldData, com::sun::star::text::textfield::Type::FILE )
SvxFileField();
virtual SvxFieldData* Clone() const;
@@ -237,7 +224,7 @@ class EDITENG_DLLPUBLIC SvxTableField : public SvxFieldData
{
int mnTab;
public:
- SV_DECL_PERSIST1( SvxTableField, SvxFieldData, SVX_TABLEFIELD )
+ SV_DECL_PERSIST1( SvxTableField, SvxFieldData, com::sun::star::text::textfield::Type::TABLE )
SvxTableField();
SvxTableField(int nTab);
@@ -272,7 +259,7 @@ private:
SvxTimeFormat eFormat;
public:
- SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, SVX_EXT_TIMEFIELD )
+ SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_TIME )
SvxExtTimeField();
SvxExtTimeField( const Time& rTime,
SvxTimeType eType = SVXTIMETYPE_VAR,
@@ -316,7 +303,7 @@ private:
SvxFileFormat eFormat;
public:
- SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, SVX_EXT_FILEFIELD )
+ SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_FILE )
SvxExtFileField();
SvxExtFileField( const rtl::OUString& rString,
SvxFileType eType = SVXFILETYPE_VAR,
@@ -355,7 +342,7 @@ private:
SvxAuthorFormat eFormat;
public:
- SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, SVX_AUTHORFIELD )
+ SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, com::sun::star::text::textfield::Type::AUTHOR )
SvxAuthorField();
SvxAuthorField(
const rtl::OUString& rFirstName,
@@ -390,7 +377,7 @@ public:
class EDITENG_DLLPUBLIC SvxHeaderField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, SVX_HEADERFIELD )
+ SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, com::sun::star::text::textfield::Type::HEADER )
SvxHeaderField();
virtual SvxFieldData* Clone() const;
@@ -402,7 +389,7 @@ public:
class EDITENG_DLLPUBLIC SvxFooterField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, SVX_FOOTERFIELD )
+ SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, com::sun::star::text::textfield::Type::FOOTER )
SvxFooterField();
virtual SvxFieldData* Clone() const;
virtual int operator==( const SvxFieldData& ) const;
@@ -413,7 +400,7 @@ public:
class EDITENG_DLLPUBLIC SvxDateTimeField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, SVX_DATEFIMEFIELD )
+ SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, com::sun::star::text::textfield::Type::DATE_TIME )
SvxDateTimeField();
static rtl::OUString GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
diff --git a/editeng/inc/editeng/measfld.hxx b/editeng/inc/editeng/measfld.hxx
index d3d23cd..96060e1 100644
--- a/editeng/inc/editeng/measfld.hxx
+++ b/editeng/inc/editeng/measfld.hxx
@@ -40,7 +40,7 @@
#endif
#include "editeng/editengdllapi.h"
-#define SDR_MEASUREFIELD 50
+#include <com/sun/star/text/textfield/Type.hpp>
class SdrMeasureObj;
@@ -49,7 +49,7 @@ enum SdrMeasureFieldKind {SDRMEASUREFIELD_VALUE,SDRMEASUREFIELD_UNIT,SDRMEASUREF
class EDITENG_DLLPUBLIC SdrMeasureField: public SvxFieldData {
SdrMeasureFieldKind eMeasureFieldKind;
public:
- SV_DECL_PERSIST1(SdrMeasureField,SvxFieldData,SDR_MEASUREFIELD)
+ SV_DECL_PERSIST1(SdrMeasureField,SvxFieldData,com::sun::star::text::textfield::Type::MEASURE)
SdrMeasureField(): eMeasureFieldKind(SDRMEASUREFIELD_VALUE) {}
SdrMeasureField(SdrMeasureFieldKind eNewKind): eMeasureFieldKind(eNewKind) {}
virtual ~SdrMeasureField();
diff --git a/editeng/source/editeng/fieldupdater.cxx b/editeng/source/editeng/fieldupdater.cxx
index 0078440..40e9979 100644
--- a/editeng/source/editeng/fieldupdater.cxx
+++ b/editeng/source/editeng/fieldupdater.cxx
@@ -30,6 +30,10 @@
#include "editeng/flditem.hxx"
#include "editobj2.hxx"
+#include <com/sun/star/text/textfield/Type.hpp>
+
+using namespace com::sun::star;
+
namespace editeng {
class FieldUpdaterImpl
@@ -57,7 +61,7 @@ public:
const SvxFieldItem* pFI = static_cast<const SvxFieldItem*>(pItem);
const SvxFieldData* pData = pFI->GetField();
- if (pData->GetClassId() != SVX_TABLEFIELD)
+ if (pData->GetClassId() != text::textfield::Type::TABLE)
// This is not a table field.
continue;
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 6c38ced..efab93d 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -34,6 +34,7 @@
#include "impsvgdialog.hxx"
#include <com/sun/star/util/MeasureUnit.hpp>
+#include <com/sun/star/text/textfield/Type.hpp>
#include <rtl/bootstrap.hxx>
#include <svtools/miscopt.hxx>
@@ -1772,15 +1773,15 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
pCharSetMap = &( mTextFieldCharSets[ mCreateOjectsCurrentMasterPage ] );
}
const SvxFieldData* pField = pInfo->GetField().GetField();
- if( bHasCharSetMap && ( pField->GetClassId() == SVX_HEADERFIELD ) && ( pCharSetMap->find( aHeaderId ) != pCharSetMap->end() ) )
+ if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::HEADER ) && ( pCharSetMap->find( aHeaderId ) != pCharSetMap->end() ) )
{
pCharSet = &( (*pCharSetMap)[ aHeaderId ] );
}
- else if( bHasCharSetMap && ( pField->GetClassId() == SVX_FOOTERFIELD ) && ( pCharSetMap->find( aFooterId ) != pCharSetMap->end() ) )
+ else if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::FOOTER ) && ( pCharSetMap->find( aFooterId ) != pCharSetMap->end() ) )
{
pCharSet = &( (*pCharSetMap)[ aFooterId ] );
}
- else if( pField->GetClassId() == SVX_DATEFIMEFIELD )
+ else if( pField->GetClassId() == text::textfield::Type::DATE_TIME )
{
if( bHasCharSetMap && ( pCharSetMap->find( aDateTimeId ) != pCharSetMap->end() ) )
{
@@ -1872,7 +1873,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
}
}
}
- else if( pField->GetClassId() == SVX_PAGEFIELD )
+ else if( pField->GetClassId() == text::textfield::Type::PAGE )
{
switch( mVisiblePagePropSet.nPageNumberingType )
{
@@ -1912,20 +1913,20 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
if( mVisiblePagePropSet.bAreBackgroundObjectsVisible )
{
const SvxFieldData* pField = pInfo->GetField().GetField();
- if( ( pField->GetClassId() == SVX_HEADERFIELD ) && mVisiblePagePropSet.bIsHeaderFieldVisible )
+ if( ( pField->GetClassId() == text::textfield::Type::HEADER ) && mVisiblePagePropSet.bIsHeaderFieldVisible )
{
aRepresentation += mVisiblePagePropSet.sHeaderText;
}
- else if( ( pField->GetClassId() == SVX_FOOTERFIELD ) && mVisiblePagePropSet.bIsFooterFieldVisible )
+ else if( ( pField->GetClassId() == text::textfield::Type::FOOTER ) && mVisiblePagePropSet.bIsFooterFieldVisible )
{
aRepresentation += mVisiblePagePropSet.sFooterText;
}
- else if( ( pField->GetClassId() == SVX_DATEFIMEFIELD ) && mVisiblePagePropSet.bIsDateTimeFieldVisible )
+ else if( ( pField->GetClassId() == text::textfield::Type::DATE_TIME ) && mVisiblePagePropSet.bIsDateTimeFieldVisible )
{
// TODO: implement the variable case
aRepresentation += mVisiblePagePropSet.sDateTimeText;
}
- else if( ( pField->GetClassId() == SVX_PAGEFIELD ) && mVisiblePagePropSet.bIsPageNumberFieldVisible )
+ else if( ( pField->GetClassId() == text::textfield::Type::PAGE ) && mVisiblePagePropSet.bIsPageNumberFieldVisible )
{
sal_Int16 nPageNumber = mVisiblePagePropSet.nPageNumber;
switch( mVisiblePagePropSet.nPageNumberingType )
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 65d21c3..29fe83d 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 f7ebbc1..93f3b18 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();
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index df4ec36..8292c13 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -61,6 +61,8 @@
#include <svx/svdpage.hxx>
#include <svx/unoshape.hxx>
+#include <com/sun/star/text/textfield/Type.hpp>
+
//-////////////////////////////////////////////////////////////////////
using namespace ::rtl;
@@ -411,7 +413,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c
if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) )
{
- return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD );
+ return (::cppu::OWeakObject * )new SvxUnoTextField(text::textfield::Type::EXTENDED_DATE);
}
uno::Reference< uno::XInterface > xRet;
commit 8f555e3be27768a7a9a80b5ce4cba95ea1cd2880
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 4 23:01:46 2012 -0400
Use signed 32-bit integer as class IDs.
To allow UNO field type values to be used.
Change-Id: If03d3f37cf5b050fe080771c799c3e82c0264a4a
diff --git a/tools/inc/tools/pstm.hxx b/tools/inc/tools/pstm.hxx
index c989977..4f338a7 100644
--- a/tools/inc/tools/pstm.hxx
+++ b/tools/inc/tools/pstm.hxx
@@ -48,11 +48,11 @@ typedef void * (*SvCreateInstancePersist)( SvPersistBase ** );
class TOOLS_DLLPUBLIC SvClassManager
{
- typedef boost::unordered_map< sal_uInt16, SvCreateInstancePersist > Map;
+ typedef boost::unordered_map<sal_Int32, SvCreateInstancePersist> Map;
Map aAssocTable;
public:
- void Register( sal_uInt16 nClassId, SvCreateInstancePersist pFunc );
- SvCreateInstancePersist Get( sal_uInt16 nClassId );
+ void Register( sal_Int32 nClassId, SvCreateInstancePersist pFunc );
+ SvCreateInstancePersist Get( sal_Int32 nClassId );
};
/************************** S v R t t i B a s e **************************/
@@ -67,11 +67,11 @@ SV_DECL_IMPL_REF(SvRttiBase)
/*************************************************************************/
#define SV_DECL_PERSIST( Class, CLASS_ID ) \
TYPEINFO(); \
- static sal_uInt16 StaticClassId() { return CLASS_ID; } \
+ static sal_Int32 StaticClassId() { return CLASS_ID; } \
static void * CreateInstance( SvPersistBase ** ppBase ); \
friend SvPersistStream& operator >> ( SvPersistStream & rStm, \
Class *& rpObj); \
- virtual sal_uInt16 GetClassId() const; \
+ virtual sal_Int32 GetClassId() const; \
virtual void Load( SvPersistStream & ); \
virtual void Save( SvPersistStream & );
@@ -85,7 +85,7 @@ SV_DECL_IMPL_REF(SvRttiBase)
*ppBase = p; \
return p; \
} \
- sal_uInt16 Class::GetClassId() const \
+ sal_Int32 Class::GetClassId() const \
{ return StaticClassId(); } \
SvPersistStream& operator >> (SvPersistStream & rStm, Class *& rpObj)\
{ \
@@ -108,7 +108,7 @@ class SvPersistStream;
class SvPersistBase : public SvRttiBase
{
public:
- virtual sal_uInt16 GetClassId() const = 0;
+ virtual sal_Int32 GetClassId() const = 0;
virtual void Load( SvPersistStream & ) = 0;
virtual void Save( SvPersistStream & ) = 0;
TOOLS_DLLPUBLIC friend SvPersistStream& operator >> ( SvPersistStream & rStm,
diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx
index cba5070..966aaac 100644
--- a/tools/source/ref/pstm.cxx
+++ b/tools/source/ref/pstm.cxx
@@ -37,7 +37,7 @@
/************************************************************************
|* SvClassManager::Register()
*************************************************************************/
-void SvClassManager::Register( sal_uInt16 nClassId, SvCreateInstancePersist pFunc )
+void SvClassManager::Register( sal_Int32 nClassId, SvCreateInstancePersist pFunc )
{
#ifdef DBG_UTIL
SvCreateInstancePersist p;
@@ -50,7 +50,7 @@ void SvClassManager::Register( sal_uInt16 nClassId, SvCreateInstancePersist pFun
/************************************************************************
|* SvClassManager::Get()
*************************************************************************/
-SvCreateInstancePersist SvClassManager::Get( sal_uInt16 nClassId )
+SvCreateInstancePersist SvClassManager::Get( sal_Int32 nClassId )
{
Map::const_iterator i(aAssocTable.find(nClassId));
return i == aAssocTable.end() ? 0 : i->second;
commit e7dc75ace3ba42d8f7f4736bac66a218cec5f39e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 4 22:15:10 2012 -0400
Have ScEditFieldObj use the UNO field type values.
Change-Id: I300817bd0263f427c9f4c424ae86b608015ce3e8
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index 6874c0b..c20949c 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 db2d9b4..44fdff5 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 4b78a7f..f7ebbc1 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 dd75420..1ed78c9 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 50d3362..e4c1558 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.
}
}
commit 204c898d7b69731a6a013bb02842400d4a828783
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 4 21:58:22 2012 -0400
Use the UNO field type values instead of the internal ones.
Change-Id: I43c374f549bbcddaa1a1bd63c1eb346130208b60
diff --git a/editeng/inc/editeng/unofield.hxx b/editeng/inc/editeng/unofield.hxx
index 13e8e70..0be97f8 100644
--- a/editeng/inc/editeng/unofield.hxx
+++ b/editeng/inc/editeng/unofield.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/textfield/Type.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/component.hxx>
#include "editeng/editengdllapi.h"
@@ -41,23 +42,6 @@
#include <editeng/mutxhelp.hxx>
-// ids usable for the constructor
-#define ID_DATEFIELD 0
-#define ID_URLFIELD 1
-#define ID_PAGEFIELD 2
-#define ID_PAGESFIELD 3
-#define ID_TIMEFIELD 4
-#define ID_FILEFIELD 5
-#define ID_TABLEFIELD 6
-#define ID_EXT_TIMEFIELD 7
-#define ID_EXT_FILEFIELD 8
-#define ID_AUTHORFIELD 9
-#define ID_MEASUREFIELD 10
-#define ID_EXT_DATEFIELD 11
-#define ID_HEADERFIELD 12
-#define ID_FOOTERFIELD 13
-#define ID_DATETIMEFIELD 14
-
class SvxUnoFieldData_Impl;
class SfxItemPropertySet;
class SvxFieldData;
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index aa90bfe..7b97684 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -146,27 +146,20 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
switch( mnId )
{
- case ID_EXT_DATEFIELD:
- case ID_EXT_TIMEFIELD:
+ case text::textfield::Type::EXTENDED_DATE:
+ case text::textfield::Type::EXTENDED_TIME:
return &aExDateTimeFieldPropertySet_Impl;
- case ID_URLFIELD:
+ case text::textfield::Type::URL:
return &aUrlFieldPropertySet_Impl;
- case ID_DATEFIELD:
- case ID_TIMEFIELD:
+ case text::textfield::Type::DATE:
+ case text::textfield::Type::TIME:
return &aDateTimeFieldPropertySet_Impl;
- case ID_EXT_FILEFIELD:
+ case text::textfield::Type::EXTENDED_FILE:
return &aExtFileFieldPropertySet_Impl;
- case ID_AUTHORFIELD:
+ case text::textfield::Type::AUTHOR:
return &aAuthorFieldPropertySet_Impl;
- case ID_MEASUREFIELD:
+ case text::textfield::Type::MEASURE:
return &aMeasureFieldPropertySet_Impl;
-// case ID_PAGEFIELD:
-// case ID_PAGESFIELD:
-// case ID_FILEFIELD:
-// case ID_TABLEFIELD:
-// case ID_HEADERFIELD:
-// case ID_FOOTERFIELD:
-// case ID_DATETIMEFIELD::
default:
return &aEmptyPropertySet_Impl;
}
@@ -274,36 +267,36 @@ SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) throw()
switch( nServiceId )
{
- case ID_EXT_DATEFIELD:
- case ID_DATEFIELD:
+ case text::textfield::Type::EXTENDED_DATE:
+ case text::textfield::Type::DATE:
mpImpl->mbBoolean2 = sal_True;
mpImpl->mnInt32 = SVXDATEFORMAT_STDSMALL;
mpImpl->mbBoolean1 = sal_False;
break;
- case ID_EXT_TIMEFIELD:
- case ID_TIMEFIELD:
+ case text::textfield::Type::EXTENDED_TIME:
+ case text::textfield::Type::TIME:
mpImpl->mbBoolean2 = sal_False;
mpImpl->mbBoolean1 = sal_False;
mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
break;
- case ID_URLFIELD:
+ case text::textfield::Type::URL:
mpImpl->mnInt16 = SVXURLFORMAT_REPR;
break;
- case ID_EXT_FILEFIELD:
+ case text::textfield::Type::EXTENDED_FILE:
mpImpl->mbBoolean1 = sal_False;
mpImpl->mnInt16 = text::FilenameDisplayFormat::FULL;
break;
- case ID_AUTHORFIELD:
+ case text::textfield::Type::AUTHOR:
mpImpl->mnInt16 = SVXAUTHORFORMAT_FULLNAME;
mpImpl->mbBoolean1 = sal_False;
mpImpl->mbBoolean2 = sal_True;
break;
- case ID_MEASUREFIELD:
+ case text::textfield::Type::MEASURE:
mpImpl->mnInt16 = SDRMEASUREFIELD_VALUE;
break;
@@ -336,8 +329,8 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
// extract field properties from data class
switch( mnServiceId )
{
- case ID_DATEFIELD:
- case ID_EXT_DATEFIELD:
+ case text::textfield::Type::DATE:
+ case text::textfield::Type::EXTENDED_DATE:
{
mpImpl->mbBoolean2 = sal_True;
// #i35416# for variable date field, don't use invalid "0000-00-00" date,
@@ -351,20 +344,20 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
}
break;
- case ID_TIMEFIELD:
+ case text::textfield::Type::TIME:
mpImpl->mbBoolean2 = sal_False;
mpImpl->mbBoolean1 = sal_False;
mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
break;
- case ID_EXT_TIMEFIELD:
+ case text::textfield::Type::EXTENDED_TIME:
mpImpl->mbBoolean2 = sal_False;
mpImpl->maDateTime = getTime( ((SvxExtTimeField*)pData)->GetFixTime() );
mpImpl->mbBoolean1 = ((SvxExtTimeField*)pData)->GetType() == SVXTIMETYPE_FIX;
mpImpl->mnInt32 = ((SvxExtTimeField*)pData)->GetFormat();
break;
- case ID_URLFIELD:
+ case text::textfield::Type::URL:
mpImpl->msString1 = ((SvxURLField*)pData)->GetRepresentation();
mpImpl->msString2 = ((SvxURLField*)pData)->GetTargetFrame();
mpImpl->msString3 = ((SvxURLField*)pData)->GetURL();
@@ -372,13 +365,13 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
((SvxURLField*)pData)->GetFormat());
break;
- case ID_EXT_FILEFIELD:
+ case text::textfield::Type::EXTENDED_FILE:
mpImpl->msString1 = ((SvxExtFileField*)pData)->GetFile();
mpImpl->mbBoolean1 = ((SvxExtFileField*)pData)->GetType() == SVXFILETYPE_FIX;
mpImpl->mnInt16 = getFileNameDisplayFormat(((SvxExtFileField*)pData)->GetFormat());
break;
- case ID_AUTHORFIELD:
+ case text::textfield::Type::AUTHOR:
mpImpl->msString1 = ((SvxAuthorField*)pData)->GetFormatted();
mpImpl->msString2 = ((SvxAuthorField*)pData)->GetFormatted();
mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(
@@ -387,7 +380,7 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
mpImpl->mbBoolean2 = ((SvxAuthorField*)pData)->GetFormat() != SVXAUTHORFORMAT_SHORTNAME;
break;
- case ID_MEASUREFIELD:
+ case text::textfield::Type::MEASURE:
mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(((SdrMeasureField*)pData)->GetMeasureFieldKind());
break;
}
@@ -408,10 +401,10 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
switch( mnServiceId )
{
- case ID_TIMEFIELD:
- case ID_EXT_TIMEFIELD:
- case ID_DATEFIELD:
- case ID_EXT_DATEFIELD:
+ case text::textfield::Type::TIME:
+ case text::textfield::Type::EXTENDED_TIME:
+ case text::textfield::Type::DATE:
+ case text::textfield::Type::EXTENDED_DATE:
{
if( mpImpl->mbBoolean2 ) // IsDate?
{
@@ -422,7 +415,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
}
else
{
- if( mnServiceId != ID_TIMEFIELD && mnServiceId != ID_DATEFIELD )
+ if( mnServiceId != text::textfield::Type::TIME && mnServiceId != text::textfield::Type::DATE )
{
Time aTime( setTime( mpImpl->maDateTime ) );
pData = new SvxExtTimeField( aTime, mpImpl->mbBoolean1?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR );
@@ -439,30 +432,30 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
}
break;
- case ID_URLFIELD:
+ case text::textfield::Type::URL:
pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1, !mpImpl->msString1.isEmpty() ? SVXURLFORMAT_REPR : SVXURLFORMAT_URL );
((SvxURLField*)pData)->SetTargetFrame( mpImpl->msString2 );
if( mpImpl->mnInt16 >= SVXURLFORMAT_APPDEFAULT && mpImpl->mnInt16 <= SVXURLFORMAT_REPR )
((SvxURLField*)pData)->SetFormat( (SvxURLFormat)mpImpl->mnInt16 );
break;
- case ID_PAGEFIELD:
+ case text::textfield::Type::PAGE:
pData = new SvxPageField();
break;
- case ID_PAGESFIELD:
+ case text::textfield::Type::PAGES:
pData = new SvxPagesField();
break;
- case ID_FILEFIELD:
+ case text::textfield::Type::FILE:
pData = new SvxFileField();
break;
- case ID_TABLEFIELD:
+ case text::textfield::Type::TABLE:
pData = new SvxTableField();
break;
- case ID_EXT_FILEFIELD:
+ case text::textfield::Type::EXTENDED_FILE:
{
// #92009# pass fixed attribute to constructor
pData = new SvxExtFileField( mpImpl->msString1,
@@ -471,7 +464,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
break;
}
- case ID_AUTHORFIELD:
+ case text::textfield::Type::AUTHOR:
{
::rtl::OUString aContent;
String aFirstName;
@@ -514,7 +507,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
break;
}
- case ID_MEASUREFIELD:
+ case text::textfield::Type::MEASURE:
{
SdrMeasureFieldKind eKind = SDRMEASUREFIELD_VALUE;
if( mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_UNIT || mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_ROTA90BLANCS )
@@ -522,13 +515,13 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
pData = new SdrMeasureField( eKind);
break;
}
- case ID_HEADERFIELD:
+ case text::textfield::Type::HEADER:
pData = new SvxHeaderField();
break;
- case ID_FOOTERFIELD:
+ case text::textfield::Type::FOOTER:
pData = new SvxFooterField();
break;
- case ID_DATETIMEFIELD:
+ case text::textfield::Type::DATE_TIME:
pData = new SvxDateTimeField();
break;
};
@@ -727,35 +720,35 @@ void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName,
switch( mnId )
{
- case ID_DATEFIELD:
+ case text::textfield::Type::DATE:
{
SvxDateField* pDate = PTR_CAST( SvxDateField, aFieldItem.GetField() );
if(pDate)
pDate->SetFormat( (SvxDateFormat)nFormat );
break;
}
- case ID_URLFIELD:
+ case text::textfield::Type::URL:
{
SvxURLField* pURL = PTR_CAST( SvxURLField, aFieldItem.GetField() );
if(pURL)
pURL->SetFormat( (SvxURLFormat)nFormat );
break;
}
- case ID_EXT_TIMEFIELD:
+ case text::textfield::Type::EXTENDED_TIME:
{
SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, aFieldItem.GetField() );
if(pTime)
pTime->SetFormat( (SvxTimeFormat)nFormat );
break;
}
- case ID_EXT_FILEFIELD:
+ case text::textfield::Type::EXTENDED_FILE:
{
SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, aFieldItem.GetField() );
if(pFile)
pFile->SetFormat( (SvxFileFormat)nFormat );
break;
}
- case ID_AUTHORFIELD:
+ case text::textfield::Type::AUTHOR:
{
SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, aFieldItem.GetField() );
if(pAuthor)
@@ -774,28 +767,28 @@ void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName,
sal_Bool bFix( *(sal_Bool*)aValue.getValue() );
switch( mnId )
{
- case ID_EXT_TIMEFIELD:
+ case text::textfield::Type::EXTENDED_TIME:
{
SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, aFieldItem.GetField() );
if(pTime)
pTime->SetType( (SvxTimeType)bFix?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR );
break;
}
- case ID_DATEFIELD:
+ case text::textfield::Type::DATE:
{
SvxDateField* pDate = PTR_CAST( SvxDateField, aFieldItem.GetField() );
if(pDate)
pDate->SetType( (SvxDateType)bFix?SVXDATETYPE_FIX:SVXDATETYPE_VAR );
break;
}
- case ID_EXT_FILEFIELD:
+ case text::textfield::Type::EXTENDED_FILE:
{
SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, aFieldItem.GetField() );
if(pFile)
pFile->SetType( (SvxFileType)bFix?SVXFILETYPE_FIX:SVXFILETYPE_VAR );
break;
}
- case ID_AUTHORFIELD:
+ case text::textfield::Type::AUTHOR:
{
SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, aFieldItem.GetField() );
if(pAuthor)
@@ -887,35 +880,35 @@ uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyNam
case WID_FORMAT:
switch( mnId )
{
- case ID_DATEFIELD:
+ case text::textfield::Type::DATE:
{
SvxDateField* pDate = PTR_CAST( SvxDateField, pFieldItem->GetField() );
if(pDate)
aValue <<= (sal_Int32)pDate->GetFormat();
break;
}
- case ID_URLFIELD:
+ case text::textfield::Type::URL:
{
SvxURLField* pURL = PTR_CAST( SvxURLField, pFieldItem->GetField() );
if(pURL)
aValue <<= (sal_Int32)pURL->GetFormat();
break;
}
- case ID_EXT_TIMEFIELD:
+ case text::textfield::Type::EXTENDED_TIME:
{
SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, pFieldItem->GetField() );
if(pTime)
aValue <<= (sal_Int32)pTime->GetFormat();
break;
}
- case ID_EXT_FILEFIELD:
+ case text::textfield::Type::EXTENDED_FILE:
{
SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, pFieldItem->GetField() );
if(pFile)
aValue <<= (sal_Int32)pFile->GetFormat();
break;
}
- case ID_AUTHORFIELD:
+ case text::textfield::Type::AUTHOR:
{
SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, pFieldItem->GetField() );
if(pAuthor)
@@ -931,28 +924,28 @@ uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyNam
sal_Bool bFix = sal_False;
switch( mnId )
{
- case ID_EXT_TIMEFIELD:
+ case text::textfield::Type::EXTENDED_TIME:
{
SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, pFieldItem->GetField() );
if(pTime)
bFix = pTime->GetType() == SVXTIMETYPE_FIX;
break;
}
- case ID_DATEFIELD:
+ case text::textfield::Type::DATE:
{
SvxDateField* pDate = PTR_CAST( SvxDateField, pFieldItem->GetField() );
if(pDate)
bFix = pDate->GetType() == SVXDATETYPE_FIX;
break;
}
- case ID_EXT_FILEFIELD:
+ case text::textfield::Type::EXTENDED_FILE:
{
SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, pFieldItem->GetField() );
if(pFile)
bFix = pFile->GetType() == SVXFILETYPE_FIX;
break;
}
- case ID_AUTHORFIELD:
+ case text::textfield::Type::AUTHOR:
{
SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, pFieldItem->GetField() );
if(pAuthor)
@@ -1026,33 +1019,33 @@ void SvxUnoTextField::disposing()
sal_Int32 SvxUnoTextField::GetFieldId( const SvxFieldData* pFieldData ) const throw()
{
if( pFieldData->ISA( SvxURLField ) )
- return ID_URLFIELD;
+ return text::textfield::Type::URL;
else if( pFieldData->ISA( SvxPageField ) )
- return ID_PAGEFIELD;
+ return text::textfield::Type::PAGE;
else if( pFieldData->ISA( SvxPagesField ) )
- return ID_PAGESFIELD;
+ return text::textfield::Type::PAGES;
else if( pFieldData->ISA( SvxTimeField ) )
- return ID_TIMEFIELD;
+ return text::textfield::Type::TIME;
else if( pFieldData->ISA( SvxFileField ) )
- return ID_FILEFIELD;
+ return text::textfield::Type::FILE;
else if( pFieldData->ISA( SvxTableField ) )
- return ID_TABLEFIELD;
+ return text::textfield::Type::TABLE;
else if( pFieldData->ISA( SvxExtTimeField ) )
- return ID_EXT_TIMEFIELD;
+ return text::textfield::Type::EXTENDED_TIME;
else if( pFieldData->ISA( SvxExtFileField ) )
- return ID_EXT_FILEFIELD;
+ return text::textfield::Type::EXTENDED_FILE;
else if( pFieldData->ISA( SvxAuthorField ) )
- return ID_AUTHORFIELD;
+ return text::textfield::Type::AUTHOR;
else if( pFieldData->ISA( SvxDateField ) )
- return ID_EXT_DATEFIELD;
+ return text::textfield::Type::EXTENDED_DATE;
else if( pFieldData->ISA( SdrMeasureField ) )
- return ID_MEASUREFIELD;
+ return text::textfield::Type::MEASURE;
else if( pFieldData->ISA( SvxHeaderField ) )
- return ID_HEADERFIELD;
+ return text::textfield::Type::HEADER;
else if( pFieldData->ISA( SvxFooterField ) )
- return ID_FOOTERFIELD;
+ return text::textfield::Type::FOOTER;
else if( pFieldData->ISA( SvxDateTimeField ) )
- return ID_DATETIMEFIELD;
+ return text::textfield::Type::DATE_TIME;
return UNKNOWN_FIELD;
}
@@ -1138,42 +1131,42 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
if ( aFieldType == "DateTime" )
{
- nId = ID_DATEFIELD;
+ nId = text::textfield::Type::DATE;
}
else if ( aFieldType == "URL" )
{
- nId = ID_URLFIELD;
+ nId = text::textfield::Type::URL;
}
else if ( aFieldType == "PageNumber" )
{
- nId = ID_PAGEFIELD;
+ nId = text::textfield::Type::PAGE;
}
else if ( aFieldType == "PageCount" )
{
- nId = ID_PAGESFIELD;
+ nId = text::textfield::Type::PAGES;
}
else if ( aFieldType == "SheetName" )
{
- nId = ID_TABLEFIELD;
+ nId = text::textfield::Type::TABLE;
}
else if ( aFieldType == "FileName" )
{
- nId = ID_EXT_FILEFIELD;
+ nId = text::textfield::Type::EXTENDED_FILE;
}
else if (aFieldType.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("docinfo.Title") ) ||
aFieldType.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("DocInfo.Title") ) )
{
- nId = ID_FILEFIELD;
+ nId = text::textfield::Type::FILE;
}
else if ( aFieldType == "Author" )
{
- nId = ID_AUTHORFIELD;
+ nId = text::textfield::Type::AUTHOR;
}
else if ( aFieldType == "Measure" )
{
- nId = ID_MEASUREFIELD;
+ nId = text::textfield::Type::MEASURE;
}
if (nId != UNKNOWN_FIELD)
diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx
index 514e600..15ea264 100644
--- a/editeng/source/xml/xmltxtexp.cxx
+++ b/editeng/source/xml/xmltxtexp.cxx
@@ -245,7 +245,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxSimpleUnoModel::createInstance( co
RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime")))
)
{
- return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD );
+ return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::EXTENDED_DATE );
}
return SvxUnoTextCreateTextField( aServiceSpecifier );
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index 0e77d85..dd75420 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -403,31 +403,31 @@ void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< tex
switch (pField->GetFieldType())
{
case ScEditFieldObj::Date:
- xContent2.set(new SvxUnoTextField(ID_DATEFIELD));
+ xContent2.set(new SvxUnoTextField(text::textfield::Type::DATE));
break;
case ScEditFieldObj::File:
- xContent2.set(new SvxUnoTextField(ID_EXT_FILEFIELD));
+ xContent2.set(new SvxUnoTextField(text::textfield::Type::EXTENDED_FILE));
break;
case ScEditFieldObj::Page:
- xContent2.set(new SvxUnoTextField(ID_PAGEFIELD));
+ xContent2.set(new SvxUnoTextField(text::textfield::Type::PAGE));
break;
case ScEditFieldObj::Pages:
- xContent2.set(new SvxUnoTextField(ID_PAGESFIELD));
+ xContent2.set(new SvxUnoTextField(text::textfield::Type::PAGES));
break;
case ScEditFieldObj::Sheet:
- xContent2.set(new SvxUnoTextField(ID_TABLEFIELD));
+ xContent2.set(new SvxUnoTextField(text::textfield::Type::TABLE));
break;
case ScEditFieldObj::Time:
- xContent2.set(new SvxUnoTextField(ID_TIMEFIELD));
+ xContent2.set(new SvxUnoTextField(text::textfield::Type::TIME));
break;
case ScEditFieldObj::ExtTime:
- xContent2.set(new SvxUnoTextField(ID_EXT_TIMEFIELD));
+ xContent2.set(new SvxUnoTextField(text::textfield::Type::EXTENDED_TIME));
break;
case ScEditFieldObj::Title:
- xContent2.set(new SvxUnoTextField(ID_FILEFIELD));
+ xContent2.set(new SvxUnoTextField(text::textfield::Type::FILE));
break;
case ScEditFieldObj::URL:
- xContent2.set(new SvxUnoTextField(ID_URLFIELD));
+ xContent2.set(new SvxUnoTextField(text::textfield::Type::URL));
break;
default:
;
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index f5e53ce..bb0c5ab 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -1131,7 +1131,7 @@ void SAL_CALL ScShapeObj::insertTextContent( const uno::Reference<text::XTextRan
// To insert it into drawing text, a SvxUnoTextField is needed instead.
// The ScCellFieldObj object is left in non-inserted state.
- SvxUnoTextField* pDrawField = new SvxUnoTextField( ID_URLFIELD );
+ SvxUnoTextField* pDrawField = new SvxUnoTextField( text::textfield::Type::URL );
xEffContent.set(pDrawField);
lcl_CopyOneProperty( *pDrawField, *pCellField, SC_UNONAME_URL );
lcl_CopyOneProperty( *pDrawField, *pCellField, SC_UNONAME_REPR );
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index f031a5b..6796fe7 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -907,25 +907,25 @@ uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( c
if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) ) ||
( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.textfield.DateTime") ) ) )
{
- return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD );
+ return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::EXTENDED_DATE );
}
if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Header"))) ||
(0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Header"))) )
{
- return (::cppu::OWeakObject * )new SvxUnoTextField( ID_HEADERFIELD );
+ return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::HEADER );
}
if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Footer"))) ||
(0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Footer"))) )
{
- return (::cppu::OWeakObject * )new SvxUnoTextField( ID_FOOTERFIELD );
+ return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::FOOTER );
}
if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.DateTime"))) ||
(0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.DateTime"))) )
{
- return (::cppu::OWeakObject * )new SvxUnoTextField( ID_DATETIMEFIELD );
+ return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::DATE_TIME );
}
if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap") ) )
commit 194785f8b06182ba8caed8448fc61dd82a24dbcb
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 4 17:23:04 2012 -0400
Added new constant group to enumerate text field types.
Change-Id: Iee2cd5994ce5145e3449dd5b62309ae3cee6603d
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 3edb190..ca50d1b 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1372,6 +1372,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/text/te
User \
WordCount \
))
+$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/text/textfield,\
+ Type \
+))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/text/textfield/docinfo,\
ChangeAuthor \
ChangeDateTime \
diff --git a/offapi/com/sun/star/text/textfield/Type.idl b/offapi/com/sun/star/text/textfield/Type.idl
new file mode 100644
index 0000000..fe99a91
--- /dev/null
+++ b/offapi/com/sun/star/text/textfield/Type.idl
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef __com_sun_star_text_textfield_Type_idl__
+#define __com_sun_star_text_textfield_Type_idl__
+
+
+module com { module sun { module star { module text { module textfield {
+
+/**
+ * Text field types.
+ *
+ * Right now this only contains the types that are supported by the edit engine,
+ * but it should eventually contain all field types that are used across all
+ * engines.
+ *
+ * @since LibreOffice 3.6
+ */
+constants Type
+{
+ const long DATE = 0;
+ const long URL = 1;
+ const long PAGE = 2;
+ const long PAGES = 3;
+ const long TIME = 4;
+ const long FILE = 5;
+ const long TABLE = 6;
+ const long EXTENDED_TIME = 7;
+ const long EXTENDED_FILE = 8;
+ const long AUTHOR = 9;
+ const long MEASURE = 10;
+ const long EXTENDED_DATE = 11;
+ const long HEADER = 12;
+ const long FOOTER = 13;
+ const long DATE_TIME = 14;
+};
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d789d1a1966b4385343db6b9c5a4d855147817e2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 4 14:30:13 2012 -0400
Avoid the ID of unknown field being the highest number of all field IDs.
Change-Id: Ifcc62cd15dcfe0cb37f7c851930ff103384f3827
diff --git a/editeng/inc/editeng/unofield.hxx b/editeng/inc/editeng/unofield.hxx
index 2c53fb7..13e8e70 100644
--- a/editeng/inc/editeng/unofield.hxx
+++ b/editeng/inc/editeng/unofield.hxx
@@ -57,7 +57,6 @@
#define ID_HEADERFIELD 12
#define ID_FOOTERFIELD 13
#define ID_DATETIMEFIELD 14
-#define ID_UNKNOWN 15 // this must be the last entry
class SvxUnoFieldData_Impl;
class SfxItemPropertySet;
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 1038066..aa90bfe 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -59,6 +59,13 @@ using namespace ::com::sun::star;
#define WID_STRING2 6
#define WID_STRING3 7
+const sal_Int32 UNKNOWN_FIELD = -1;
+
+inline bool isValidFieldId(sal_Int32 nId)
+{
+ return nId >= 0;
+}
+
class SvxUnoFieldData_Impl
{
public:
@@ -181,8 +188,7 @@ static sal_Char const* aFieldItemNameMap_Impl[] =
"ExtDate",
"Header",
"Footer",
- "DateTime",
- "Unknown"
+ "DateTime"
};
/* conversion routines */
@@ -314,7 +320,7 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
: OComponentHelper( getMutex() )
, mxAnchor( xAnchor )
, mpPropSet(NULL)
-, mnServiceId(ID_UNKNOWN)
+, mnServiceId(UNKNOWN_FIELD)
, mpImpl( new SvxUnoFieldData_Impl )
{
DBG_ASSERT(pData, "pFieldData == NULL! [CL]" );
@@ -324,8 +330,8 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
if(pData)
{
mnServiceId = GetFieldId(pData);
- DBG_ASSERT(mnServiceId != ID_UNKNOWN, "unknown SvxFieldData! [CL]");
- if(mnServiceId != ID_UNKNOWN)
+ DBG_ASSERT(mnServiceId != UNKNOWN_FIELD, "unknown SvxFieldData! [CL]");
+ if(mnServiceId != UNKNOWN_FIELD)
{
// extract field properties from data class
switch( mnServiceId )
@@ -603,8 +609,11 @@ OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand )
if(bShowCommand)
{
- DBG_ASSERT( ((sal_uInt32)mnServiceId) < ID_UNKNOWN, "Unknown field type" );
- return OUString::createFromAscii( aFieldItemNameMap_Impl[(((sal_uInt32)mnServiceId) > ID_UNKNOWN)? ID_UNKNOWN : mnServiceId ] );
+ DBG_ASSERT(mnServiceId >= 0, "Unknown field type");
+ if (isValidFieldId(mnServiceId))
+ return OUString::createFromAscii(aFieldItemNameMap_Impl[mnServiceId]);
+ else
+ return OUString("Unknown");
}
else
{
@@ -1045,7 +1054,7 @@ sal_Int32 SvxUnoTextField::GetFieldId( const SvxFieldData* pFieldData ) const th
else if( pFieldData->ISA( SvxDateTimeField ) )
return ID_DATETIMEFIELD;
- return ID_UNKNOWN;
+ return UNKNOWN_FIELD;
}
// lang::XServiceInfo
@@ -1125,7 +1134,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
{
OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
- sal_Int32 nId = ID_UNKNOWN;
+ sal_Int32 nId = UNKNOWN_FIELD;
if ( aFieldType == "DateTime" )
{
@@ -1167,7 +1176,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
nId = ID_MEASUREFIELD;
}
- if( nId != ID_UNKNOWN )
+ if (nId != UNKNOWN_FIELD)
xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId );
}
commit a8aa83867e122fdfcda3221c0b94a0e8cb7bad09
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 4 14:18:18 2012 -0400
Nobody uses this.
Change-Id: I8bfb2d04285885c76f0ed1455c46612ad5ec98b0
diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx
index 933f3e2..e3eda9f 100644
--- a/editeng/inc/editeng/flditem.hxx
+++ b/editeng/inc/editeng/flditem.hxx
@@ -104,8 +104,6 @@ public:
#define SVX_FOOTERFIELD 109
#define SVX_DATEFIMEFIELD 110
-#define SVX_USERFIELD 200 // From here on own fields, not in the SVX
-
enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR };
enum SvxDateFormat { SVXDATEFORMAT_APPDEFAULT, // Set as in App
SVXDATEFORMAT_SYSTEM, // Set as in System
More information about the Libreoffice-commits
mailing list