summaryrefslogtreecommitdiff
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:04:39 +0100
commit541800fa17c6a4f9552c76e5290b5011addb1264 (patch)
tree594a90e332a43f84ead5d296c214762aed4dd75f
parentfbcb2556be11225d14e62fb1849930f5953588dc (diff)
reportdesign: avoid assertion on duplicate properties ...
... from XMLAutoStylePoolProperties that happens when opening bugdoc from fdo#87044. Change-Id: I7002cf5176cd326f57b50fb6030ffb89160c237b
-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;
+ }
}
}
}