summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-12-01 19:25:13 +0100
committerAndras Timar <andras.timar@collabora.com>2014-12-13 16:00:54 +0100
commit384e6ec15516bd9950839a23f19199d6cf4bf07c (patch)
tree0a1c55ffaad7c6c9936f3aae9ac11eaa7acda805 /editeng/source
parent3a44b5a47cd8be8278e6944e332e222942496948 (diff)
fdo#85496: editeng: avoid exporting duplicate attributes
Since commit 0d57434180db6c8eda8c5b9b704f8a1c18b371df multiple 0-length attributes will be exported by the ODF filter as duplicate attributes. (cherry picked from commit 7a242b463132d67a4a2d6e69319e0da367145cc0) (cherry picked from commit 846b56b6b99e334dfa44f1a24640aa3158509854) This backport takes a different approach from the master fix and simply detects duplicates in EditTextObjectImpl::GetAllSections() which should be safe enough for 4.2.8.2. Change-Id: Iff787c8d2a71bc3082192cc98e3d916badee65dd Reviewed-on: https://gerrit.libreoffice.org/13260 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/editeng/editobj.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 41fddb0b363f..7dfd06f7d42a 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -1000,7 +1000,20 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
for (; itCurAttr != aAttrs.end() && itCurAttr->mnParagraph == nPara && itCurAttr->mnEnd <= nEnd; ++itCurAttr)
{
editeng::Section& rSecAttr = *itCurAttr;
- rSecAttr.maAttributes.push_back(pItem);
+ bool bInsert(true);
+ for (size_t j = 0; j < rSecAttr.maAttributes.size(); ++j)
+ {
+ if (rSecAttr.maAttributes[j]->Which() == pItem->Which())
+ {
+ SAL_WARN("editeng", "GetAllSections(): duplicate attribute suppressed");
+ bInsert = false;
+ break;
+ }
+ }
+ if (bInsert)
+ {
+ rSecAttr.maAttributes.push_back(pItem);
+ }
}
}
}