Added UNSPECIFIED to textfield::Type.

Change-Id: I28fbab54ba71f01b989a47ab357583113e85fccb
This commit is contained in:
Kohei Yoshida
2012-05-10 20:31:36 -04:00
parent 328be2536f
commit 17b900c657
5 changed files with 22 additions and 21 deletions

View File

@@ -57,7 +57,7 @@ public:
static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent); static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent);
SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, UNKNOWN_FIELD) SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, com::sun::star::text::textfield::Type::UNSPECIFIED)
SvxFieldData(); SvxFieldData();
virtual ~SvxFieldData(); virtual ~SvxFieldData();

View File

@@ -49,8 +49,6 @@ using namespace com::sun::star;
#define FRAME_MARKER (sal_uInt32)0x21981357 #define FRAME_MARKER (sal_uInt32)0x21981357
#define CHARSET_MARKER (FRAME_MARKER+1) #define CHARSET_MARKER (FRAME_MARKER+1)
const sal_Int32 SvxFieldData::UNKNOWN_FIELD = -1;
SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTextContent) SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTextContent)
{ {
uno::Reference<beans::XPropertySet> xPropSet(xTextContent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropSet(xTextContent, uno::UNO_QUERY);

View File

@@ -313,7 +313,7 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
: OComponentHelper( getMutex() ) : OComponentHelper( getMutex() )
, mxAnchor( xAnchor ) , mxAnchor( xAnchor )
, mpPropSet(NULL) , mpPropSet(NULL)
, mnServiceId(SvxFieldData::UNKNOWN_FIELD) , mnServiceId(text::textfield::Type::UNSPECIFIED)
, mpImpl( new SvxUnoFieldData_Impl ) , mpImpl( new SvxUnoFieldData_Impl )
{ {
DBG_ASSERT(pData, "pFieldData == NULL! [CL]" ); DBG_ASSERT(pData, "pFieldData == NULL! [CL]" );
@@ -323,8 +323,8 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
if(pData) if(pData)
{ {
mnServiceId = pData->GetClassId(); mnServiceId = pData->GetClassId();
DBG_ASSERT(mnServiceId != SvxFieldData::UNKNOWN_FIELD, "unknown SvxFieldData! [CL]"); DBG_ASSERT(mnServiceId != text::textfield::Type::UNSPECIFIED, "unknown SvxFieldData! [CL]");
if (mnServiceId != SvxFieldData::UNKNOWN_FIELD) if (mnServiceId != text::textfield::Type::UNSPECIFIED)
{ {
// extract field properties from data class // extract field properties from data class
switch( mnServiceId ) switch( mnServiceId )
@@ -911,7 +911,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
{ {
OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) ); OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
sal_Int32 nId = SvxFieldData::UNKNOWN_FIELD; sal_Int32 nId = text::textfield::Type::UNSPECIFIED;
if ( aFieldType == "DateTime" ) if ( aFieldType == "DateTime" )
{ {
@@ -953,7 +953,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
nId = text::textfield::Type::MEASURE; nId = text::textfield::Type::MEASURE;
} }
if (nId != SvxFieldData::UNKNOWN_FIELD) if (nId != text::textfield::Type::UNSPECIFIED)
xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId ); xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId );
} }

View File

@@ -43,6 +43,8 @@ module com { module sun { module star { module text { module textfield {
*/ */
constants Type constants Type
{ {
const long UNSPECIFIED = -1;
const long DATE = 0; const long DATE = 0;
const long URL = 1; const long URL = 1;
const long PAGE = 2; const long PAGE = 2;
@@ -54,10 +56,11 @@ constants Type
const long EXTENDED_FILE = 8; const long EXTENDED_FILE = 8;
const long AUTHOR = 9; const long AUTHOR = 9;
const long MEASURE = 10; const long MEASURE = 10;
const long EXTENDED_DATE = 11; const long HEADER = 11;
const long HEADER = 12; const long FOOTER = 12;
const long FOOTER = 13; const long DATE_TIME = 13;
const long DATE_TIME = 14;
const long EXTENDED_DATE = 14;
}; };
}; }; }; }; }; }; }; }; }; };

View File

