diff options
author | Jan-Marek Glogowski <jan-marek.glogowski@extern.cib.de> | 2019-10-29 14:39:05 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-11-11 11:38:30 +0100 |
commit | 5e279f175289234b91f272bbbf48e70315fff5ac (patch) | |
tree | 12c4e827aad62eea4f05003409b89799c09be90b /writerfilter | |
parent | 1d81d52b5da45f26e9d3adeb3b279eb9a488b94f (diff) |
tdf#128460 import SwInputField from DOCX FILLIN
Actually the whole FILLIN handling is not that correct, because
the value can actually be formatted in any way in Word, as it's
just defined as a range of runs with formating, while Writer just
applies the character formatitng to the whole field.
But this at least allows for a round trip of the exported Writer
type input field after commit 62aaaad156ef ("tdf#125103 Writer:
input fields will be exported to docx") changed this.
Change-Id: I6389b4a2ff9d2b62e1e4a00f1c1e112c199377b5
Regression-from: 62aaaad156ef0daccd2680161ef8b9b99d8a7bc0
Reviewed-on: https://gerrit.libreoffice.org/81686
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 19f3e67aee73..c787d7b39e19 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5272,7 +5272,9 @@ bool DomainMapper_Impl::IsFieldResultAsString() OSL_ENSURE( pContext.get(), "no field context available"); if( pContext.get() ) { - bRet = pContext->GetTextField().is() || pContext->GetFieldId() == FIELD_FORMDROPDOWN; + bRet = pContext->GetTextField().is() + || pContext->GetFieldId() == FIELD_FORMDROPDOWN + || pContext->GetFieldId() == FIELD_FILLIN; } if (!bRet) @@ -5443,19 +5445,18 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult) else { uno::Reference< beans::XPropertySet > xFieldProperties( xTextField, uno::UNO_QUERY_THROW); - // In case of SetExpression, the field result contains the content of the variable. uno::Reference<lang::XServiceInfo> xServiceInfo(xTextField, uno::UNO_QUERY); - bool bIsSetExpression = xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression"); - // If we already have content set, then use the current presentation - OUString sValue; - if (bIsSetExpression) - { // this will throw for field types without Content - uno::Any aValue(xFieldProperties->getPropertyValue( - getPropertyName(PROP_CONTENT))); - aValue >>= sValue; + OUString sContent; + bool bCanHaveContent = false; + try + { // this will throw for field types without Content property + uno::Any aValue(xFieldProperties->getPropertyValue(getPropertyName(PROP_CONTENT))); + bCanHaveContent = true; + aValue >>= sContent; } + catch (...) {} xFieldProperties->setPropertyValue( - getPropertyName(bIsSetExpression && sValue.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION), + getPropertyName(bCanHaveContent && sContent.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION), uno::makeAny( rResult )); } } |