summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/access/accmap.cxx6
-rw-r--r--sw/source/core/access/accpara.cxx4
-rw-r--r--sw/source/core/docnode/ndsect.cxx8
-rw-r--r--sw/source/core/docnode/ndtbl.cxx8
-rw-r--r--sw/source/core/docnode/node.cxx8
-rw-r--r--sw/source/core/frmedt/feshview.cxx3
-rw-r--r--sw/source/core/frmedt/fews.cxx2
-rw-r--r--sw/source/core/inc/frame.hxx3
-rw-r--r--sw/source/core/layout/anchoreddrawobject.cxx2
-rw-r--r--sw/source/core/layout/calcmove.cxx2
-rw-r--r--sw/source/core/layout/findfrm.cxx10
-rw-r--r--sw/source/core/layout/flycnt.cxx2
-rw-r--r--sw/source/core/layout/frmtool.cxx14
-rw-r--r--sw/source/core/layout/sectfrm.cxx4
-rw-r--r--sw/source/core/objectpositioning/anchoredobjectposition.cxx2
-rw-r--r--sw/source/core/text/frmform.cxx4
16 files changed, 46 insertions, 36 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index a79863f65047..60ec8cf53996 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -3419,8 +3419,7 @@ void SwAccessibleMap::InvalidateTextSelectionOfAllParas()
static_cast<SwAccessibleContext*>( xAcc.get() ) );
if ( xAccImpl.is() && xAccImpl->GetFrame() )
{
- const SwTextFrame* pTextFrame(
- dynamic_cast<const SwTextFrame*>(xAccImpl->GetFrame()) );
+ const SwTextFrame* pTextFrame = xAccImpl->GetFrame()->DynCastTextFrame();
OSL_ENSURE( pTextFrame,
"<SwAccessibleMap::_SubmitTextSelectionChangedEvents()> - unexpected type of frame" );
if ( pTextFrame )
@@ -3448,8 +3447,7 @@ void SwAccessibleMap::InvalidateTextSelectionOfAllParas()
static_cast<SwAccessibleContext*>( xAcc.get() ) );
if ( xAccImpl.is() && xAccImpl->GetFrame() )
{
- const SwTextFrame* pTextFrame(
- dynamic_cast<const SwTextFrame*>(xAccImpl->GetFrame()) );
+ const SwTextFrame* pTextFrame = xAccImpl->GetFrame()->DynCastTextFrame();
OSL_ENSURE( pTextFrame,
"<SwAccessibleMap::_SubmitTextSelectionChangedEvents()> - unexpected type of frame" );
if ( pTextFrame )
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 7d6ec354244b..3c471c702f30 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -718,7 +718,7 @@ lang::Locale SAL_CALL SwAccessibleParagraph::getLocale()
{
SolarMutexGuard aGuard;
- const SwTextFrame *pTextFrame = dynamic_cast<const SwTextFrame*>( GetFrame() );
+ const SwTextFrame *pTextFrame = GetFrame()->DynCastTextFrame();
if( !pTextFrame )
{
throw uno::RuntimeException("no SwTextFrame", static_cast<cppu::OWeakObject*>(this));
@@ -738,7 +738,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleParagraph::getAccess
rtl::Reference<utl::AccessibleRelationSetHelper> pHelper = new utl::AccessibleRelationSetHelper();
- const SwTextFrame* pTextFrame = dynamic_cast<const SwTextFrame*>(GetFrame());
+ const SwTextFrame* pTextFrame = GetFrame()->DynCastTextFrame();
OSL_ENSURE( pTextFrame,
"<SwAccessibleParagraph::getAccessibleRelationSet()> - missing text frame");
if ( pTextFrame )
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 26647f2355cf..627475de7e89 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1122,8 +1122,8 @@ void SwSectionNode::MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx)
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(pNew->FindPrevCnt()) );
+ pNew->FindNextCnt( true )->DynCastTextFrame(),
+ pNew->FindPrevCnt()->DynCastTextFrame() );
}
}
pNew = pSct;
@@ -1148,8 +1148,8 @@ void SwSectionNode::MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx)
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(pNew->FindPrevCnt()) );
+ pNew->FindNextCnt( true )->DynCastTextFrame(),
+ pNew->FindPrevCnt()->DynCastTextFrame() );
}
}
if ( bInitNewSect )
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 6d833b9835fa..c39676570943 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2433,8 +2433,8 @@ void SwTableNode::MakeOwnFrames(SwNodeIndex* pIdxBehind)
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(pNew->FindPrevCnt()) );
+ pNew->FindNextCnt( true )->DynCastTextFrame(),
+ pNew->FindPrevCnt()->DynCastTextFrame() );
}
}
pNew->RegistFlys();
@@ -2468,8 +2468,8 @@ void SwTableNode::DelFrames(SwRootFrame const*const pLayout)
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pFrame->FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
+ pFrame->FindNextCnt( true )->DynCastTextFrame(),
+ pFrame->FindPrevCnt()->DynCastTextFrame() );
}
}
pFrame->Cut();
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 5cc3a5487004..67bf030fa8d8 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1393,8 +1393,8 @@ void SwContentNode::MakeFramesForAdjacentContentNode(SwContentNode& rNode)
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(pNew->FindPrevCnt()) );
+ pNew->FindNextCnt( true )->DynCastTextFrame(),
+ pNew->FindPrevCnt()->DynCastTextFrame() );
}
}
}
@@ -1486,8 +1486,8 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pFrame->FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
+ pFrame->FindNextCnt( true )->DynCastTextFrame(),
+ pFrame->FindPrevCnt()->DynCastTextFrame() );
}
}
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index d4e1f57d3ade..4939e856e888 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1450,8 +1450,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
{
if ( pContentFrame->UnionFrame().IsInside( rPt ) )
{
- const SwTextFrame* pTextFrame =
- dynamic_cast<const SwTextFrame*>(pContentFrame);
+ const SwTextFrame* pTextFrame = pContentFrame->DynCastTextFrame();
if ( pTextFrame )
{
SwPosition aPos(GetDoc()->GetNodes());
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 242cc123c431..ae04ee30efb7 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -982,7 +982,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
// <pFrame>, which is the anchor frame or the proposed anchor frame,
// doesn't have to be a text frame (e.g. edit a to-page anchored
// fly frame). Thus, assure this.
- const SwTextFrame* pTextFrame( dynamic_cast<const SwTextFrame*>(pFrame) );
+ const SwTextFrame* pTextFrame = pFrame->DynCastTextFrame();
if ( pTextFrame &&
(_nAnchorId == RndStdIds::FLY_AT_CHAR) &&
( _eVertRelOrient == text::RelOrientation::CHAR ||
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index a6504b25cdc0..3b1414002140 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -65,6 +65,7 @@ class SwSortedObjs;
class SwAnchoredObject;
enum class SvxFrameDirection;
class IDocumentDrawModelAccess;
+class SwTextFrame;
// Each FrameType is represented here as a bit.
// The bits must be set in a way that it can be determined with masking of
@@ -866,6 +867,8 @@ public:
inline bool IsCellFrame() const;
inline bool IsContentFrame() const;
inline bool IsTextFrame() const;
+ SwTextFrame* DynCastTextFrame();
+ const SwTextFrame* DynCastTextFrame() const;
inline bool IsNoTextFrame() const;
// Frames where its PrtArea depends on their neighbors and that are
// positioned in the content flow
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 4a7baf446cfd..9ee3bd01f098 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -571,7 +571,7 @@ void SwAnchoredDrawObject::InvalidateObjPos()
// anchored object, because its positioned by the format of its anchor frame.
// --> #i44559# - assure, that text hint is already
// existing in the text frame
- if ( dynamic_cast< const SwTextFrame* >(GetAnchorFrame()) != nullptr &&
+ if ( GetAnchorFrame()->DynCastTextFrame() != nullptr &&
(GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR) )
{
SwTextFrame* pAnchorTextFrame( static_cast<SwTextFrame*>(AnchorFrame()) );
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 39a183f9e38c..31a9e2f80045 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1304,7 +1304,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
HasFollow() && !GetFollow()->IsDeleteForbidden() &&
&GetFollow()->GetFrame() == GetNext() )
{
- dynamic_cast<SwTextFrame&>(*this).JoinFrame();
+ static_cast<SwTextFrame&>(*this).JoinFrame();
}
// #i28701# - move master forward, if it has to move,
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index f079b142297d..48088fdb2d1c 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1838,4 +1838,14 @@ const SwFrame* SwLayoutFrame::GetLastLower() const
return pRet;
}
+SwTextFrame* SwFrame::DynCastTextFrame()
+{
+ return IsTextFrame() ? static_cast<SwTextFrame*>(this) : nullptr;
+}
+
+const SwTextFrame* SwFrame::DynCastTextFrame() const
+{
+ return IsTextFrame() ? static_cast<const SwTextFrame*>(this) : nullptr;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 71b0d493879a..02c3d54bce4f 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -397,7 +397,7 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext)
if ( bFormatAnchor )
{
SwTextFrame& rAnchPosAnchorFrame =
- dynamic_cast<SwTextFrame&>(*GetAnchorFrameContainingAnchPos());
+ *GetAnchorFrameContainingAnchPos()->DynCastTextFrame();
// #i58182# - For the usage of new method
// <SwObjectFormatterTextFrame::CheckMovedFwdCondition(..)>
// to check move forward of anchor frame due to the object
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 1602604f01c8..77293c14d270 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1589,8 +1589,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
pFrame->FindPageFrame() != nullptr)
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pFrame->FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
+ pFrame->FindNextCnt( true )->DynCastTextFrame(),
+ pFrame->FindPrevCnt()->DynCastTextFrame() );
// #i68958#
// The information flags of the text frame are validated
// in methods <FindNextCnt(..)> and <FindPrevCnt(..)>.
@@ -1675,8 +1675,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
pFrame->FindPageFrame() != nullptr)
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pFrame->FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
+ pFrame->FindNextCnt( true )->DynCastTextFrame(),
+ pFrame->FindPrevCnt()->DynCastTextFrame() );
}
}
if ( bObjsDirect && !pTable->empty() )
@@ -1787,8 +1787,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
pFrame->FindPageFrame() != nullptr)
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pFrame->FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
+ pFrame->FindNextCnt( true )->DynCastTextFrame(),
+ pFrame->FindPrevCnt()->DynCastTextFrame() );
}
}
pFrame->CheckDirChange();
@@ -2195,7 +2195,7 @@ SwBorderAttrs::SwBorderAttrs(const sw::BorderCacheOwner* pOwner, const SwFrame*
, m_nLineSpacing(0)
{
// #i96772#
- const SwTextFrame* pTextFrame = dynamic_cast<const SwTextFrame*>(pConstructor);
+ const SwTextFrame* pTextFrame = pConstructor->DynCastTextFrame();
if ( pTextFrame )
{
pTextFrame->GetTextNodeForParaProps()->ClearLRSpaceItemDueToListLevelIndents( m_rLR );
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 2f3694e47145..c78007d8f3af 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -204,8 +204,8 @@ void SwSectionFrame::DelEmpty( bool bRemove )
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(FindNextCnt( true )),
- dynamic_cast<SwTextFrame*>(FindPrevCnt()) );
+ FindNextCnt( true )->DynCastTextFrame(),
+ FindPrevCnt()->DynCastTextFrame() );
}
}
Cut_( bRemove );
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index ee516c49eec5..c58d71d1f6f9 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -938,7 +938,7 @@ SwTwips SwAnchoredObjectPosition::AdjustHoriRelPosForDrawAside(
) const
{
// #i26791#
- if ( dynamic_cast<const SwTextFrame*>( &GetAnchorFrame() ) == nullptr ||
+ if ( GetAnchorFrame().DynCastTextFrame() == nullptr ||
dynamic_cast<const SwFlyAtContentFrame*>( &GetAnchoredObj() ) == nullptr )
{
OSL_FAIL( "<SwAnchoredObjectPosition::AdjustHoriRelPosForDrawAside(..) - usage for wrong anchor type" );
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index d0d9cc68fb54..b0ded2d75306 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -669,7 +669,7 @@ SwContentFrame *SwTextFrame::JoinFrame()
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pFoll->FindNextCnt( true )),
+ pFoll->FindNextCnt( true )->DynCastTextFrame(),
this );
}
}
@@ -703,7 +703,7 @@ void SwTextFrame::SplitFrame(TextFrameIndex const nTextPos)
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
pViewShell->InvalidateAccessibleParaFlowRelation(
- dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
+ pNew->FindNextCnt( true )->DynCastTextFrame(),
this );
}
}