diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-08-30 17:04:53 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-08-30 20:13:14 +0200 |
commit | 91b0024965908c692bea40f47c58ea9d1bf8a596 (patch) | |
tree | 842685f7c3de90c4ca418931df1fc528ffb1315b /sw/qa | |
parent | 8b3d5a79c0f70cb3bdfa4cbe8adf91521a28d89c (diff) |
tdf#103612 sw: fix confusing inheritance of section hidden flag
SwSectionData has 3 confusing boolean members for hiding:
* m_bHidden corresponds to the Hide checkbox in the UI
* m_bCondHiddenFlag stores the result of evaluating the hide condition
* m_bHiddenFlag is the final computed result that indicates that this
section is hidden
Now, the first 2 flags determine m_bHiddenFlag = true, but there's
another possibility: m_bHiddenFlag is also true if there is a parent
section for which m_bHiddenFlag is true (because of course this hides
all section content including nested sections)... the latter situation
is apparently handled in SwSectionFormat::UpdateParent().
The code in SwSection::SwSection() checks the parent's m_bHiddenFlag but
then sets the child's m_bHidden, which looks very wrong, so remove this.
Also adapt 2 other places that look like they should be checking a
different flag.
Change-Id: I58d9c878b58ad6cd878f450072178006b4c7ebb6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121314
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/data/DUMMY.odm | bin | 0 -> 8336 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/data/DUMMY1.odt | bin | 0 -> 8473 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 28 |
3 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/DUMMY.odm b/sw/qa/extras/uiwriter/data/DUMMY.odm Binary files differnew file mode 100644 index 000000000000..6c6713604119 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/DUMMY.odm diff --git a/sw/qa/extras/uiwriter/data/DUMMY1.odt b/sw/qa/extras/uiwriter/data/DUMMY1.odt Binary files differnew file mode 100644 index 000000000000..127b4a7c6ed6 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/DUMMY1.odt diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index c283f3022803..7ea98b947995 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -2690,6 +2690,34 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128106) tempDir.EnableKillingFile(); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf103612) +{ + SwDoc* const pGlobalDoc = createSwDoc(DATA_DIRECTORY, "DUMMY.odm"); + CPPUNIT_ASSERT_EQUAL( + size_t(1), + pGlobalDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks().size()); + pGlobalDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks(false, false, + nullptr); + + xmlDocUniquePtr pLayout = parseLayoutDump(); + + assertXPath(pLayout, "/root/page[1]/body/section[1]/txt[1]/LineBreak[1]", "Line", + "Text before section"); + // the inner section and its content was hidden + assertXPath(pLayout, "/root/page[1]/body/section[2]/txt[1]/LineBreak[1]", "Line", + "Text inside section before ToC"); + assertXPath(pLayout, "/root/page[1]/body/section[3]/txt[1]/LineBreak[1]", "Line", + "Table of Contents"); + assertXPath(pLayout, "/root/page[1]/body/section[4]/txt[1]/LineBreak[1]", "Line", + "First header*1"); + assertXPath(pLayout, "/root/page[1]/body/section[4]/txt[2]/LineBreak[1]", "Line", + "Second header*1"); + assertXPath(pLayout, "/root/page[1]/body/section[5]/txt[2]/LineBreak[1]", "Line", + "Text inside section after ToC"); + assertXPath(pLayout, "/root/page[1]/body/section[6]/txt[1]/LineBreak[1]", "Line", + "Text after section"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |