[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Jan 3 12:42:17 UTC 2019
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 484867ec5e716a1828a41b2535f7a1e10e8f3fe7
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Jan 3 12:23:18 2019 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Jan 3 13:41:56 2019 +0100
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 at collabora.com>
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();
More information about the Libreoffice-commits
mailing list