summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-11 11:19:31 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-12 10:16:11 +0200
commit08de15d3e5700b780266a1e0d7327d15412e48ce (patch)
tree2ea66a9676abf0c881c831d66a427f306817d7bb /sw
parent6317dbc5a80acdbf727e538e0da58bf130aea14f (diff)
SwTextFly::GetAnchoredObjList never returns null
Change-Id: Icd8a2aa356de24d977a72dc64825a03ed2f5b16d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157822 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/txtfly.hxx8
-rw-r--r--sw/source/core/text/frmform.cxx2
-rw-r--r--sw/source/core/text/itrform2.cxx2
-rw-r--r--sw/source/core/text/txtfly.cxx10
4 files changed, 11 insertions, 11 deletions
diff --git a/sw/source/core/inc/txtfly.hxx b/sw/source/core/inc/txtfly.hxx
index e363934a8ba1..9047e127e7d8 100644
--- a/sw/source/core/inc/txtfly.hxx
+++ b/sw/source/core/inc/txtfly.hxx
@@ -156,7 +156,7 @@ class SwTextFly
SwAnchoredObjList& InitAnchoredObjList();
public:
- SwAnchoredObjList* GetAnchoredObjList() const;
+ SwAnchoredObjList& GetAnchoredObjList() const;
private:
/**
@@ -311,11 +311,11 @@ public:
SwRect GetFrameArea() const;
};
-inline SwAnchoredObjList* SwTextFly::GetAnchoredObjList() const
+inline SwAnchoredObjList& SwTextFly::GetAnchoredObjList() const
{
return mpAnchoredObjList
- ? mpAnchoredObjList.get()
- : &const_cast<SwTextFly*>(this)->InitAnchoredObjList();
+ ? *mpAnchoredObjList
+ : const_cast<SwTextFly*>(this)->InitAnchoredObjList();
}
inline void SwTextFly::SetTopRule()
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 495820336fb3..1e20d7e0e9bc 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1867,7 +1867,7 @@ void SwTextFrame::FormatImpl(vcl::RenderContext* pRenderContext, SwParaPortion *
if (aInf.GetTextFly().IsOn())
{
SwRect const aRect(aInf.GetTextFly().GetFrameArea());
- for (SwAnchoredObject *const pObj : *aInf.GetTextFly().GetAnchoredObjList())
+ for (SwAnchoredObject *const pObj : aInf.GetTextFly().GetAnchoredObjList())
{
if (!aInf.GetTextFly().AnchoredObjToRect(pObj, aRect).IsEmpty())
{
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 6511d0ab45c9..7e4841fdb0c6 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -2815,7 +2815,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
// Word style: if there is minimal space remaining, then handle that similar to a full line
// and put the actual empty paragraph below the fly.
SwTwips nLimit = MINLAY;
- for (const auto& pObj : *rTextFly.GetAnchoredObjList())
+ for (const auto& pObj : rTextFly.GetAnchoredObjList())
{
auto pFlyFrame = pObj->DynCastFlyFrame();
if (!pFlyFrame)
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 43be775725e9..ff5566f537ac 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -493,7 +493,7 @@ void SwTextFly::DrawTextOpaque( SwDrawTextInfo &rInf )
OSL_ENSURE( !m_bTopRule, "DrawTextOpaque: Wrong TopRule" );
// #i68520#
- const SwAnchoredObjList::size_type nCount( m_bOn ? GetAnchoredObjList()->size() : 0 );
+ const SwAnchoredObjList::size_type nCount( m_bOn ? GetAnchoredObjList().size() : 0 );
if (nCount > 0)
{
const SdrLayerID nHellId = m_pPage->getRootFrame()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId();
@@ -578,7 +578,7 @@ void SwTextFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect )
SwRegionRects aRegion( rRect );
OSL_ENSURE( !m_bTopRule, "DrawFlyRect: Wrong TopRule" );
// #i68520#
- const SwAnchoredObjList::size_type nCount( m_bOn ? GetAnchoredObjList()->size() : 0 );
+ const SwAnchoredObjList::size_type nCount( m_bOn ? GetAnchoredObjList().size() : 0 );
if (nCount > 0)
{
const SdrLayerID nHellId = m_pPage->getRootFrame()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId();
@@ -1024,7 +1024,7 @@ SwTwips SwTextFly::GetMaxBottom(const SwBreakPortion& rPortion, const SwTextForm
// Note that m_pCurrFrame is already swapped at this stage, so it's correct to bypass
// SwRectFnSet here.
SwTwips nRet = 0;
- size_t nCount(m_bOn ? GetAnchoredObjList()->size() : 0);
+ size_t nCount(m_bOn ? GetAnchoredObjList().size() : 0);
// Get the horizontal position of the break portion in absolute twips. The frame area is in
// absolute twips, the frame's print area is relative to the frame area. Finally the portion's
@@ -1101,7 +1101,7 @@ bool SwTextFly::ForEach( const SwRect &rRect, SwRect* pRect, bool bAvoid ) const
bool bRet = false;
// #i68520#
- const SwAnchoredObjList::size_type nCount( m_bOn ? GetAnchoredObjList()->size() : 0 );
+ const SwAnchoredObjList::size_type nCount( m_bOn ? GetAnchoredObjList().size() : 0 );
if (nCount > 0)
{
for( SwAnchoredObjList::size_type i = 0; i < nCount; ++i )
@@ -1180,7 +1180,7 @@ bool SwTextFly::ForEach( const SwRect &rRect, SwRect* pRect, bool bAvoid ) const
// #i68520#
SwAnchoredObjList::size_type SwTextFly::GetPos( const SwAnchoredObject* pAnchoredObj ) const
{
- SwAnchoredObjList::size_type nCount = GetAnchoredObjList()->size();
+ SwAnchoredObjList::size_type nCount = GetAnchoredObjList().size();
SwAnchoredObjList::size_type nRet = 0;
while ( nRet < nCount && pAnchoredObj != (*mpAnchoredObjList)[ nRet ] )
++nRet;