sw/source/core/inc/frame.hxx | 8 ++++++++ sw/source/core/inc/txtfrm.hxx | 2 -- sw/source/core/layout/findfrm.cxx | 13 +++++++++++++ sw/source/core/text/frmform.cxx | 12 ------------ 4 files changed, 21 insertions(+), 14 deletions(-)
New commits: commit 641f8a1370d6b57fc35778a833b601de7fb14954 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Thu Jan 3 12:23:18 2019 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Jan 7 09:30:27 2019 +0100 Move FindBodyFrame from SwTextFrame to SwFrame So we can call it on other type of frames too. Reviewed-on: https://gerrit.libreoffice.org/65817 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 484867ec5e716a1828a41b2535f7a1e10e8f3fe7) Change-Id: I74e80eb831ba1fc00abb8db1ffa3728758e68376 Reviewed-on: https://gerrit.libreoffice.org/65868 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 71363e95e2b1..5d84ca5198a4 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -35,6 +35,7 @@ class SwLayoutFrame; class SwRootFrame; class SwPageFrame; +class SwBodyFrame; class SwFlyFrame; class SwSectionFrame; class SwFootnoteFrame; @@ -644,6 +645,7 @@ public: SwFootnoteFrame *ImplFindFootnoteFrame(); SwFlyFrame *ImplFindFlyFrame(); SwSectionFrame *ImplFindSctFrame(); + const SwBodyFrame *ImplFindBodyFrame() const; SwFrame *FindFooterOrHeader(); SwFrame *GetLower(); const SwFrame *GetNext() const { return mpNext; } @@ -666,6 +668,7 @@ public: inline const SwFootnoteFrame *FindFootnoteFrame() const; inline const SwFlyFrame *FindFlyFrame() const; inline const SwSectionFrame *FindSctFrame() const; + inline const SwBodyFrame *FindBodyFrame() const; inline const SwFrame *FindNext() const; // #i27138# - add parameter <_bInSameFootnote> const SwContentFrame* FindNextCnt( const bool _bInSameFootnote = false ) const; @@ -1072,6 +1075,11 @@ inline SwSectionFrame *SwFrame::FindSctFrame() return IsInSct() ? ImplFindSctFrame() : nullptr; } +inline const SwBodyFrame *SwFrame::FindBodyFrame() const +{ + return IsInDocBody() ? ImplFindBodyFrame() : nullptr; +} + inline const SwTabFrame *SwFrame::FindTabFrame() const { return IsInTab() ? const_cast<SwFrame*>(this)->ImplFindTabFrame() : nullptr; diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index ec11d47ecc16..e6756f9f5163 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -463,8 +463,6 @@ public: /// Respect the Follows inline bool IsInside( const sal_Int32 nPos ) const; - const SwBodyFrame *FindBodyFrame() const; - /// DropCaps and selections bool GetDropRect( SwRect &rRect ) const { return HasPara() && GetDropRect_( rRect ); } diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index daccef43edcc..f7daa77e2aa0 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -30,6 +30,7 @@ #include <txtftn.hxx> #include <fmtftn.hxx> #include <txtfrm.hxx> +#include <bodyfrm.hxx> #include <calbck.hxx> #include <viewopt.hxx> @@ -471,6 +472,18 @@ SwSectionFrame* SwFrame::ImplFindSctFrame() return static_cast<SwSectionFrame*>(pRet); } +const SwBodyFrame* SwFrame::ImplFindBodyFrame() const +{ + const SwFrame *pRet = this; + while ( !pRet->IsBodyFrame() ) + { + pRet = pRet->GetUpper(); + if ( !pRet ) + return nullptr; + } + return static_cast<const SwBodyFrame*>(pRet); +} + SwFootnoteFrame *SwFrame::ImplFindFootnoteFrame() { SwFrame *pRet = this; diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index b3a4e2d31959..2e1cad0adbbe 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -171,18 +171,6 @@ bool SwTextFrame::GetDropRect_( SwRect &rRect ) const return false; } -const SwBodyFrame *SwTextFrame::FindBodyFrame() const -{ - if ( IsInDocBody() ) - { - const SwFrame *pFrame = GetUpper(); - while( pFrame && !pFrame->IsBodyFrame() ) - pFrame = pFrame->GetUpper(); - return static_cast<const SwBodyFrame*>(pFrame); - } - return nullptr; -} - bool SwTextFrame::CalcFollow( const sal_Int32 nTextOfst ) { vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits