summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/wrtw8nds.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-12-16 10:31:03 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-12-16 11:32:33 +0000
commit99ed51bcad4008a4006dcec24aa33fd7f757a433 (patch)
tree110339e1127b55bb81fabaa2b25608e9ad4381ee /sw/source/filter/ww8/wrtw8nds.cxx
parent56ab74cdf90880dbf756c6ee32135a02a98a6ec7 (diff)
sw, numbering portion format: ignore char formats covering the entire paragraph
The bugdoc has a single paragraph, where the numbering portion is bold in Writer but not in Word. The reason for this appears to be that Writer considers text node hints for the formatting of the numbering portion where the hint covers the entire paragraph, but Word doesn't do this. This behavior was added in commits cb0e1b52d68aa6d5b505f91cb4ce577f7f3b2a8f (sw, numbering portion format: consider full-para char formats as well, 2022-10-20) and DOCX export was also adjusted in commit f546f7573158e52359bbeae6194a83a1ff8ac52c (DOCX export, numbering portion format: consider full-para char formats as well, 2022-10-28). Fix the problem by partially reverting the above two commits and instead only consider hints that both start and end at the paragraph end. The revert of the first commit fixes the new bugdoc (its numbering portion is no longer bold) and the old bugdoc keeps working if the sw UNO API's text portion enumeration is extended to expose such empty autoformats at paragraph end. Related testcases: - CppunitTest_sw_ooxmlexport13's testTdf123460 explicitly tested that we don't expose the paragraph marker's formatting on the UNO API. - CppunitTest_sw_core_text's testNumberPortionFormat now uses the new ODT markup for these explicit paragraph marker char props (empty text span at para end). - CppunitTest_sw_uiwriter2's testTdfChangeNumberingListAutoFormat failed when only the above first commit (layout) was reverted, so revert the matching DOCX export commit as well, which is also good for consistency. - CppunitTest_sw_ooxmlexport18's testNumberPortionFormatFromODT also used the old ODT markup, updated. Change-Id: Iee8acf72dabcd10b3f4d3d68b83ed248bf50c324 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144292 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/filter/ww8/wrtw8nds.cxx')
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx15
1 files changed, 2 insertions, 13 deletions
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 2e94e5986cc7..8b2f09d88023 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -3173,7 +3173,6 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
}
else if (const SwpHints* pTextAttrs = rNode.GetpSwpHints())
{
- bool bFoundAtEnd = false;
for( size_t i = 0; i < pTextAttrs->Count(); ++i )
{
const SwTextAttr* pHt = pTextAttrs->Get(i);
@@ -3182,23 +3181,13 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
// Check if these attributes are for the last character in the paragraph
// - which means the paragraph marker. If a paragraph has 7 characters,
// then properties on character 8 are for the paragraph marker
- if (!endPos)
- {
- continue;
- }
- bool bAtEnd = (startPos == *endPos ) && (*endPos == rNode.GetText().getLength());
- if (bAtEnd)
- {
- bFoundAtEnd = true;
- }
- bool bWholePara = startPos == 0 && *endPos == rNode.GetText().getLength();
- if (bAtEnd || (!bFoundAtEnd && bWholePara))
+ if( endPos && (startPos == *endPos ) && (*endPos == rNode.GetText().getLength()) )
{
SAL_INFO( "sw.ww8", startPos << "startPos == endPos" << *endPos);
sal_uInt16 nWhich = pHt->GetAttr().Which();
SAL_INFO( "sw.ww8", "nWhich" << nWhich);
if ((nWhich == RES_TXTATR_AUTOFMT && bCharFormatOnly)
- || (nWhich == RES_TXTATR_CHARFMT && !bWholePara))
+ || nWhich == RES_TXTATR_CHARFMT)
{
aParagraphMarkerProperties.Put(pHt->GetAttr());
}