summaryrefslogtreecommitdiff
path: root/xmloff/source/text/txtparai.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/text/txtparai.cxx')
-rw-r--r--xmloff/source/text/txtparai.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 9656ba081902..c777fa0c2929 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1851,8 +1851,11 @@ void XMLParaContext::endFastElement(sal_Int32 )
if (m_xHints)
{
- bool bEmptyHints = false;
- if (auto xCompare = xTxtImport->GetText().query<text::XTextRangeCompare>())
+ bool bSetNoFormatAttr = false;
+ uno::Reference<beans::XPropertySet> xCursorProps(xAttrCursor, uno::UNO_QUERY);
+ int nEmptyHints = 0;
+ uno::Reference<text::XTextRangeCompare> xCompare(xTxtImport->GetText(), uno::UNO_QUERY);
+ if (xCompare.is())
{
try
{
@@ -1860,7 +1863,7 @@ void XMLParaContext::endFastElement(sal_Int32 )
{
if (xCompare->compareRegionStarts(pHint->GetStart(), pHint->GetEnd()) == 0)
{
- bEmptyHints = true;
+ ++nEmptyHints;
}
}
}
@@ -1869,9 +1872,7 @@ void XMLParaContext::endFastElement(sal_Int32 )
TOOLS_WARN_EXCEPTION("xmloff.text", "");
}
}
- bool bSetNoFormatAttr = false;
- uno::Reference<beans::XPropertySet> xCursorProps(xAttrCursor, uno::UNO_QUERY);
- if (bEmptyHints || m_aMarkerStyleName.hasValue())
+ if (nEmptyHints > 0 || m_aMarkerStyleName.hasValue())
{
// We have at least one empty hint, then make try to ask the cursor to not upgrade our character
// attributes to paragraph-level formatting, which would lead to incorrect rendering.