diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-08 12:55:14 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-08 14:23:06 -0400 |
commit | aceff35230dab8d22a5fdd4cd9a7a982b9754fa2 (patch) | |
tree | 2c2b9ebe26b1e7bc423347aabfaec1ad6fb2d456 /editeng | |
parent | Remove the evil hack. (diff) | |
download | core-aceff35230dab8d22a5fdd4cd9a7a982b9754fa2.tar.gz core-aceff35230dab8d22a5fdd4cd9a7a982b9754fa2.zip |
A little more cleanup; translation of field IDs are no longer needed.
Change-Id: I85364368d2ffca717b38d17c3396f53699001a3f
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/flditem.hxx | 4 | ||||
-rw-r--r-- | editeng/inc/editeng/unofield.hxx | 1 | ||||
-rw-r--r-- | editeng/source/items/flditem.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unofield.cxx | 48 |
4 files changed, 11 insertions, 44 deletions
diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx index 46ddc3413cbc..03a2cacbe074 100644 --- a/editeng/inc/editeng/flditem.hxx +++ b/editeng/inc/editeng/flditem.hxx @@ -53,9 +53,11 @@ class MetaAction; class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase { public: + static const sal_Int32 UNKNOWN_FIELD; + static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent); - SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, -1 ) + SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, UNKNOWN_FIELD) SvxFieldData(); virtual ~SvxFieldData(); diff --git a/editeng/inc/editeng/unofield.hxx b/editeng/inc/editeng/unofield.hxx index 0be97f85742c..39cf2e6fae10 100644 --- a/editeng/inc/editeng/unofield.hxx +++ b/editeng/inc/editeng/unofield.hxx @@ -71,7 +71,6 @@ public: virtual ~SvxUnoTextField() throw(); // Internal - virtual sal_Int32 GetFieldId( const SvxFieldData* pFieldData ) const throw(); SvxFieldData* CreateFieldData() const throw(); void SetAnchor( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor ) { mxAnchor = xAnchor; } diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index 36ba686a9960..0290ad4f56dc 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -49,6 +49,8 @@ using namespace com::sun::star; #define FRAME_MARKER (sal_uInt32)0x21981357 #define CHARSET_MARKER (FRAME_MARKER+1) +const sal_Int32 SvxFieldData::UNKNOWN_FIELD = -1; + SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTextContent) { uno::Reference<beans::XPropertySet> xPropSet(xTextContent, uno::UNO_QUERY); diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index a74ffe9d24db..4f4bb6978231 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -61,8 +61,6 @@ 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; @@ -315,7 +313,7 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co : OComponentHelper( getMutex() ) , mxAnchor( xAnchor ) , mpPropSet(NULL) -, mnServiceId(UNKNOWN_FIELD) +, mnServiceId(SvxFieldData::UNKNOWN_FIELD) , mpImpl( new SvxUnoFieldData_Impl ) { DBG_ASSERT(pData, "pFieldData == NULL! [CL]" ); @@ -324,9 +322,9 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co if(pData) { - mnServiceId = GetFieldId(pData); - DBG_ASSERT(mnServiceId != UNKNOWN_FIELD, "unknown SvxFieldData! [CL]"); - if(mnServiceId != UNKNOWN_FIELD) + mnServiceId = pData->GetClassId(); + DBG_ASSERT(mnServiceId != SvxFieldData::UNKNOWN_FIELD, "unknown SvxFieldData! [CL]"); + if (mnServiceId != SvxFieldData::UNKNOWN_FIELD) { // extract field properties from data class switch( mnServiceId ) @@ -781,40 +779,6 @@ void SvxUnoTextField::disposing() // nothing to do } -sal_Int32 SvxUnoTextField::GetFieldId( const SvxFieldData* pFieldData ) const throw() -{ - if( pFieldData->ISA( SvxURLField ) ) - return text::textfield::Type::URL; - else if( pFieldData->ISA( SvxPageField ) ) - return text::textfield::Type::PAGE; - else if( pFieldData->ISA( SvxPagesField ) ) - return text::textfield::Type::PAGES; - else if( pFieldData->ISA( SvxTimeField ) ) - return text::textfield::Type::TIME; - else if( pFieldData->ISA( SvxFileField ) ) - return text::textfield::Type::FILE; - else if( pFieldData->ISA( SvxTableField ) ) - return text::textfield::Type::TABLE; - else if( pFieldData->ISA( SvxExtTimeField ) ) - return text::textfield::Type::EXTENDED_TIME; - else if( pFieldData->ISA( SvxExtFileField ) ) - return text::textfield::Type::EXTENDED_FILE; - else if( pFieldData->ISA( SvxAuthorField ) ) - return text::textfield::Type::AUTHOR; - else if( pFieldData->ISA( SvxDateField ) ) - return text::textfield::Type::EXTENDED_DATE; - else if( pFieldData->ISA( SdrMeasureField ) ) - return text::textfield::Type::MEASURE; - else if( pFieldData->ISA( SvxHeaderField ) ) - return text::textfield::Type::HEADER; - else if( pFieldData->ISA( SvxFooterField ) ) - return text::textfield::Type::FOOTER; - else if( pFieldData->ISA( SvxDateTimeField ) ) - return text::textfield::Type::DATE_TIME; - - return UNKNOWN_FIELD; -} - // lang::XServiceInfo OUString SAL_CALL SvxUnoTextField::getImplementationName() throw(uno::RuntimeException) { @@ -892,7 +856,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt { OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) ); - sal_Int32 nId = UNKNOWN_FIELD; + sal_Int32 nId = SvxFieldData::UNKNOWN_FIELD; if ( aFieldType == "DateTime" ) { @@ -934,7 +898,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt nId = text::textfield::Type::MEASURE; } - if (nId != UNKNOWN_FIELD) + if (nId != SvxFieldData::UNKNOWN_FIELD) xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId ); } |