summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2018-12-26 10:49:55 +0300
committerJustin Luth <justin_luth@sil.org>2018-12-29 05:11:22 +0100
commit43836a58ffe943e2fc65be638f9a7d343102cb07 (patch)
tree3f853f2ee2864d63ad86c6d8d23e20af668dff14 /xmloff
parent17875c59a7277a31d4b1953b23bead089e7a4988 (diff)
tdf#47471 odfexport: use stylename if autostyle missing.
My guess is the autoStylePool can be invalidated by some events (like clearing all attributes), and if nothing is done that re-creates the autostyle, then Find() returns an empty string. The normal case when all attributes are reset is that since there are no attributes, it doesn't bother looking for the AutoStyle, and just sticks with the given "parent" style. However, some attributes (like lists) aren't reset, and in those cases the autoPool didn't exist, and yet it still looked for something, returning an empty string when nothing was found. If there is a style, but autostyle returns nothing, then it should be safe to always use the given style. There are two more areas with similar coding that I will change in separate commits. (However, note that bug 90221 shows that an empty autostyle might not be exactly like the given style). Change-Id: I6a3d7b1608160f555004ca9cf1c93ec301177288 Reviewed-on: https://gerrit.libreoffice.org/65616 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/txtparae.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index c59198bb92b3..9a7776eec9e3 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -1941,8 +1941,9 @@ void XMLTextParagraphExport::exportParagraph(
}
}
- OUString sAutoStyle( sStyle );
- sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet, sStyle );
+ OUString sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet, sStyle );
+ if ( sAutoStyle.isEmpty() )
+ sAutoStyle = sStyle;
if( !sAutoStyle.isEmpty() )
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
GetExport().EncodeStyleName( sAutoStyle ) );