sw/source/core/access/accfrmobj.cxx | 15 +++++++++++---- sw/source/core/inc/frame.hxx | 18 +++++++++--------- sw/source/core/layout/wsfrm.cxx | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-)
New commits: commit 2576655cd1abdf33daaa8b739e9bb3da3a061dad Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 25 07:21:58 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 25 13:44:57 2025 +0200 sw: Use constexpr instead of #define for SwFrameType combinations ... and address loplugin:redundantfcast warning /home/michi/development/git/libreoffice/sw/source/core/layout/wsfrm.cxx:3380:39: error: redundant functional cast from 'const SwFrameType' to 'SwFrameType' [loplugin:redundantfcast] 3380 | : ~SwFrameType(FRM_NEIGHBOUR); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. Change-Id: Ie497b15a4e94ebd8aa59156446785ee00fba8a9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184600 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 24d7bb03a4d3..754083f9d27c 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -100,15 +100,15 @@ namespace o3tl }; // for internal use some common combinations -#define FRM_LAYOUT SwFrameType(0x3bFF) -#define FRM_ALL SwFrameType(0xfbff) -#define FRM_CNTNT (SwFrameType::Txt | SwFrameType::NoTxt) -#define FRM_FTNBOSS (SwFrameType::Page | SwFrameType::Column) -#define FRM_ACCESSIBLE (SwFrameType::Root | SwFrameType::Page | SwFrameType::Header | SwFrameType::Footer | SwFrameType::Footnote | SwFrameType::Fly | SwFrameType::Tab | SwFrameType::Cell | SwFrameType::Txt) -#define FRM_NEIGHBOUR (SwFrameType::Column | SwFrameType::Cell) -#define FRM_NOTE_VERT (SwFrameType::FootnoteContainer | SwFrameType::Footnote | SwFrameType::Section | SwFrameType::Tab | SwFrameType::Row | SwFrameType::Cell | SwFrameType::Txt) -#define FRM_HEADFOOT (SwFrameType::Header | SwFrameType::Footer) -#define FRM_BODYFTNC (SwFrameType::FootnoteContainer | SwFrameType::Body) +constexpr SwFrameType FRM_LAYOUT = SwFrameType(0x3bFF); +constexpr SwFrameType FRM_ALL = SwFrameType(0xfbff); +constexpr SwFrameType FRM_CNTNT = SwFrameType::Txt | SwFrameType::NoTxt; +constexpr SwFrameType FRM_FTNBOSS = SwFrameType::Page | SwFrameType::Column; +constexpr SwFrameType FRM_ACCESSIBLE = SwFrameType::Root | SwFrameType::Page | SwFrameType::Header | SwFrameType::Footer | SwFrameType::Footnote | SwFrameType::Fly | SwFrameType::Tab | SwFrameType::Cell | SwFrameType::Txt; +constexpr SwFrameType FRM_NEIGHBOUR = SwFrameType::Column | SwFrameType::Cell; +constexpr SwFrameType FRM_NOTE_VERT = SwFrameType::FootnoteContainer | SwFrameType::Footnote | SwFrameType::Section | SwFrameType::Tab | SwFrameType::Row | SwFrameType::Cell | SwFrameType::Txt; +constexpr SwFrameType FRM_HEADFOOT = SwFrameType::Header | SwFrameType::Footer; +constexpr SwFrameType FRM_BODYFTNC = SwFrameType::FootnoteContainer | SwFrameType::Body; // for GetNextLeaf/GetPrevLeaf. enum MakePageType diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index babb08e45203..09a078467d32 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -3377,7 +3377,7 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) // header frames and footer frames. // In horizontal layout these are all frames, which aren't neighbour frames. const SwFrameType nFixWidth = aRectFnSet.IsVert() ? (FRM_NEIGHBOUR | FRM_HEADFOOT) - : ~SwFrameType(FRM_NEIGHBOUR); + : ~FRM_NEIGHBOUR; // Declare const unsigned short <nFixHeight> and init it this frame types // which has fixed height in vertical respectively horizontal layout. commit 599a6d699291142b87b1ada7af70e346a7dd2146 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 25 07:06:32 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 25 13:44:50 2025 +0200 sw a11y: Split complex expression in SwAccessibleChild::IsFrameAccessible As suggested by Noel in [1], split the complex expression to make this easier to read. [1] https://gerrit.libreoffice.org/c/core/+/184579/comment/8f62b3a9_7e13e6cd Change-Id: Ie52144b695a0294327c0681ad1e5197fa43cc334 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184599 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx index 044d2451b450..ea75836bb747 100644 --- a/sw/source/core/access/accfrmobj.cxx +++ b/sw/source/core/access/accfrmobj.cxx @@ -121,10 +121,17 @@ void SwAccessibleChild::Init( vcl::Window* pWindow ) bool SwAccessibleChild::IsFrameAccessible(const SwFrame& rFrame, bool bPagePreview) { - return rFrame.IsAccessibleFrame() - && (!rFrame.IsCellFrame() - || static_cast<const SwCellFrame&>(rFrame).GetTabBox()->GetSttNd() != nullptr) - && !rFrame.IsInCoveredCell() && (bPagePreview || !rFrame.IsPageFrame()); + if (!rFrame.IsAccessibleFrame()) + return false; + + if (rFrame.IsCellFrame() + && static_cast<const SwCellFrame&>(rFrame).GetTabBox()->GetSttNd() == nullptr) + return false; + + if (rFrame.IsInCoveredCell()) + return false; + + return bPagePreview || !rFrame.IsPageFrame(); } bool SwAccessibleChild::IsAccessible( bool bPagePreview ) const