diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2023-03-14 15:34:16 +0100 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2023-03-15 11:00:03 +0000 |
commit | 5c04c4474236cc50009aea6d89f7c443c861af19 (patch) | |
tree | 2043566451184b7fda96fa44a262674028936819 | |
parent | 08c283d63fa648f3db1ab6dddf9edb73f0c7194e (diff) |
tdf#40142 - Consider level settings of the various text nodes
Consider level settings of the various text nodes when creating a TOC
from custom styles.
Change-Id: I70759f9bcf63e8591ce89bc71afabb1da0c2f29c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148886
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf151462.odt | bin | 17719 -> 18264 bytes | |||
-rwxr-xr-x | sw/qa/extras/uiwriter/data/tdf40142.odt | bin | 0 -> 9910 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter8.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 2 |
4 files changed, 16 insertions, 2 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf151462.odt b/sw/qa/extras/uiwriter/data/tdf151462.odt Binary files differindex cdd250232e18..648cb7619582 100644 --- a/sw/qa/extras/uiwriter/data/tdf151462.odt +++ b/sw/qa/extras/uiwriter/data/tdf151462.odt diff --git a/sw/qa/extras/uiwriter/data/tdf40142.odt b/sw/qa/extras/uiwriter/data/tdf40142.odt Binary files differnew file mode 100755 index 000000000000..7f87c867ee29 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf40142.odt diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 498a9f9e7408..45d76fd76771 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -2484,13 +2484,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf97899) CPPUNIT_ASSERT(!sCharStyleName.isEmpty()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf40142) +{ + createSwDoc("tdf40142.odt"); + dispatchCommand(mxComponent, ".uno:UpdateAllIndexes", {}); + + xmlDocUniquePtr pLayout = parseLayoutDump(); + // Without the fix in place, this test would have failed with + // - Expected: 2 + // - Actual : 4 + assertXPath(pLayout, "/root/page[1]/body/section[2]/txt", 2); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf151462) { createSwDoc("tdf151462.odt"); dispatchCommand(mxComponent, ".uno:UpdateAllIndexes", {}); xmlDocUniquePtr pLayout = parseLayoutDump(); - // tdf#151462 - without the fix in place, there would be just the first index entry + // Without the fix in place, there would be just the first index entry assertXPath(pLayout, "/root/page[1]/body/txt[2]/anchored/fly/section/txt[1]/SwParaPortion/" "SwLineLayout[1]/SwLinePortion[1]", @@ -2504,7 +2516,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf151462) "SwLineLayout[1]/SwLinePortion[1]", "portion", "sub three"); - // tdf#151462 - without the fix in place, there would be just the first index entry + // Without the fix in place, there would be just the first index entry assertXPath(pLayout, "/root/page[1]/body/txt[6]/anchored/fly/section/txt[1]/SwParaPortion/" "SwLineLayout[1]/SwLinePortion[1]", diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 5f54e5313f70..0a80b25d2f6b 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1373,6 +1373,8 @@ void SwTOXBaseSection::UpdateTemplate(const SwTextNode* pOwnChapterNode, if (pTextNd->GetText().getLength() && pTextNd->getLayoutFrame(pLayout) && pTextNd->GetNodes().IsDocNodes() && + // tdf#40142 - consider level settings of the various text nodes + o3tl::make_unsigned(pTextNd->GetAttrOutlineLevel()) <= GetLevel() && (!pLayout || !pLayout->HasMergedParas() || static_cast<SwTextFrame*>(pTextNd->getLayoutFrame(pLayout))->GetTextNodeForParaProps() == pTextNd) && (!IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pTextNd))) |