@@ -206,7 +206,7 @@ ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource) :
ScEditEngineDefaulter( *pSource ), ScEditEngineDefaulter( *pSource ),
eMode( SC_UNO_COLLECT_NONE ), eMode( SC_UNO_COLLECT_NONE ),
nFieldCount( 0 ), nFieldCount( 0 ),
mnFieldType(SvxFieldData::UNKNOWN_FIELD), mnFieldType(text::textfield::Type::UNSPECIFIED),
pFound( NULL ) pFound( NULL )
{ {
if (pSource) if (pSource)
@@ -231,7 +231,7 @@ String ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
const SvxFieldData* pFieldData = rField.GetField(); const SvxFieldData* pFieldData = rField.GetField();
if ( pFieldData ) if ( pFieldData )
{ {
if (mnFieldType == SvxFieldData::UNKNOWN_FIELD || pFieldData->GetClassId() == mnFieldType) if (mnFieldType == text::textfield::Type::UNSPECIFIED || pFieldData->GetClassId() == mnFieldType)
{ {
if ( eMode == SC_UNO_COLLECT_FINDINDEX && !pFound && nFieldCount == nFieldIndex ) if ( eMode == SC_UNO_COLLECT_FINDINDEX && !pFound && nFieldCount == nFieldIndex )
{ {
@@ -255,7 +255,7 @@ String ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
sal_uInt16 ScUnoEditEngine::CountFields() sal_uInt16 ScUnoEditEngine::CountFields()
{ {
eMode = SC_UNO_COLLECT_COUNT; eMode = SC_UNO_COLLECT_COUNT;
mnFieldType = SvxFieldData::UNKNOWN_FIELD; mnFieldType = text::textfield::Type::UNSPECIFIED;
nFieldCount = 0; nFieldCount = 0;
UpdateFields(); UpdateFields();
eMode = SC_UNO_COLLECT_NONE; eMode = SC_UNO_COLLECT_NONE;
@@ -267,7 +267,7 @@ SvxFieldData* ScUnoEditEngine::FindByIndex(sal_uInt16 nIndex)
{ {
eMode = SC_UNO_COLLECT_FINDINDEX; eMode = SC_UNO_COLLECT_FINDINDEX;
nFieldIndex = nIndex; nFieldIndex = nIndex;
mnFieldType = SvxFieldData::UNKNOWN_FIELD; mnFieldType = text::textfield::Type::UNSPECIFIED;
nFieldCount = 0; nFieldCount = 0;
UpdateFields(); UpdateFields();
eMode = SC_UNO_COLLECT_NONE; eMode = SC_UNO_COLLECT_NONE;
@@ -283,7 +283,7 @@ SvxFieldData* ScUnoEditEngine::FindByPos(sal_uInt16 nPar, xub_StrLen nPos, sal_I
mnFieldType = nType; mnFieldType = nType;
nFieldCount = 0; nFieldCount = 0;
UpdateFields(); UpdateFields();
mnFieldType = SvxFieldData::UNKNOWN_FIELD; mnFieldType = text::textfield::Type::UNSPECIFIED;
eMode = SC_UNO_COLLECT_NONE; eMode = SC_UNO_COLLECT_NONE;
return pFound; return pFound;
@@ -718,7 +718,7 @@ void ScEditFieldObj::setPropertyValueURL(const rtl::OUString& rName, const com::
// Typ egal (in Zellen gibts nur URLs) // Typ egal (in Zellen gibts nur URLs)
SvxFieldData* pField = aTempEngine.FindByPos( SvxFieldData* pField = aTempEngine.FindByPos(
aSelection.nStartPara, aSelection.nStartPos, SvxFieldData::UNKNOWN_FIELD); aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
OSL_ENSURE(pField,"setPropertyValue: Feld nicht gefunden"); OSL_ENSURE(pField,"setPropertyValue: Feld nicht gefunden");
if (!pField) if (!pField)
return; return;
@@ -791,7 +791,7 @@ uno::Any ScEditFieldObj::getPropertyValueURL(const rtl::OUString& rName)
// Typ egal (in Zellen gibts nur URLs) // Typ egal (in Zellen gibts nur URLs)
const SvxFieldData* pField = aTempEngine.FindByPos( const SvxFieldData* pField = aTempEngine.FindByPos(
aSelection.nStartPara, aSelection.nStartPos, SvxFieldData::UNKNOWN_FIELD); aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
OSL_ENSURE(pField,"getPropertyValue: Feld nicht gefunden"); OSL_ENSURE(pField,"getPropertyValue: Feld nicht gefunden");
if (!pField) if (!pField)
throw uno::RuntimeException(); throw uno::RuntimeException();
@@ -1105,7 +1105,7 @@ void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno
// Typ egal (in Zellen gibts nur URLs) // Typ egal (in Zellen gibts nur URLs)
SvxFieldData* pField = aTempEngine.FindByPos( SvxFieldData* pField = aTempEngine.FindByPos(
aSelection.nStartPara, aSelection.nStartPos, SvxFieldData::UNKNOWN_FIELD); aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
OSL_ENSURE(pField,"setPropertyValue: Feld nicht gefunden"); OSL_ENSURE(pField,"setPropertyValue: Feld nicht gefunden");
if (!pField) if (!pField)
return; return;
@@ -1245,7 +1245,7 @@ rtl::OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand )
// Typ egal (in Zellen gibts nur URLs) // Typ egal (in Zellen gibts nur URLs)
const SvxFieldData* pField = aTempEngine.FindByPos( const SvxFieldData* pField = aTempEngine.FindByPos(
aSelection.nStartPara, aSelection.nStartPos, SvxFieldData::UNKNOWN_FIELD); aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
OSL_ENSURE(pField,"getPresentation: Feld nicht gefunden"); OSL_ENSURE(pField,"getPresentation: Feld nicht gefunden");
if (!pField) if (!pField)
return rtl::OUString(); return rtl::OUString();