summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-07-27 16:58:59 +0200
committerEike Rathke <erack@redhat.com>2017-07-27 17:48:59 +0200
commit238de04de6c8b67f74c75514b86c08bf888feb48 (patch)
tree520fba3d64eca15c97ec04fd1d3a510348bd629d /svl
parent221dae68df80298e81e6e6549636f3528f5c8bc3 (diff)
Ditch use of EditTextObject::Store() in ScGlobal::EETextObjEqual()
This was the last incarnation of SfxItem binary stream serialization that is to be eliminated after clipboard use is gone. The "full" EditTextObject::operator==() in EditTextObjectImpl::operator==(), and via ContentInfo::operator==() in SfxItemSet::operator==(), also compare the SfxItemPool pointers which gets in the way here (not stored to stream hence didn't matter and maybe the reason for not having switched EETextObjEqual() to use operator==() back in the days). Introduce *::Equals() functions that do not compare pool pointers and let SfxItemSet::Equals() in that case not assume it would be operating on one pool only. Change-Id: Ifff939a92101c7f74695b676a45a7fdbb4f1d7f6 Reviewed-on: https://gerrit.libreoffice.org/40492 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/itemset.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index d59872fa3799..72ae16c836bb 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1446,12 +1446,20 @@ void SfxItemSet::Load
bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
{
+ return Equals( rCmp, true);
+}
+
+bool SfxItemSet::Equals(const SfxItemSet &rCmp, bool bComparePool) const
+{
// Values we can get quickly need to be the same
+ const bool bDifferentPools = (m_pPool != rCmp.m_pPool);
if ( m_pParent != rCmp.m_pParent ||
- m_pPool != rCmp.m_pPool ||
+ (bComparePool && bDifferentPools) ||
Count() != rCmp.Count() )
return false;
+ // If we reach here and bDifferentPools==true that means bComparePool==false.
+
// Counting Ranges takes longer; they also need to be the same, however
sal_uInt16 nCount1 = TotalCount();
sal_uInt16 nCount2 = rCmp.TotalCount();
@@ -1499,7 +1507,7 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
if ( *ppItem1 != *ppItem2 &&
( ( !*ppItem1 || !*ppItem2 ) ||
( IsInvalidItem(*ppItem1) || IsInvalidItem(*ppItem2) ) ||
- (m_pPool->IsItemPoolable(**ppItem1)) ||
+ (!bDifferentPools && m_pPool->IsItemPoolable(**ppItem1)) ||
**ppItem1 != **ppItem2 ) )
return false;