summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-07-23 12:01:47 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-07-23 12:37:06 +0200
commitbb67e709b70919efb41ec41e93dd92953dc6a003 (patch)
tree7903417918c75a44bf2b21a00b2c39b169cadd8f /writerfilter
parente667bcdf98513ed13d6ebb485f61cbf37c0b4aca (diff)
fdo#64637 RTF import: handle multiple RTF_COMPANY
Instead of unconditionally calling addProperty(), first check the existence with hasPropertyByName() and call setPropertyValue() instead, if necessary. Change-Id: Ie0a075bbfe6eaa1f66726c456105dcdef9001d30
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 249e51b34a19..840c2c263ee7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4045,11 +4045,16 @@ int RTFDocumentImpl::popState()
case DESTINATION_COMPANY:
{
OUString aName = aState.nDestinationState == DESTINATION_OPERATOR ? OUString("Operator") : OUString("Company");
+ uno::Any aValue = uno::makeAny(m_aStates.top().aDestinationText.makeStringAndClear());
if (m_xDocumentProperties.is())
{
uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties();
- xUserDefinedProperties->addProperty(aName, beans::PropertyAttribute::REMOVABLE,
- uno::makeAny(m_aStates.top().aDestinationText.makeStringAndClear()));
+ uno::Reference<beans::XPropertySet> xPropertySet(xUserDefinedProperties, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
+ if (xPropertySetInfo->hasPropertyByName(aName))
+ xPropertySet->setPropertyValue(aName, aValue);
+ else
+ xUserDefinedProperties->addProperty(aName, beans::PropertyAttribute::REMOVABLE, aValue);
}
}
break;