summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-12-01 15:25:56 +0300
committerEike Rathke <erack@redhat.com>2017-12-11 23:29:26 +0100
commit3f614f431475e1bf3bb3bbeac59b0681309628b7 (patch)
tree104fc56d968dd51802b658d97775c02e06424524 /sc/inc
parent7d202623b007979d9d0f93f6cd62c3c031d6d1d4 (diff)
tdf#95295: don't add duplicate conditional formats
This tries to make sure that on copy, any conditional formatting that has same entries (conditions and formats) as another condition in the table, is not appended to the conditions list, but updates existing condition's range. This should prevent multiplication of entries with duplicating conditions and formats, and fragmenting ranges. Existing unit tests had to be adjusted, because they had ensured exactly that behaviour that is changed in this commit: that new items are added to the list, and e.g. multiple elements are created when a single cell is copied to a range. Change-Id: I46adb883bab7249571b912d56fea0c7918b3516d Reviewed-on: https://gerrit.libreoffice.org/45656 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/conditio.hxx11
1 files changed, 4 insertions, 7 deletions
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 93481f202236..327b8367dce9 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -244,6 +244,7 @@ public:
virtual void SetParent( ScConditionalFormat* pNew ) = 0;
bool operator==( const ScFormatEntry& ) const;
+ virtual bool IsEqual( const ScFormatEntry&, bool bIgnoreSrcPos ) const;
virtual void startRendering();
virtual void endRendering();
@@ -350,9 +351,7 @@ public:
ScConditionEntry( ScDocument* pDocument, const ScConditionEntry& r );
virtual ~ScConditionEntry() override;
- bool operator== ( const ScConditionEntry& r ) const;
-
- bool EqualIgnoringSrcPos( const ScConditionEntry& r ) const;
+ bool IsEqual( const ScFormatEntry& r, bool bIgnoreSrcPos ) const override;
virtual void SetParent( ScConditionalFormat* pNew ) override;
@@ -440,8 +439,6 @@ class SC_DLLPUBLIC ScCondFormatEntry : public ScConditionEntry
{
OUString aStyleName;
- using ScConditionEntry::operator==;
-
public:
ScCondFormatEntry( ScConditionMode eOper,
const OUString& rExpr1, const OUString& rExpr2,
@@ -459,7 +456,7 @@ public:
ScCondFormatEntry( ScDocument* pDocument, const ScCondFormatEntry& r );
virtual ~ScCondFormatEntry() override;
- bool operator== ( const ScCondFormatEntry& r ) const;
+ bool IsEqual( const ScFormatEntry& r, bool bIgnoreSrcPos ) const override;
const OUString& GetStyle() const { return aStyleName; }
void UpdateStyleName(const OUString& rNew) { aStyleName=rNew; }
@@ -572,7 +569,7 @@ public:
ScCondFormatData GetData( ScRefCellValue& rCell, const ScAddress& rPos ) const;
- bool EqualEntries( const ScConditionalFormat& r ) const;
+ bool EqualEntries( const ScConditionalFormat& r, bool bIgnoreSrcPos = false ) const;
void DoRepaint();