online.git: 2 commits - engine/sw

0 views
Skip to first unread message

"Mike Kaganski (via cogerrit)"

unread,
4:30 AM (13 hours ago) 4:30 AM
to collaboraon...@googlegroups.com
engine/sw/source/core/inc/layfrm.hxx | 10 ++++++----
engine/sw/source/core/layout/tabfrm.cxx | 3 +--
2 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit c797bcd322b3f8d4582424a6afb53286574a1a17
Author: Mike Kaganski <mike.k...@collabora.com>
AuthorDate: Mon Jan 26 07:01:28 2026 +0100
Commit: Noel Grandin <noel.g...@collabora.com>
CommitDate: Mon May 25 08:30:02 2026 +0000

Move variable into its scope

Any variable in too broad scope may cause headaches; but for methods
like SwTabFrame::MakeAll (more than a thousand lines), it easily hits
with "the variable hides earlier one" errors.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198117
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.k...@collabora.com>
Signed-off-by: Mike Kaganski <mike.k...@collabora.com>
Change-Id: I398db8fda34fed786fb69849e1a159015a819c54
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1522
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.g...@collabora.com>

diff --git a/engine/sw/source/core/layout/tabfrm.cxx b/engine/sw/source/core/layout/tabfrm.cxx
index 5981331aae1b..bbd98b551995 100644
--- a/engine/sw/source/core/layout/tabfrm.cxx
+++ b/engine/sw/source/core/layout/tabfrm.cxx
@@ -2927,8 +2927,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
// 3. The table is allowed to split or we do not have a pIndPrev:
SwFrame* pIndPrev = GetIndPrev();

- SwFlyFrame* pFly = FindFlyFrame();
- if (!pIndPrev && pFly && pFly->IsFlySplitAllowed())
+ if (SwFlyFrame* pFly = FindFlyFrame(); !pIndPrev && pFly && pFly->IsFlySplitAllowed())
{
if (SwFrame* pAnchor = pFly->FindAnchorCharFrame())
{
commit e6dc6b131731dc0fc4caa988b49501b8f617f76d
Author: Mike Kaganski <mike.k...@collabora.com>
AuthorDate: Sun Jan 25 13:01:42 2026 +0100
Commit: Noel Grandin <noel.g...@collabora.com>
CommitDate: Mon May 25 08:29:36 2026 +0000

Use std::as_const instead of static_cast

Makes the intent more explicit.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198062
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.k...@collabora.com>
Signed-off-by: Mike Kaganski <mike.k...@collabora.com>
Change-Id: Ia9b03b899ba084db20145c7f2c720e1bdd2b639d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1521
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.g...@collabora.com>

diff --git a/engine/sw/source/core/inc/layfrm.hxx b/engine/sw/source/core/inc/layfrm.hxx
index 1bd54be314b1..c4d04d28b0a7 100644
--- a/engine/sw/source/core/inc/layfrm.hxx
+++ b/engine/sw/source/core/inc/layfrm.hxx
@@ -22,6 +22,8 @@
#include "frame.hxx"
#include <swdllapi.h>

+#include <utility>
+
class SwAnchoredObject;
class SwContentFrame;
class SwFormatCol;
@@ -189,17 +191,17 @@ public:
*/
inline SwContentFrame* SwLayoutFrame::ContainsContent()
{
- return const_cast<SwContentFrame*>(static_cast<const SwLayoutFrame*>(this)->ContainsContent());
+ return const_cast<SwContentFrame*>(std::as_const(*this).ContainsContent());
}

inline SwCellFrame* SwLayoutFrame::FirstCell()
{
- return const_cast<SwCellFrame*>(static_cast<const SwLayoutFrame*>(this)->FirstCell());
+ return const_cast<SwCellFrame*>(std::as_const(*this).FirstCell());
}

inline SwFrame* SwLayoutFrame::ContainsAny( const bool _bInvestigateFootnoteForSections )
{
- return const_cast<SwFrame*>(static_cast<const SwLayoutFrame*>(this)->ContainsAny( _bInvestigateFootnoteForSections ));
+ return const_cast<SwFrame*>(std::as_const(*this).ContainsAny(_bInvestigateFootnoteForSections));
}

/**
@@ -217,7 +219,7 @@ inline bool SwFrame::IsPageBodyFrame() const

inline SwFrame* SwLayoutFrame::GetLastLower()
{
- return const_cast<SwFrame*>(static_cast<const SwLayoutFrame*>(this)->GetLastLower());
+ return const_cast<SwFrame*>(std::as_const(*this).GetLastLower());
}

#endif // INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX

Reply all
Reply to author
Forward
0 new messages