summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-01-03 12:23:18 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-01-03 13:41:56 +0100
commit484867ec5e716a1828a41b2535f7a1e10e8f3fe7 (patch)
tree0b4569f503334804fda8a9d287021b591030ce60 /sw
parent9937e0b53c5cfd6e5bfa7187b637642ab7d78e58 (diff)
Move FindBodyFrame from SwTextFrame to SwFrame
So we can call it on other type of frames too. Change-Id: I74e80eb831ba1fc00abb8db1ffa3728758e68376 Reviewed-on: https://gerrit.libreoffice.org/65817 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/frame.hxx8
-rw-r--r--sw/source/core/inc/txtfrm.hxx2
-rw-r--r--sw/source/core/layout/findfrm.cxx13
-rw-r--r--sw/source/core/text/frmform.cxx12
4 files changed, 21 insertions, 14 deletions
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 920bd621fff4..0a9a1ea823c0 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -38,6 +38,7 @@
class SwLayoutFrame;
class SwRootFrame;
class SwPageFrame;
+class SwBodyFrame;
class SwFlyFrame;
class SwSectionFrame;
class SwFootnoteFrame;
@@ -661,6 +662,7 @@ public:
SwFootnoteFrame *ImplFindFootnoteFrame();
SwFlyFrame *ImplFindFlyFrame();
SwSectionFrame *ImplFindSctFrame();
+ const SwBodyFrame *ImplFindBodyFrame() const;
SwFrame *FindFooterOrHeader();
SwFrame *GetLower();
const SwFrame *GetNext() const { return mpNext; }
@@ -683,6 +685,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;
@@ -1085,6 +1088,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 44bbb5ec316e..a998a312745a 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -589,8 +589,6 @@ public:
/// Respect the Follows
inline bool IsInside(TextFrameIndex 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 a0c0eceebfac..2f6c2b495dc5 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -31,6 +31,7 @@
#include <fmtftn.hxx>
#include <fmtpdsc.hxx>
#include <txtfrm.hxx>
+#include <bodyfrm.hxx>
#include <calbck.hxx>
#include <viewopt.hxx>
#include <sal/log.hxx>
@@ -486,6 +487,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 157a338bda34..b9f1cde74d03 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -172,18 +172,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(TextFrameIndex const nTextOfst)
{
vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();