diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-01-08 10:14:52 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-01-08 10:16:35 -0500 |
commit | 7ec3861d69a8c18488706564b27dbc344e3b5cd1 (patch) | |
tree | 47fc717e9a5320a02ef037d563def291a85835f0 /editeng | |
parent | 59555e5b38d62b92397d7f3eac5097211ed261c4 (diff) |
Remove one variant of HasField() which takes arcane TypeId.
Change-Id: Ic8236b291ed5f318f67378bbc57b7cf027cbb92a
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/editobj.hxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/editobj.cxx | 36 | ||||
-rw-r--r-- | editeng/source/editeng/editobj2.hxx | 3 |
3 files changed, 10 insertions, 34 deletions
diff --git a/editeng/inc/editeng/editobj.hxx b/editeng/inc/editeng/editobj.hxx index 8e97b637d838..12c089c884f8 100644 --- a/editeng/inc/editeng/editobj.hxx +++ b/editeng/inc/editeng/editobj.hxx @@ -28,6 +28,8 @@ #include <editeng/editdata.hxx> #include "editeng/editengdllapi.h" +#include <com/sun/star/text/textfield/Type.hpp> + #include <vector> DBG_NAMEEX( EE_EditTextObject ) @@ -101,8 +103,7 @@ public: virtual sal_Bool IsFieldObject() const; virtual const SvxFieldItem* GetField() const; - virtual sal_Bool HasField( TypeId aType = NULL ) const; - virtual bool HasField( sal_Int32 nType ) const = 0; + virtual bool HasField( sal_Int32 nType = com::sun::star::text::textfield::Type::UNSPECIFIED ) const = 0; virtual SfxItemSet GetParaAttribs(size_t nPara) const; virtual void SetParaAttribs(size_t nPara, const SfxItemSet& rAttribs); diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 56effb9686d7..cd1bc1089fa6 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -44,6 +44,8 @@ #include <unotools/fontcvt.hxx> #include <tools/tenccvt.hxx> +using namespace com::sun::star; + DBG_NAME( EE_EditTextObject ) DBG_NAME( XEditAttribute ) @@ -267,12 +269,6 @@ const SvxFieldItem* EditTextObject::GetField() const return 0; } -sal_Bool EditTextObject::HasField( TypeId /*aType*/ ) const -{ - OSL_FAIL( "Virtual method direct from EditTextObject!" ); - return false; -} - SfxItemSet EditTextObject::GetParaAttribs(size_t /*nPara*/) const { OSL_FAIL( "Virtual method direct from EditTextObject!" ); @@ -854,30 +850,6 @@ const SvxFieldItem* BinTextObject::GetField() const return 0; } -sal_Bool BinTextObject::HasField( TypeId aType ) const -{ - size_t nParagraphs = aContents.size(); - for (size_t nPara = 0; nPara < nParagraphs; ++nPara) - { - const ContentInfo& rC = aContents[nPara]; - size_t nAttrs = rC.aAttribs.size(); - for (size_t nAttr = 0; nAttr < nAttrs; ++nAttr) - { - const XEditAttribute& rAttr = rC.aAttribs[nAttr]; - if (rAttr.GetItem()->Which() == EE_FEATURE_FIELD) - { - if ( !aType ) - return true; - - const SvxFieldData* pFldData = static_cast<const SvxFieldItem*>(rAttr.GetItem())->GetField(); - if ( pFldData && pFldData->IsA( aType ) ) - return true; - } - } - } - return false; -} - bool BinTextObject::HasField( sal_Int32 nType ) const { size_t nParagraphs = aContents.size(); @@ -891,6 +863,10 @@ bool BinTextObject::HasField( sal_Int32 nType ) const if (rAttr.GetItem()->Which() != EE_FEATURE_FIELD) continue; + if (nType == text::textfield::Type::UNSPECIFIED) + // Match any field type. + return true; + const SvxFieldData* pFldData = static_cast<const SvxFieldItem*>(rAttr.GetItem())->GetField(); if (pFldData && pFldData->GetClassId() == nType) return true; diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 52821c0ef822..ef355794361b 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -232,8 +232,7 @@ public: virtual sal_Bool IsFieldObject() const; virtual const SvxFieldItem* GetField() const; - virtual sal_Bool HasField( TypeId Type = NULL ) const; - virtual bool HasField( sal_Int32 nType ) const; + virtual bool HasField( sal_Int32 nType = com::sun::star::text::textfield::Type::UNSPECIFIED ) const; virtual SfxItemSet GetParaAttribs(size_t nPara) const; virtual void SetParaAttribs(size_t nPara, const SfxItemSet& rAttribs); |