summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-12-11 20:09:40 +0100
committerMichael Stahl <mstahl@redhat.com>2014-12-12 18:06:42 +0100
commita055781f00c7ae6479b3b09d254760734dda839c (patch)
tree545bffd3dcd294e22001db295f579da3f2ee4020 /reportdesign
parente6810aec53ec2042d726e7d77335b3b5c94eaa07 (diff)
reportdesign: avoid assertion on duplicate properties ...
... from XMLAutoStylePoolProperties that happens when opening bugdoc from fdo#87044. Change-Id: I7002cf5176cd326f57b50fb6030ffb89160c237b (cherry picked from commit 541800fa17c6a4f9552c76e5290b5011addb1264)
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/filter/xml/xmlExport.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index 749826721e95..28942bd3ea5a 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -1229,7 +1229,20 @@ void ORptExport::exportAutoStyle(XPropertySet* _xProp,const Reference<XFormatted
sal_Int32 nStyleMapIndex = m_xCellStylesExportPropertySetMapper->getPropertySetMapper()->FindEntryIndex( CTF_RPT_NUMBERFORMAT );
addDataStyle(nNumberFormat);
XMLPropertyState aNumberStyleState( nStyleMapIndex, uno::makeAny( getDataStyleName(nNumberFormat) ) );
- aPropertyStates.push_back( aNumberStyleState );
+ auto const iter(::std::find_if(
+ aPropertyStates.begin(), aPropertyStates.end(),
+ [nStyleMapIndex] (XMLPropertyState const& rItem)
+ { return rItem.mnIndex == nStyleMapIndex; } ));
+ if (iter == aPropertyStates.end())
+ {
+ aPropertyStates.push_back( aNumberStyleState );
+ }
+ else
+ { // there is already a property but it has the wrong type
+ // (integer not string); TODO: can we prevent it
+ // getting added earlier?
+ (*iter) = aNumberStyleState;
+ }
}
}
}