diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-11-01 14:11:09 +0500 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-12-07 15:29:16 +0100 |
commit | 1b4b1e0659d7dff79d031ff5c8fbb34fad2c71a1 (patch) | |
tree | b227856b2d9ddf446a3513e7b9c294c6d9d84201 /xmloff | |
parent | 4d4bbb85c74869f4e9ea8a89bfc046fa2e8c081a (diff) |
tdf#163703: export formats for FIELD_ID_ANNOTATION
It was omitted from commit 842160190e2996efbd936191eed787f3f79ed7b7
(INTEGRATION: CWS notes2 (1.77.24); FILE MERGED, 2008-02-19), and
the field type was skipped from autostyle export phase. With commit
69ed893087f89d176a5ec4b263ce8d75774be72b (tdf#160253: fix list
identifier export decision code, 2024-04-24), this surfaced by not
exporting comments' formatting.
Change-Id: I84a8d5616c37af093404fefb4d1ed3a212000f8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175899
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175931
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtflde.cxx | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 80a98f3dc5c6..1c8d9fb56847 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -176,6 +176,18 @@ uno::Reference<text::XText> GetToplevelText(const uno::Reference<text::XText>& x } return xRet; } + +uno::Reference<css::text::XText> XTextFromTextRangeProp(const Reference<XPropertySet>& xPropSet) +{ + try + { + return xPropSet->getPropertyValue(u"TextRange"_ustr).query<css::text::XText>(); + } + catch (css::uno::Exception&) + { + return {}; + } +} } SvXMLEnumStringMapEntry<FieldIdEnum> const aFieldServiceNameMapping[] = @@ -368,7 +380,6 @@ constexpr OUString gsPropertyValue(u"Value"_ustr); constexpr OUString gsPropertyVariableName(u"VariableName"_ustr); constexpr OUString gsPropertyHelp(u"Help"_ustr); constexpr OUString gsPropertyTooltip(u"Tooltip"_ustr); -constexpr OUStringLiteral gsPropertyTextRange(u"TextRange"); XMLTextFieldExport::XMLTextFieldExport( SvXMLExport& rExp, std::unique_ptr<XMLPropertyState> pCombinedCharState) @@ -909,8 +920,12 @@ void XMLTextFieldExport::ExportFieldAutoStyle( break; } - case FIELD_ID_SCRIPT: case FIELD_ID_ANNOTATION: + if (auto xText = XTextFromTextRangeProp(xPropSet)) + GetExport().GetTextParagraphExport()->collectTextAutoStyles(xText, bProgress); + break; + + case FIELD_ID_SCRIPT: case FIELD_ID_BIBLIOGRAPHY: case FIELD_ID_DDE: case FIELD_ID_REF_REFERENCE: @@ -1837,16 +1852,7 @@ void XMLTextFieldExport::ExportFieldHelper( } } - css::uno::Reference < css::text::XText > xText; - try - { - css::uno::Any aRet = rPropSet->getPropertyValue(gsPropertyTextRange); - aRet >>= xText; - } - catch ( css::uno::Exception& ) - {} - - if ( xText.is() ) + if (auto xText = XTextFromTextRangeProp(rPropSet)) GetExport().GetTextParagraphExport()->exportText( xText ); else ProcessParagraphSequence(GetStringProperty(gsPropertyContent,rPropSet)); |