[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - editeng/source
Eike Rathke
erack at redhat.com
Thu Jul 27 12:44:00 UTC 2017
editeng/source/editeng/editobj.cxx | 22 +++++++++++++++++++++-
editeng/source/editeng/editobj2.hxx | 12 ++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
New commits:
commit 1a165d19761a89e1c5919cd2d03bbd448e6d84dc
Author: Eike Rathke <erack at redhat.com>
Date: Wed Jul 26 17:03:46 2017 +0200
Restore and fix and fix harder the EditTextObject::operator==()
... chaining down to EditTextObjectImpl::operator==() that compared unique_ptr
instead of content with ContentInfo::operator==() that needed to use
XEditAttribute::operator==() instead of comparing pointers. That resulted in
always false..
Wrong as a chain of
commit 5a7a4325eca58c253270d4e9d327042a9ee2c5f0
Date: Tue Nov 10 14:59:05 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
and
commit 4ff5a5558472beee85eb1234dcc2aa2ed9000f6c
Date: Tue Jan 19 15:17:30 2016 +0200
loplugin:unusedmethods
Plus XEditAttribute::operator==() was wrong since
commit 71158788efb32ffc3bac5154c38ca5d79525155c
Date: Thu May 4 08:11:41 2006 +0000
INTEGRATION: CWS impressc03u3 (1.8.40); FILE MERGED
2006/04/27 12:33:10 cl 1.8.40.1: #i64360# fixed operator==
that (to fix a crash comparing items of different types) changed
- ( (pItem == rCompare.pItem) || (*pItem == *rCompare.pItem));
+ ( (pItem == rCompare.pItem) ||
+ ( pItem->Which() != rCompare.pItem->Which()) ||
+ (*pItem == *rCompare.pItem));
so returning true if Which-IDs differed, instead of
+ ((pItem == rCompare.pItem) ||
+ ((pItem->Which() == rCompare.pItem->Which()) &&
+ (*pItem == *rCompare.pItem)));
Change-Id: I8300c04001e98cb71e520bbe2c180aec0c0a3333
Reviewed-on: https://gerrit.libreoffice.org/40455
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit 1279043814865cd48c3b577c5e21db0b93d5c24c)
Reviewed-on: https://gerrit.libreoffice.org/40463
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index ed1fdb06136e..b52ef3743218 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -225,6 +225,26 @@ void ContentInfo::Dump() const
}
#endif
+bool ContentInfo::operator==( const ContentInfo& rCompare ) const
+{
+ if( (maText == rCompare.maText) &&
+ (aStyle == rCompare.aStyle ) &&
+ (maCharAttribs.size() == rCompare.maCharAttribs.size()) &&
+ (eFamily == rCompare.eFamily ) &&
+ (aParaAttribs == rCompare.aParaAttribs ) )
+ {
+ for (size_t i = 0, n = maCharAttribs.size(); i < n; ++i)
+ {
+ if (!(*(maCharAttribs[i]) == *(rCompare.maCharAttribs[i])))
+ return false;
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
EditTextObject::EditTextObject( SfxItemPool* pPool ) :
mpImpl(new EditTextObjectImpl(this, pPool))
{
@@ -1608,7 +1628,7 @@ bool EditTextObjectImpl::operator==( const EditTextObjectImpl& rCompare ) const
for (size_t i = 0, n = aContents.size(); i < n; ++i)
{
- if (aContents[i] != rCompare.aContents[i])
+ if (!(*(aContents[i]) == *(rCompare.aContents[i])))
return false;
}
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 928f4ba12b84..460a891f7632 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -69,8 +69,19 @@ public:
bool IsFeature() const;
void SetItem(const SfxPoolItem& rNew);
+
+ inline bool operator==( const XEditAttribute& rCompare ) const;
};
+inline bool XEditAttribute::operator==( const XEditAttribute& rCompare ) const
+{
+ return (nStart == rCompare.nStart) &&
+ (nEnd == rCompare.nEnd) &&
+ ((pItem == rCompare.pItem) ||
+ ((pItem->Which() == rCompare.pItem->Which()) &&
+ (*pItem == *rCompare.pItem)));
+}
+
struct XParaPortion
{
long nHeight;
@@ -152,6 +163,7 @@ public:
const WrongList* GetWrongList() const;
void SetWrongList( WrongList* p );
+ bool operator==( const ContentInfo& rCompare ) const;
// #i102062#
bool isWrongListEqual(const ContentInfo& rCompare) const;
More information about the Libreoffice-commits
mailing list