summaryrefslogtreecommitdiff
path: root/sw/source/core/text/txtfrm.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-02-09 11:56:19 +0600
committerMichael Stahl <michael.stahl@allotropia.de>2024-03-04 11:04:22 +0100
commitf19d133bf4f07e46eb9ae40865cfc9be46af35af (patch)
treeac8a8ab1cedd6df48a5114f8a314ed289b3c8531 /sw/source/core/text/txtfrm.cxx
parent56a9bb5513fec89282b84c0cb1cbd501b8e4e5fb (diff)
tdf#159565 prerequisite: make hidden sections have zero-height frames
As mentioned in commit bb733957dd39e6f0b9d80bb59eb0177188794797 (tdf#114973 sw: enable SelectAll with hidden para at start/end, 2023-01-27), the hidden sections didn't have frames. That prevented correct handling of the case when such a frame was in the beginning of the document. This change re-implements the hidden section to use 0-height frames, like hidden paragraphs, as a pre-requisite for a follow-up change. Some layout breakages noticed while working on this are unit-tested now. This change needed to handle the case when the first section is hidden, and then goes a page break with page style. In this case, the page style must apply to the very first page of the document. Implementing this now, when the frame that defines the page style is not the first in the document, I accidentally fixed also the previously broken case when the first paragraph was hidden. Now the page style defined in the second paragraph's page break will apply correctly. This change makes hidden sections break outer section's frames. This means that when text borders are shown, there will be an artifact in the place of the hidden sections (a horizontal line breaking outer frame). I suppose it's not a problem, actually helping to see the layout better, so in line with the "show text borders" helper functionality. If this proves to be problematic, this can be handled specially in a follow-up. [backport: move invalidations from SwSectionFrame::SwClientNotify() to SwSectionFrame::Modify()] Change-Id: I14ebf0559b463186aba28902cd10c5cc978ba456 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163151 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163477 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit ff7f1b59e22092d8548459e75fe912db852f056f)
Diffstat (limited to 'sw/source/core/text/txtfrm.cxx')
-rw-r--r--sw/source/core/text/txtfrm.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 82546e533954..676210c0c800 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1373,6 +1373,9 @@ bool SwTextFrame::IsHiddenNow() const
return true;
}
+ if (SwContentFrame::IsHiddenNow())
+ return true;
+
bool bHiddenCharsHidePara(false);
bool bHiddenParaField(false);
if (m_pMergedPara)
@@ -1442,23 +1445,15 @@ bool SwTextFrame::IsHiddenNow() const
// be visible - check this for the 1st body paragraph
if (IsInDocBody() && FindPrevCnt() == nullptr)
{
- bool isAllHidden(true);
for (SwContentFrame const* pNext = FindNextCnt(true);
pNext != nullptr; pNext = pNext->FindNextCnt(true))
{
- if (!pNext->IsTextFrame()
- || !static_cast<SwTextFrame const*>(pNext)->IsHiddenNow())
- {
- isAllHidden = false;
- break;
+ if (!pNext->IsHiddenNow())
+ return true;
}
- }
- if (isAllHidden)
- {
SAL_INFO("sw.core", "unhiding one body paragraph");
return false;
}
- }
return true;
}
}