summaryrefslogtreecommitdiffstats
path: root/writerfilter
diff options
context:
space:
mode:
authorJan-Marek Glogowski <jan-marek.glogowski@extern.cib.de>2019-10-29 14:39:05 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2019-11-19 08:09:08 +0100
commit90424d0b6d316998ff3e2632add0f0c8da55e3a2 (patch)
treeda000dfdf70ed8effe384b5502ac77183f4df4b9 /writerfilter
parenttdf#128495 measure preferred size of print preview relative to UI font (diff)
downloadcore-90424d0b6d316998ff3e2632add0f0c8da55e3a2.tar.gz
core-90424d0b6d316998ff3e2632add0f0c8da55e3a2.zip
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> (cherry picked from commit 5e279f175289234b91f272bbbf48e70315fff5ac) Reviewed-on: https://gerrit.libreoffice.org/83039 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx23
1 files changed, 12 insertions, 11 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a24eadd95aa0..96352aab7b99 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5012,7 +5012,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)
@@ -5183,19 +5185,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 ));
}
}