[Libreoffice-commits] .: editeng/inc editeng/source svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 8 07:15:29 PST 2013
editeng/inc/editeng/editobj.hxx | 5 +--
editeng/source/editeng/editobj.cxx | 36 +++-------------------
editeng/source/editeng/editobj2.hxx | 3 -
svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx | 12 +++----
svx/source/svdraw/svdotext.cxx | 8 ++--
5 files changed, 20 insertions(+), 44 deletions(-)
New commits:
commit 7ec3861d69a8c18488706564b27dbc344e3b5cd1
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Jan 8 10:14:52 2013 -0500
Remove one variant of HasField() which takes arcane TypeId.
Change-Id: Ic8236b291ed5f318f67378bbc57b7cf027cbb92a
diff --git a/editeng/inc/editeng/editobj.hxx b/editeng/inc/editeng/editobj.hxx
index 8e97b63..12c089c 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 56effb9..cd1bc10 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 52821c0..ef35579 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);
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index b5aaeac..cc003de 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -117,12 +117,12 @@ namespace drawinglayer
{
const EditTextObject& rETO = maOutlinerParaObject.GetTextObject();
- mbContainsPageField = rETO.HasField(SvxPageField::StaticType());
- mbContainsPageCountField = rETO.HasField(SvxPagesField::StaticType());
- mbContainsOtherFields = rETO.HasField(SvxHeaderField::StaticType())
- || rETO.HasField(SvxFooterField::StaticType())
- || rETO.HasField(SvxDateTimeField::StaticType())
- || rETO.HasField(SvxAuthorField::StaticType());
+ mbContainsPageField = rETO.HasField(SvxPageField::StaticClassId());
+ mbContainsPageCountField = rETO.HasField(SvxPagesField::StaticClassId());
+ mbContainsOtherFields = rETO.HasField(SvxHeaderField::StaticClassId())
+ || rETO.HasField(SvxFooterField::StaticClassId())
+ || rETO.HasField(SvxDateTimeField::StaticClassId())
+ || rETO.HasField(SvxAuthorField::StaticClassId());
}
bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 7a662aa..72ab07f 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1167,16 +1167,16 @@ void SdrTextObj::ImpCheckMasterCachable()
if(!bNotVisibleAsMaster && pOutlinerParaObject && pOutlinerParaObject->IsEditDoc() )
{
const EditTextObject& rText= pOutlinerParaObject->GetTextObject();
- bNotMasterCachable=rText.HasField(SvxPageField::StaticType());
+ bNotMasterCachable=rText.HasField(SvxPageField::StaticClassId());
if( !bNotMasterCachable )
{
- bNotMasterCachable=rText.HasField(SvxHeaderField::StaticType());
+ bNotMasterCachable=rText.HasField(SvxHeaderField::StaticClassId());
if( !bNotMasterCachable )
{
- bNotMasterCachable=rText.HasField(SvxFooterField::StaticType());
+ bNotMasterCachable=rText.HasField(SvxFooterField::StaticClassId());
if( !bNotMasterCachable )
{
- bNotMasterCachable=rText.HasField(SvxDateTimeField::StaticType());
+ bNotMasterCachable=rText.HasField(SvxDateTimeField::StaticClassId());
}
}
}
More information about the Libreoffice-commits
mailing list