summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-11-02 19:39:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-11-02 20:30:29 +0100
commit4d863fd8e38748607636d0033262baa62a3e9eb2 (patch)
treede15f5cd695199cfd56f1893bbb31cf06fc044d1
parent1a4151dcdf45a0fa946b6ddf5e1b5cca37d24619 (diff)
tdf#54857 elide more dynamic_cast
Change-Id: I42bef355eeef15e3733a5ee57b0569887cfa5e84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142183 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx2
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx2
-rw-r--r--filter/source/msfilter/msdffimp.cxx2
-rw-r--r--filter/source/msfilter/svdfppt.cxx4
-rw-r--r--include/svx/svdobj.hxx4
-rw-r--r--include/svx/svdotext.hxx2
-rw-r--r--oox/source/export/drawingml.cxx6
-rw-r--r--oox/source/export/vmlexport.cxx2
-rw-r--r--sc/source/filter/excel/xiescher.cxx2
-rw-r--r--sc/source/filter/xcl97/xcl97esc.cxx2
-rw-r--r--sc/source/ui/drawfunc/drawsh4.cxx2
-rw-r--r--sc/source/ui/drawfunc/drtxtob2.cxx2
-rw-r--r--sc/source/ui/drawfunc/fuconrec.cxx2
-rw-r--r--sc/source/ui/drawfunc/fuconstr.cxx2
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx2
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx2
-rw-r--r--sc/source/ui/drawfunc/futext.cxx6
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx2
-rw-r--r--sd/qa/unit/SdrPdfImportTest.cxx2
-rw-r--r--sd/qa/unit/ShapeImportExportTest.cxx22
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx28
-rw-r--r--sd/qa/unit/export-tests-ooxml3.cxx2
-rw-r--r--sd/qa/unit/export-tests.cxx10
-rw-r--r--sd/qa/unit/import-tests.cxx22
-rw-r--r--sd/qa/unit/import-tests2.cxx20
-rw-r--r--sd/qa/unit/misc-tests.cxx4
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx2
-rw-r--r--sd/source/core/EffectMigration.cxx2
-rw-r--r--sd/source/core/drawdoc.cxx2
-rw-r--r--sd/source/core/drawdoc4.cxx6
-rw-r--r--sd/source/core/sdpage.cxx10
-rw-r--r--sd/source/filter/ppt/pptin.cxx2
-rw-r--r--sd/source/filter/ppt/pptinanimations.cxx2
-rw-r--r--sd/source/filter/xml/sdtransform.cxx2
-rw-r--r--sd/source/ui/app/sdxfer.cxx2
-rw-r--r--sd/source/ui/func/fudraw.cxx2
-rw-r--r--sd/source/ui/func/fupoor.cxx6
-rw-r--r--sd/source/ui/func/futext.cxx18
-rw-r--r--sd/source/ui/func/futhes.cxx2
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx2
-rw-r--r--sd/source/ui/table/tablefunction.cxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx2
-rw-r--r--sd/source/ui/unoidl/unoobj.cxx4
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx6
-rw-r--r--sd/source/ui/view/Outliner.cxx4
-rw-r--r--sd/source/ui/view/OutlinerIterator.cxx10
-rw-r--r--sd/source/ui/view/drawview.cxx2
-rw-r--r--sd/source/ui/view/drviews4.cxx2
-rw-r--r--sd/source/ui/view/drviews6.cxx2
-rw-r--r--sd/source/ui/view/drviews7.cxx2
-rw-r--r--sd/source/ui/view/drviewsf.cxx2
-rw-r--r--sd/source/ui/view/outlnvsh.cxx2
-rw-r--r--sd/source/ui/view/sdview.cxx8
-rw-r--r--svx/source/accessibility/AccessibleShape.cxx2
-rw-r--r--svx/source/engine3d/view3d.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobj.cxx2
-rw-r--r--svx/source/sidebar/SelectionAnalyzer.cxx4
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx2
-rw-r--r--svx/source/svdraw/svddrgv.cxx2
-rw-r--r--svx/source/svdraw/svdedtv.cxx4
-rw-r--r--svx/source/svdraw/svdedtv1.cxx4
-rw-r--r--svx/source/svdraw/svdedtv2.cxx2
-rw-r--r--svx/source/svdraw/svdedxv.cxx4
-rw-r--r--svx/source/svdraw/svdetc.cxx2
-rw-r--r--svx/source/svdraw/svdfmtf.cxx4
-rw-r--r--svx/source/svdraw/svdmark.cxx4
-rw-r--r--svx/source/svdraw/svdmrkv.cxx6
-rw-r--r--svx/source/svdraw/svdobj.cxx11
-rw-r--r--svx/source/svdraw/svdotext.cxx4
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx2
-rw-r--r--svx/source/svdraw/svdpdf.cxx4
-rw-r--r--svx/source/svdraw/svdundo.cxx6
-rw-r--r--svx/source/svdraw/svdview.cxx6
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx2
-rw-r--r--svx/source/unodraw/unoshape.cxx12
-rw-r--r--svx/source/unodraw/unoshtxt.cxx22
-rw-r--r--sw/qa/extras/layout/layout.cxx2
-rw-r--r--sw/source/core/doc/DocumentDrawModelManager.cxx2
-rw-r--r--sw/source/core/doc/textboxhelper.cxx2
-rw-r--r--sw/source/core/draw/dcontact.cxx5
-rw-r--r--sw/source/core/frmedt/feshview.cxx2
-rw-r--r--sw/source/filter/indexing/IndexingExport.cxx2
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx6
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
-rw-r--r--sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx2
-rw-r--r--sw/source/uibase/ribbar/conrect.cxx2
-rw-r--r--sw/source/uibase/shells/drawsh.cxx2
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx2
-rw-r--r--sw/source/uibase/uiview/viewdraw.cxx4
91 files changed, 217 insertions, 203 deletions
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index 91295002cf03..018419b0eacf 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -957,7 +957,7 @@ void ChartController::execute_DoubleClick( const Point* pMousePixel )
{
// #i12587# support for shapes in chart
SdrObject* pObj = DrawViewWrapper::getSdrObject( m_aSelection.getSelectedAdditionalShape() );
- if ( dynamic_cast< const SdrTextObj* >(pObj) != nullptr )
+ if ( DynCastSdrTextObj(pObj) != nullptr )
{
bEditText = true;
}
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 9d896b75425e..18dfda1de4a4 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -473,7 +473,7 @@ rtl::Reference<SdrObject> DrawCommandDispatch::createDefaultObject( const sal_uI
case COMMAND_ID_DRAW_TEXT:
case COMMAND_ID_DRAW_TEXT_VERTICAL:
{
- if ( SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pObj.get()) )
+ if ( SdrTextObj* pTextObj = DynCastSdrTextObj( pObj.get()) )
{
pTextObj->SetLogicRect( aRect );
bool bVertical = ( nID == COMMAND_ID_DRAW_TEXT_VERTICAL );
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 3705429218bd..aa6093a408a1 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3666,7 +3666,7 @@ void SvxMSDffManager::ReadObjText( SvStream& rStream, SdrObject* pObj )
// our outliner is too complicate to be used properly,
void SvxMSDffManager::ReadObjText( const OUString& rText, SdrObject* pObj )
{
- SdrTextObj* pText = dynamic_cast<SdrTextObj*>( pObj );
+ SdrTextObj* pText = DynCastSdrTextObj( pObj );
if ( !pText )
return;
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 460d0c1a1a73..3020083756a0 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -1147,7 +1147,7 @@ rtl::Reference<SdrObject> SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData
*/
if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr && !bFitShapeToText && !bWordWrap )
{
- SdrTextObj* pText = dynamic_cast<SdrTextObj*>( pTObj.get() );
+ SdrTextObj* pText = DynCastSdrTextObj( pTObj.get() );
if ( pText )
{
if ( bVerticalText )
@@ -2226,7 +2226,7 @@ SdrOutliner* SdrPowerPointImport::GetDrawOutliner( SdrTextObj const * pSdrText )
SdrObject* SdrPowerPointImport::ReadObjText( PPTTextObj* pTextObj, SdrObject* pSdrObj, SdPageCapsule pPage ) const
{
- SdrTextObj* pText = dynamic_cast<SdrTextObj*>( pSdrObj );
+ SdrTextObj* pText = DynCastSdrTextObj( pSdrObj );
if ( pText )
{
if ( !ApplyTextObj( pTextObj, pText, pPage, nullptr, nullptr ) )
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index d2b1ae4579be..a251d8ddac33 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -55,6 +55,7 @@ class SdrObjList;
class SdrObject;
class SdrPage;
class SdrPageView;
+class SdrTextObj;
class SdrView;
class SfxItemSet;
class SfxGrabBagItem;
@@ -760,6 +761,7 @@ public:
bool IsVisible() const { return mbVisible;}
void SetMarkProtect(bool bProt);
bool IsMarkProtect() const { return m_bMarkProt;}
+ virtual bool IsSdrTextObj() const { return false; }
/// Whether the aspect ratio should be kept by default when resizing.
virtual bool shouldKeepAspectRatio() const { return false; }
@@ -1002,6 +1004,8 @@ SVXCORE_DLLPUBLIC E3dScene* DynCastE3dScene(SdrObject*);
inline const E3dScene* DynCastE3dScene(const SdrObject* p) { return DynCastE3dScene(const_cast<SdrObject*>(p)); }
SVXCORE_DLLPUBLIC E3dObject* DynCastE3dObject(SdrObject*);
inline const E3dObject* DynCastE3dObject(const SdrObject* p) { return DynCastE3dObject(const_cast<SdrObject*>(p)); }
+SVXCORE_DLLPUBLIC SdrTextObj* DynCastSdrTextObj(SdrObject*);
+inline const SdrTextObj* DynCastSdrTextObj(const SdrObject* p) { return DynCastSdrTextObj(const_cast<SdrObject*>(p)); }
struct SdrObjCreatorParams
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 6041a74fe0aa..a2574765ade7 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -625,6 +625,8 @@ public:
*/
static bool HasTextImpl( SdrOutliner const * pOutliner );
+ virtual bool IsSdrTextObj() const final { return true; }
+
friend class ::SdrTextObjTest;
};
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e8d5bef246c4..8939a5415683 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3117,7 +3117,7 @@ bool DrawingML::WriteParagraphProperties(const Reference<XTextContent>& rParagra
SvxShapeText* pTextShape = dynamic_cast<SvxShapeText*>(rXShapePropSet.get());
if (pTextShape)
{
- SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pTextShape->GetSdrObject());
+ SdrTextObj* pTextObject = DynCastSdrTextObj(pTextShape->GetSdrObject());
if (pTextObject)
{
const auto nFontScaleY = pTextObject->GetFontScaleY();
@@ -3796,7 +3796,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
SvxShapeText* pTextShape = dynamic_cast<SvxShapeText*>(rXIface.get());
if (pTextShape)
{
- SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pTextShape->GetSdrObject());
+ SdrTextObj* pTextObject = DynCastSdrTextObj(pTextShape->GetSdrObject());
if (pTextObject)
nFontScale = pTextObject->GetFontScaleY() * 1000;
}
@@ -3828,7 +3828,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
return;
SdrObject* pSdrObject = xShape.is() ? SdrObject::getSdrObjectFromXShape(xShape) : nullptr;
- const SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>( pSdrObject );
+ const SdrTextObj* pTxtObj = DynCastSdrTextObj( pSdrObject );
if (pTxtObj && mpTextExport)
{
std::optional<OutlinerParaObject> pParaObj;
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index bda301201ad2..4fa1e6cf7764 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1389,7 +1389,7 @@ sal_Int32 VMLExport::StartShape()
OString const textboxStyle(m_TextboxStyle.makeStringAndClear());
// now check if we have some editeng text (not associated textbox) and we have a text exporter registered
- const SdrTextObj* pTxtObj = dynamic_cast<const SdrTextObj*>( m_pSdrObject );
+ const SdrTextObj* pTxtObj = DynCastSdrTextObj( m_pSdrObject );
if (pTxtObj && m_pTextExport && msfilter::util::HasTextBoxContent(m_nShapeType) && !IsWaterMarkShape(m_pSdrObject->GetName()) && !lcl_isTextBox(m_pSdrObject))
{
std::optional<OutlinerParaObject> pParaObj;
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 4d60bd5b3f5d..7940758bffc5 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -1498,7 +1498,7 @@ rtl::Reference<SdrObject> XclImpTextObj::DoCreateSdrObj( XclImpDffConverter& rDf
void XclImpTextObj::DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const
{
// set text data
- if( SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( &rSdrObj ) )
+ if( SdrTextObj* pTextObj = DynCastSdrTextObj( &rSdrObj ) )
{
if( maTextData.mxString )
{
diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx
index cb87fb7c3731..03336e90b577 100644
--- a/sc/source/filter/xcl97/xcl97esc.cxx
+++ b/sc/source/filter/xcl97/xcl97esc.cxx
@@ -275,7 +275,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
pAnchor->SetFlags( *pObj );
pCurrAppData->SetClientAnchor( pAnchor );
}
- const SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pObj );
+ const SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
if( pTextObj && !lcl_IsFontwork( pTextObj ) && (pObj->GetObjIdentifier() != SdrObjKind::Caption) )
{
const OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
diff --git a/sc/source/ui/drawfunc/drawsh4.cxx b/sc/source/ui/drawfunc/drawsh4.cxx
index fdb0efe91615..226407b2ee1b 100644
--- a/sc/source/ui/drawfunc/drawsh4.cxx
+++ b/sc/source/ui/drawfunc/drawsh4.cxx
@@ -33,7 +33,7 @@ void ScDrawShell::GetFormTextState(SfxItemSet& rSet)
if ( rMarkList.GetMarkCount() == 1 )
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
+ const SdrTextObj* pTextObj = DynCastSdrTextObj(pObj);
const bool bDeactivate(
!pObj ||
!pTextObj ||
diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx
index a5b4a7394cdd..2c8ed5ac89cb 100644
--- a/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -197,7 +197,7 @@ void ScDrawTextObjectBar::GetFormTextState(SfxItemSet& rSet)
if ( rMarkList.GetMarkCount() == 1 )
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
+ const SdrTextObj* pTextObj = DynCastSdrTextObj(pObj);
const bool bDeactivate(
!pObj ||
!pTextObj ||
diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx
index 6c2d548094bb..d73915ca450e 100644
--- a/sc/source/ui/drawfunc/fuconrec.cxx
+++ b/sc/source/ui/drawfunc/fuconrec.cxx
@@ -137,7 +137,7 @@ bool FuConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
// create OutlinerParaObject now so it can be set to vertical
- if ( auto pSdrTextObj = dynamic_cast<SdrTextObj*>( pObj) )
+ if ( auto pSdrTextObj = DynCastSdrTextObj( pObj) )
pSdrTextObj->ForceOutlinerParaObject();
OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
if( pOPO && !pOPO->IsEffectivelyVertical() )
diff --git a/sc/source/ui/drawfunc/fuconstr.cxx b/sc/source/ui/drawfunc/fuconstr.cxx
index 1064a30e1093..0ffb6e832d3f 100644
--- a/sc/source/ui/drawfunc/fuconstr.cxx
+++ b/sc/source/ui/drawfunc/fuconstr.cxx
@@ -146,7 +146,7 @@ bool FuConstruct::MouseButtonUp(const MouseEvent& rMEvt)
SdrObject* pObj = pMark->GetMarkedSdrObj();
// if Uno-Controls no text mode
- if ( dynamic_cast<const SdrTextObj*>( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr )
+ if ( DynCastSdrTextObj( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr )
{
OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
bool bVertical = ( pOPO && pOPO->IsEffectivelyVertical() );
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index ee9090765e2c..ea5f14a820d4 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -157,7 +157,7 @@ bool FuDraw::MouseButtonUp(const MouseEvent& rMEvt)
static bool lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell& rViewShell, const KeyEvent* pInitialKey )
{
bool bReturn = false;
- if ( dynamic_cast<const SdrTextObj*>( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr )
+ if ( DynCastSdrTextObj( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr )
{
// start text edit - like FuSelection::MouseButtonUp,
// but with bCursorToEnd instead of mouse position
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 46b7fc47d040..2b051bb3bf11 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -490,7 +490,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
// not in UNO controls
// #i32352# not in media objects
- else if ( dynamic_cast<const SdrTextObj*>( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr && dynamic_cast<const SdrMediaObj*>( pObj) == nullptr )
+ else if ( DynCastSdrTextObj( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr && dynamic_cast<const SdrMediaObj*>( pObj) == nullptr )
{
OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
bool bVertical = ( pOPO && pOPO->IsEffectivelyVertical() );
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 7f0ec1281484..9bd670d3fa9d 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -416,7 +416,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
if(rMarkList.GetMark(0))
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- if(auto pText = dynamic_cast<SdrTextObj*>( pObj))
+ if(auto pText = DynCastSdrTextObj( pObj))
{
SfxItemSet aSet(pDrDoc->GetItemPool());
@@ -557,7 +557,7 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel,
if (!(nSdrObjKind == SdrObjKind::Text ||
nSdrObjKind == SdrObjKind::TitleText ||
nSdrObjKind == SdrObjKind::OutlineText ||
- dynamic_cast<const SdrTextObj*>( pObj) != nullptr))
+ DynCastSdrTextObj( pObj) != nullptr))
return;
SdrPageView* pPV = pView->GetSdrPageView();
@@ -634,7 +634,7 @@ rtl::Reference<SdrObject> FuText::CreateDefaultObject(const sal_uInt16 nID, cons
if(pObj)
{
- if(auto pText = dynamic_cast<SdrTextObj*>( pObj.get() ))
+ if(auto pText = DynCastSdrTextObj( pObj.get() ))
{
pText->SetLogicRect(rRectangle);
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index df601ea0d35c..1c13beea9388 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -122,7 +122,7 @@ void FuText::StopEditMode()
/* If the entire text has been cleared, the cell note and its caption
object have to be removed. */
- SdrTextObj* pTextObject = dynamic_cast< SdrTextObj* >( pObject );
+ SdrTextObj* pTextObject = DynCastSdrTextObj( pObject );
bool bDeleteNote = !pTextObject || !pTextObject->HasText();
if( bDeleteNote )
{
diff --git a/sd/qa/unit/SdrPdfImportTest.cxx b/sd/qa/unit/SdrPdfImportTest.cxx
index 7c10eebc17e5..372ccf13f534 100644
--- a/sd/qa/unit/SdrPdfImportTest.cxx
+++ b/sd/qa/unit/SdrPdfImportTest.cxx
@@ -137,7 +137,7 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testImportSimpleText)
// Object should be a text object containing one paragraph with
// content "This is PDF!"
- SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pImportedObject);
+ SdrTextObj* pTextObject = DynCastSdrTextObj(pImportedObject);
CPPUNIT_ASSERT(pTextObject);
OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject();
const EditTextObject& aEdit = pOutlinerParagraphObject->GetTextObject();
diff --git a/sd/qa/unit/ShapeImportExportTest.cxx b/sd/qa/unit/ShapeImportExportTest.cxx
index 1b5ff45ca859..535f3f4eda7e 100644
--- a/sd/qa/unit/ShapeImportExportTest.cxx
+++ b/sd/qa/unit/ShapeImportExportTest.cxx
@@ -74,7 +74,7 @@ void ShapeImportExportTest::testTextDistancesOOXML()
for (auto const& rString : aObjectDesc)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rString));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rString));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(-1292), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(2708), pTextObj->GetTextLowerDistance());
@@ -91,7 +91,7 @@ void ShapeImportExportTest::testTextDistancesOOXML()
for (auto const& rString : aObjectDesc)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rString));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rString));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(1000), pTextObj->GetTextLowerDistance());
@@ -108,7 +108,7 @@ void ShapeImportExportTest::testTextDistancesOOXML()
for (auto const& rString : aObjectDesc)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rString));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rString));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(708), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(708), pTextObj->GetTextLowerDistance());
@@ -125,7 +125,7 @@ void ShapeImportExportTest::testTextDistancesOOXML()
for (auto const& rString : aObjectDesc)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rString));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rString));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pTextObj->GetTextLowerDistance());
@@ -142,7 +142,7 @@ void ShapeImportExportTest::testTextDistancesOOXML()
for (auto const& rString : aObjectDesc)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rString));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rString));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(1000), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pTextObj->GetTextLowerDistance());
@@ -159,7 +159,7 @@ void ShapeImportExportTest::testTextDistancesOOXML()
for (auto const& rString : aObjectDesc)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rString));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rString));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(2708), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(-1292), pTextObj->GetTextLowerDistance());
@@ -183,7 +183,7 @@ void ShapeImportExportTest::testTextDistancesOOXML_LargerThanTextAreaSpecialCase
for (auto const& rName : aObjectNames)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rName));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rName));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(-792), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(2208), pTextObj->GetTextLowerDistance());
@@ -199,7 +199,7 @@ void ShapeImportExportTest::testTextDistancesOOXML_LargerThanTextAreaSpecialCase
for (auto const& rName : aObjectNames)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rName));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rName));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(-292), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(1708), pTextObj->GetTextLowerDistance());
@@ -215,7 +215,7 @@ void ShapeImportExportTest::testTextDistancesOOXML_LargerThanTextAreaSpecialCase
for (auto const& rName : aObjectNames)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rName));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rName));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(708), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(708), pTextObj->GetTextLowerDistance());
@@ -231,7 +231,7 @@ void ShapeImportExportTest::testTextDistancesOOXML_LargerThanTextAreaSpecialCase
for (auto const& rName : aObjectNames)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rName));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rName));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(1708), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(-292), pTextObj->GetTextLowerDistance());
@@ -247,7 +247,7 @@ void ShapeImportExportTest::testTextDistancesOOXML_LargerThanTextAreaSpecialCase
for (auto const& rName : aObjectNames)
{
- auto* pTextObj = dynamic_cast<SdrTextObj*>(searchObject(pPage, rName));
+ auto* pTextObj = DynCastSdrTextObj(searchObject(pPage, rName));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(tools::Long(2208), pTextObj->GetTextUpperDistance());
CPPUNIT_ASSERT_EQUAL(tools::Long(-792), pTextObj->GetTextLowerDistance());
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 93234b2bb794..a9bec3abfd8e 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -532,7 +532,7 @@ void SdOOXMLExportTest1::testBnc887230()
const SdrPage* pPage = GetPage(1);
- const SdrTextObj* pObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ const SdrTextObj* pObj = DynCastSdrTextObj(pPage->GetObj(0));
// Without the fix in place, this test would have failed with
//- Expected: 255
//- Actual : 13421823
@@ -550,14 +550,14 @@ void SdOOXMLExportTest1::testBnc870233_1()
// First shape has red, bold font
{
- const SdrTextObj* pObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ const SdrTextObj* pObj = DynCastSdrTextObj(pPage->GetObj(0));
checkFontAttributes<Color, SvxColorItem>(pObj, Color(0xff0000), EE_CHAR_COLOR);
checkFontAttributes<FontWeight, SvxWeightItem>(pObj, WEIGHT_BOLD, EE_CHAR_WEIGHT);
}
// Second shape has blue, italic font
{
- const SdrTextObj* pObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(1));
+ const SdrTextObj* pObj = DynCastSdrTextObj(pPage->GetObj(1));
checkFontAttributes<Color, SvxColorItem>(pObj, Color(0x0000ff), EE_CHAR_COLOR);
checkFontAttributes<FontItalic, SvxPostureItem>(pObj, ITALIC_NORMAL, EE_CHAR_ITALIC);
}
@@ -576,7 +576,7 @@ void SdOOXMLExportTest1::testBnc870233_2()
{
const SdrObjGroup* pObjGroup = dynamic_cast<SdrObjGroup*>(pPage->GetObj(0));
CPPUNIT_ASSERT(pObjGroup);
- const SdrTextObj* pObj = dynamic_cast<SdrTextObj*>(pObjGroup->GetSubList()->GetObj(1));
+ const SdrTextObj* pObj = DynCastSdrTextObj(pObjGroup->GetSubList()->GetObj(1));
checkFontAttributes<Color, SvxColorItem>(pObj, Color(0x0000ff), EE_CHAR_COLOR);
}
@@ -584,7 +584,7 @@ void SdOOXMLExportTest1::testBnc870233_2()
{
const SdrObjGroup* pObjGroup = dynamic_cast<SdrObjGroup*>(pPage->GetObj(1));
CPPUNIT_ASSERT(pObjGroup);
- const SdrTextObj* pObj = dynamic_cast<SdrTextObj*>(pObjGroup->GetSubList()->GetObj(1));
+ const SdrTextObj* pObj = DynCastSdrTextObj(pObjGroup->GetSubList()->GetObj(1));
checkFontAttributes<Color, SvxColorItem>(pObj, Color(0x1f497d), EE_CHAR_COLOR);
}
@@ -592,7 +592,7 @@ void SdOOXMLExportTest1::testBnc870233_2()
{
const SdrObjGroup* pObjGroup = dynamic_cast<SdrObjGroup*>(pPage->GetObj(2));
CPPUNIT_ASSERT(pObjGroup);
- const SdrTextObj* pObj = dynamic_cast<SdrTextObj*>(pObjGroup->GetSubList()->GetObj(1));
+ const SdrTextObj* pObj = DynCastSdrTextObj(pObjGroup->GetSubList()->GetObj(1));
checkFontAttributes<Color, SvxColorItem>(pObj, Color(0xffffff), EE_CHAR_COLOR);
}
}
@@ -608,7 +608,7 @@ void SdOOXMLExportTest1::testN828390_4()
{
std::vector<EECharAttrib> rLst;
SdrObject* pObj = pPage->GetObj(0);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT(pTxtObj);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
aEdit.GetCharAttribs(0, rLst);
@@ -645,7 +645,7 @@ void SdOOXMLExportTest1::testN828390_5()
const SdrPage* pPage = GetPage(1);
{
SdrObject* pObj = pPage->GetObj(0);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT(pTxtObj);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
const SvxNumBulletItem& rNumFmt = aEdit.GetParaAttribs(3).Get(EE_PARA_NUMBULLET);
@@ -783,7 +783,7 @@ void SdOOXMLExportTest1::testN828390()
std::vector<EECharAttrib> rLst;
// Get the object
SdrObject* pObj = pPage->GetObj(0);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT(pTxtObj);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
aEdit.GetCharAttribs(0, rLst);
@@ -853,7 +853,7 @@ void SdOOXMLExportTest1::testBnc822347_EmptyBullet()
SdrOutliner* pOutliner = pDoc->GetInternalOutliner();
const SdrPage* pPage = pDoc->GetPage(1);
SdrObject* pObject = pPage->GetObj(0);
- SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pObject);
+ SdrTextObj* pTextObject = DynCastSdrTextObj(pObject);
CPPUNIT_ASSERT(pTextObject);
OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject();
@@ -878,7 +878,7 @@ void SdOOXMLExportTest1::testFdo90607()
saveAndReload("Impress Office Open XML");
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(1));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(1));
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
OutlinerParaObject* pOutlinerParagraphObject = pTxtObj->GetOutlinerParaObject();
const sal_Int16 nDepth = pOutlinerParagraphObject->GetDepth(0);
@@ -955,7 +955,7 @@ void SdOOXMLExportTest1::testBulletStartNumber()
saveAndReload("Impress Office Open XML");
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(0));
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET);
@@ -1052,7 +1052,7 @@ void SdOOXMLExportTest1::testBulletColor()
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(0));
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
@@ -1098,7 +1098,7 @@ void SdOOXMLExportTest1::testBulletMarginAndIndentation()
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(0));
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx
index a4e5d882d8e6..62fe34150896 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -1351,7 +1351,7 @@ void SdOOXMLExportTest3::testTdf126234()
// check relative size of the bullet, 400% is a legitimate value for MS Office document
// Without a fix, it will fail to set the size correctly
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(0));
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET);
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 14fe41e2099f..83e27d471bff 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -297,10 +297,10 @@ void SdExportTest::testTransparentBackground()
const SdrPage* pPage = GetPage(1);
- const SdrTextObj* pObj1 = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ const SdrTextObj* pObj1 = DynCastSdrTextObj(pPage->GetObj(0));
checkFontAttributes<Color, SvxColorItem>(pObj1, COL_TRANSPARENT, EE_CHAR_BKGCOLOR);
- const SdrTextObj* pObj2 = dynamic_cast<SdrTextObj*>(pPage->GetObj(1));
+ const SdrTextObj* pObj2 = DynCastSdrTextObj(pPage->GetObj(1));
checkFontAttributes<Color, SvxColorItem>(pObj2, COL_YELLOW, EE_CHAR_BKGCOLOR);
}
@@ -310,7 +310,7 @@ void SdExportTest::testTdf142716()
saveAndReload("Impress Office Open XML");
const SdrPage* pPage = GetPage(1);
- const SdrTextObj* pObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ const SdrTextObj* pObj = DynCastSdrTextObj(pPage->GetObj(0));
OUString sText = pObj->GetOutlinerParaObject()->GetTextObject().GetText(0);
@@ -1707,7 +1707,7 @@ void SdExportTest::testColumnsODG()
CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(700)),
xColProps->getPropertyValue("AutomaticDistance"));
- auto pTextObj = dynamic_cast<SdrTextObj*>(SdrObject::getSdrObjectFromXShape(xShape));
+ auto pTextObj = DynCastSdrTextObj(SdrObject::getSdrObjectFromXShape(xShape));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), pTextObj->GetTextColumnsNumber());
@@ -1731,7 +1731,7 @@ void SdExportTest::testColumnsODG()
CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(700)),
xColProps->getPropertyValue("AutomaticDistance"));
- auto pTextObj = dynamic_cast<SdrTextObj*>(SdrObject::getSdrObjectFromXShape(xShape));
+ auto pTextObj = DynCastSdrTextObj(SdrObject::getSdrObjectFromXShape(xShape));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), pTextObj->GetTextColumnsNumber());
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8f36b016a75b..1121403f4835 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -803,7 +803,7 @@ void SdImportTest::testN759180()
// Get the object
SdrObject* pObj = pPage->GetObj(0);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT(pTxtObj);
std::vector<EECharAttrib> rLst;
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
@@ -833,7 +833,7 @@ void SdImportTest::testN862510_1()
{
std::vector<EECharAttrib> rLst;
SdrObject* pObj = pPage->GetObj(0);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT(pTxtObj);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
aEdit.GetCharAttribs(0, rLst);
@@ -874,7 +874,7 @@ void SdImportTest::testN862510_4()
{
std::vector<EECharAttrib> rLst;
SdrObject* pObj = pPage->GetObj(0);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT(pTxtObj);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
aEdit.GetCharAttribs(0, rLst);
@@ -894,7 +894,7 @@ void SdImportTest::testN828390_2()
const SdrPage* pPage = GetPage(1);
SdrObject* pObj = pPage->GetObj(0);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT(pTxtObj);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
CPPUNIT_ASSERT_EQUAL(OUString("Linux "), aEdit.GetText(0));
@@ -907,7 +907,7 @@ void SdImportTest::testN828390_3()
const SdrPage* pPage = GetPage(1);
SdrObject* pObj = pPage->GetObj(0);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT(pTxtObj);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
std::vector<EECharAttrib> rLst;
@@ -1014,7 +1014,7 @@ void SdImportTest::testN778859()
{
// Get the object
SdrObject* pObj = pPage->GetObj(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
CPPUNIT_ASSERT(!pTxtObj->IsAutoFit());
}
@@ -1026,7 +1026,7 @@ void SdImportTest::testFdo68594()
const SdrPage* pPage = &(GetPage(1)->TRG_GetMasterPage());
SdrObject* pObj = pPage->GetObj(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const SvxColorItem* pC = &pTxtObj->GetMergedItem(EE_CHAR_COLOR);
CPPUNIT_ASSERT_MESSAGE("no color item", pC != nullptr);
@@ -1261,13 +1261,13 @@ void SdImportTest::testMultiColTexts()
loadFromURL(u"pptx/multicol.pptx");
const SdrPage* pPage = GetPage(1);
- auto pTextObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ auto pTextObj = DynCastSdrTextObj(pPage->GetObj(0));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), pTextObj->GetTextColumnsNumber());
CPPUNIT_ASSERT_EQUAL(sal_Int32(1000), pTextObj->GetTextColumnsSpacing());
- auto pMasterTextObj = dynamic_cast<SdrTextObj*>(pPage->TRG_GetMasterPage().GetObj(0));
+ auto pMasterTextObj = DynCastSdrTextObj(pPage->TRG_GetMasterPage().GetObj(0));
CPPUNIT_ASSERT(pMasterTextObj);
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), pMasterTextObj->GetTextColumnsNumber());
@@ -1354,7 +1354,7 @@ void SdImportTest::testBnc584721_1()
const SdrPage* pPage = &(GetPage(1)->TRG_GetMasterPage());
SdrObject* pObj = pPage->GetObj(0);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
CPPUNIT_ASSERT_EQUAL(OUString("Click to edit Master title style"), aEdit.GetText(0));
@@ -1744,7 +1744,7 @@ void SdImportTest::testBulletSuffix()
// check suffix of the char bullet
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(0));
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(1).GetItem(EE_PARA_NUMBULLET);
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index c6e335661e8c..8572bb5efdd4 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -427,7 +427,7 @@ void SdImportTest2::testTdf103792()
CPPUNIT_ASSERT_MESSAGE("No page found", pPage != nullptr);
SdrObject* pObj = pPage->GetObj(0);
CPPUNIT_ASSERT_MESSAGE("Wrong object", pObj != nullptr);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT_MESSAGE("Not a text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
@@ -694,7 +694,7 @@ void SdImportTest2::testTdf103477()
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(6));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(6));
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
@@ -1053,7 +1053,7 @@ void SdImportTest2::testTdf108925()
loadFromURL(u"odp/tdf108925.odp");
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(0));
CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
@@ -1123,7 +1123,7 @@ void SdImportTest2::testTdf90626()
{
loadFromURL(u"pptx/tdf90626.pptx");
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(1));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(1));
CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
for (int i = 0; i < 4; i++)
@@ -1140,7 +1140,7 @@ void SdImportTest2::testTdf138148()
{
loadFromURL(u"pptx/tdf138148.pptx");
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(0));
CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
for (int i = 0; i < 2; i++)
@@ -1207,7 +1207,7 @@ void SdImportTest2::testTdf134210()
void SdImportTest2::testTdf114913()
{
loadFromURL(u"pptx/tdf114913.pptx");
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(GetPage(1)->GetObj(1));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(GetPage(1)->GetObj(1));
CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr);
const SvxNumBulletItem* pItem
= pTxtObj->GetOutlinerParaObject()->GetTextObject().GetParaAttribs(0).GetItem(
@@ -1394,7 +1394,7 @@ void SdImportTest2::testTdf116899()
void SdImportTest2::testTdf77747()
{
loadFromURL(u"ppt/tdf77747.ppt");
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(GetPage(1)->GetObj(0));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(GetPage(1)->GetObj(0));
CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr);
const SvxNumBulletItem* pNumFmt
= pTxtObj->GetOutlinerParaObject()->GetTextObject().GetParaAttribs(0).GetItem(
@@ -1709,7 +1709,7 @@ void SdImportTest2::testTdf49856()
{
loadFromURL(u"ppt/tdf49856.ppt");
const SdrPage* pPage = GetPage(1);
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(1));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(1));
CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET);
@@ -1989,7 +1989,7 @@ void SdImportTest2::testTdf149961AutofitIndentation()
const SdrPage* pPage = GetPage(1);
{
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(0));
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
@@ -2002,7 +2002,7 @@ void SdImportTest2::testTdf149961AutofitIndentation()
}
{
- SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(1));
+ SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage->GetObj(1));
CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 5a14354ae8e1..f637476dbc7b 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -427,7 +427,7 @@ void SdMiscTest::testTextColumns()
xShapes->add(xShape);
// Set up columns
- auto pTextObj = dynamic_cast<SdrTextObj*>(SdrObject::getSdrObjectFromXShape(xShape));
+ auto pTextObj = DynCastSdrTextObj(SdrObject::getSdrObjectFromXShape(xShape));
CPPUNIT_ASSERT(pTextObj);
pTextObj->SetMergedItem(SfxInt16Item(SDRATTR_TEXTCOLUMNS_NUMBER, 2));
pTextObj->SetMergedItem(SdrMetricItem(SDRATTR_TEXTCOLUMNS_SPACING, 1000));
@@ -438,7 +438,7 @@ void SdMiscTest::testTextColumns()
uno::Reference<container::XIndexAccess> xIndexAccess(xDrawPage, uno::UNO_QUERY_THROW);
uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW);
- auto pTextObj = dynamic_cast<SdrTextObj*>(SdrObject::getSdrObjectFromXShape(xShape));
+ auto pTextObj = DynCastSdrTextObj(SdrObject::getSdrObjectFromXShape(xShape));
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), pTextObj->GetTextColumnsNumber());
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index a0b6ff4cd9e5..3529290162c9 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -2445,7 +2445,7 @@ void SdTiledRenderingTest::testPasteTextOnSlide()
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObjCount());
SdrObject* pObject = pActualPage->GetObj(2);
CPPUNIT_ASSERT(pObject);
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObject);
+ SdrTextObj* pTextObj = DynCastSdrTextObj(pObject);
CPPUNIT_ASSERT(pTextObj);
CPPUNIT_ASSERT_EQUAL(SdrObjKind::Text, pTextObj->GetObjIdentifier());
const Point aPos = pTextObj->GetLastBoundRect().TopLeft();
diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx
index fc09d8ab5f19..873e825cf4c5 100644
--- a/sd/source/core/EffectMigration.cxx
+++ b/sd/source/core/EffectMigration.cxx
@@ -607,7 +607,7 @@ void EffectMigration::SetTextAnimationEffect( SvxShape* pShape, AnimationEffect
return;
}
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
// ignore old text effects on shape without text
if( (pTextObj == nullptr) || (!pTextObj->HasText()) )
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 254bcf0ce9bd..d3d5b1063694 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -890,7 +890,7 @@ void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool
}
}
- if( auto pTextObj = dynamic_cast<SdrTextObj *>( pObj ) )
+ if( auto pTextObj = DynCastSdrTextObj( pObj ) )
if (pTextObj->IsEmptyPresObj())
{
PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj);
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 2504c2f6af29..a4e1eb5a0c7c 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -917,7 +917,7 @@ IMPL_LINK_NOARG(SdDrawDocument, OnlineSpellingHdl, Timer *, void)
if (pObj)
{
- if (pObj->GetOutlinerParaObject() && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr)
+ if (pObj->GetOutlinerParaObject() && DynCastSdrTextObj( pObj ) != nullptr)
{
// Spell text object
SpellObject(static_cast<SdrTextObj*>(pObj));
@@ -933,7 +933,7 @@ IMPL_LINK_NOARG(SdDrawDocument, OnlineSpellingHdl, Timer *, void)
SdrObject* pSubObj = aGroupIter.Next();
if (pSubObj->GetOutlinerParaObject())
- if (auto pTextObj = dynamic_cast< SdrTextObj *>( pSubObj ))
+ if (auto pTextObj = DynCastSdrTextObj( pSubObj ))
// Found a text object in a group object
SpellObject(pTextObj);
}
@@ -1055,7 +1055,7 @@ void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo const * pInfo, Sdr
|| nCommand == SpellCallbackCommand::ADDTODICTIONARY)
{
if(pOutl)
- if (auto pTextObj = dynamic_cast<SdrTextObj *>( pObj ))
+ if (auto pTextObj = DynCastSdrTextObj( pObj ))
{
bool bModified(IsChanged());
pTextObj->SetOutlinerParaObject(pOutl->CreateParaObject());
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 6c99ed6ba6e6..0b1be5faadd0 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -448,7 +448,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
InsertObject(pSdrObj.get());
- if ( auto pTextObj = dynamic_cast<SdrTextObj *>( pSdrObj.get() ) )
+ if ( auto pTextObj = DynCastSdrTextObj( pSdrObj.get() ) )
{
// Tell the object EARLY that it is vertical to have the
// defaults for AutoGrowWidth/Height reversed
@@ -496,7 +496,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
OUString aString = GetPresObjText(eObjKind);
if(!aString.isEmpty() || bForceText)
- if (auto pTextObj = dynamic_cast<SdrTextObj *>( pSdrObj.get() ) )
+ if (auto pTextObj = DynCastSdrTextObj( pSdrObj.get() ) )
{
SdrOutliner* pOutliner = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetInternalOutliner();
@@ -2014,7 +2014,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN
}
else if ( eObjKind != SdrObjKind::TitleText &&
eObjKind != SdrObjKind::OutlineText &&
- dynamic_cast< const SdrTextObj *>( pObj ) != nullptr &&
+ DynCastSdrTextObj( pObj ) != nullptr &&
pObj->GetOutlinerParaObject() )
{
/******************************************************
@@ -2220,7 +2220,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj1, PresObjKind eObjKind,
pObj->SetUserCall(this);
- SdrTextObj* pTextObject = dynamic_cast< SdrTextObj* >(pObj.get());
+ SdrTextObj* pTextObject = DynCastSdrTextObj(pObj.get());
if( pTextObject )
{
if( pTextObject->IsVerticalWriting() != bVertical )
@@ -2869,7 +2869,7 @@ bool SdPage::RestoreDefaultText( SdrObject* pObj )
{
bool bRet = false;
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
if( pTextObj )
{
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index c2673ef4ce44..8f022c606764 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2645,7 +2645,7 @@ rtl::Reference<SdrObject> ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData
bool bDontAnimateInvisibleShape = false;
{
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj.get());
+ SdrTextObj* pTextObj = DynCastSdrTextObj(pObj.get());
if( pTextObj && pTextObj->HasText() &&
dynamic_cast< SdrObjGroup *>( pObj.get() ) == nullptr &&
diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx
index ff49054dde0b..8f9ab4c688a4 100644
--- a/sd/source/filter/ppt/pptinanimations.cxx
+++ b/sd/source/filter/ppt/pptinanimations.cxx
@@ -2508,7 +2508,7 @@ void AnimationImporter::importTargetElementContainer( const Atom* pAtom, Any& rT
if((begin == -1) && (end == -1))
break;
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pSdrObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pSdrObject );
if(!pTextObj)
break;
diff --git a/sd/source/filter/xml/sdtransform.cxx b/sd/source/filter/xml/sdtransform.cxx
index 4e296eaf6282..2b4db59efa5d 100644
--- a/sd/source/filter/xml/sdtransform.cxx
+++ b/sd/source/filter/xml/sdtransform.cxx
@@ -165,7 +165,7 @@ void SdTransformOOo2xDocument::transformShapes( SdrObjList const & rShapes )
void SdTransformOOo2xDocument::transformShape( SdrObject& rObj )
{
- SdrTextObj* pTextShape = dynamic_cast< SdrTextObj* >( &rObj );
+ SdrTextObj* pTextShape = DynCastSdrTextObj( &rObj );
if( pTextShape )
{
transformTextShape( *pTextShape );
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 4a67154ccd6f..e87fd1a016b3 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -204,7 +204,7 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj )
}
}
}
- else if( auto pTextObj = dynamic_cast< SdrTextObj *>( pObj ) )
+ else if( auto pTextObj = DynCastSdrTextObj( pObj ) )
{
const OutlinerParaObject* pPara;
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index 06230fa6cbdf..ed4478747e8c 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -655,7 +655,7 @@ void FuDraw::DoubleClick(const MouseEvent& rMEvt)
GetDispatcher()->Execute( SID_INSERT_GRAPHIC,
SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
}
- else if ( ( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr || dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr ) &&
+ else if ( ( DynCastSdrTextObj( pObj ) != nullptr || dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr ) &&
!SD_MOD()->GetWaterCan() &&
mpViewShell->GetFrameView()->IsDoubleClickTextEdit() &&
!mpDocSh->IsReadOnly())
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index b9aab12a4b27..c75959fbc243 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -197,7 +197,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
{
SdrObject* pObj = aIter.Next();
- if(auto pTextObj = dynamic_cast<SdrTextObj *>( pObj ))
+ if(auto pTextObj = DynCastSdrTextObj( pObj ))
{
SdrInventor nInv(pObj->GetObjInventor());
SdrObjKind nKnd(pObj->GetObjIdentifier());
@@ -786,7 +786,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
// #i118485# allow TextInput for OLEs, too
- if( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr && pObj->HasTextEdit())
+ if( DynCastSdrTextObj( pObj ) != nullptr && pObj->HasTextEdit())
{
// use common IsSimpleCharInput from the EditEngine.
bool bPrintable(EditEngine::IsSimpleCharInput(rKEvt));
@@ -824,7 +824,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
{
SdrObject* pObj = aIter.Next();
- if(auto pTextObj = dynamic_cast< SdrTextObj *>( pObj ))
+ if(auto pTextObj = DynCastSdrTextObj( pObj ))
{
SdrInventor nInv(pObj->GetObjInventor());
SdrObjKind nKnd(pObj->GetObjIdentifier());
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 68839bded557..60e36e2674b3 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -196,7 +196,7 @@ void FuText::DoExecute( SfxRequest& )
mpView->PickAnything(aMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
mpView->MarkObj(aVEvt.mpRootObj, pPV);
- mxTextObj = dynamic_cast< SdrTextObj* >( aVEvt.mpObj );
+ mxTextObj = DynCastSdrTextObj( aVEvt.mpObj );
}
else if (mpView->AreObjectsMarked())
{
@@ -205,7 +205,7 @@ void FuText::DoExecute( SfxRequest& )
if (rMarkList.GetMarkCount() == 1)
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- mxTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ mxTextObj = DynCastSdrTextObj( pObj );
}
}
@@ -354,7 +354,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
if (bMarkChanges)
mpView->MarkObj(aVEvt.mpRootObj, pPV);
- if (auto pSdrTextObj = dynamic_cast<SdrTextObj*>(aVEvt.mpObj))
+ if (auto pSdrTextObj = DynCastSdrTextObj(aVEvt.mpObj))
{
mxTextObj = pSdrTextObj;
}
@@ -702,7 +702,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
else if( mpView && mpView->IsCreateObj() && rMEvt.IsLeft())
{
// object was created
- rtl::Reference<SdrTextObj> pTextObj = dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() );
+ rtl::Reference<SdrTextObj> pTextObj = DynCastSdrTextObj( mpView->GetCreateObj() );
mxTextObj = pTextObj.get();
if( pTextObj )
@@ -808,7 +808,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
aPnt.AdjustY(nDrgLog + nDrgLog );
mpView->MovAction(aPnt);
- mxTextObj = dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() );
+ mxTextObj = DynCastSdrTextObj( mpView->GetCreateObj() );
if(mxTextObj.get().is())
{
@@ -1281,7 +1281,7 @@ void FuText::ReceiveRequest(SfxRequest& rReq)
mpView->PickAnything(aMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
mpView->MarkObj(aVEvt.mpRootObj, pPV);
- if (auto pSdrTextObj = dynamic_cast<SdrTextObj*>(aVEvt.mpObj))
+ if (auto pSdrTextObj = DynCastSdrTextObj(aVEvt.mpObj))
{
mxTextObj = pSdrTextObj;
}
@@ -1295,7 +1295,7 @@ void FuText::ReceiveRequest(SfxRequest& rReq)
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- if( auto pTextObj = dynamic_cast<SdrTextObj *>( pObj ))
+ if( auto pTextObj = DynCastSdrTextObj( pObj ))
{
mxTextObj = pTextObj;
}
@@ -1339,7 +1339,7 @@ rtl::Reference<SdrObject> FuText::CreateDefaultObject(const sal_uInt16 nID, cons
if(pObj)
{
- if( auto pText = dynamic_cast< SdrTextObj *>( pObj.get() ) )
+ if( auto pText = DynCastSdrTextObj( pObj.get() ) )
{
pText->SetLogicRect(rRectangle);
@@ -1413,7 +1413,7 @@ void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFo
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
for( size_t nMark = 0; nMark < rMarkList.GetMarkCount(); ++nMark )
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( rMarkList.GetMark(nMark)->GetMarkedSdrObj() );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( rMarkList.GetMark(nMark)->GetMarkedSdrObj() );
if( pTextObj )
{
rtl::Reference<sdr::SelectionController> xSelectionController(pView->getSelectionController());
diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx
index 78d2ae6939b3..d978880039dd 100644
--- a/sd/source/ui/func/futhes.cxx
+++ b/sd/source/ui/func/futhes.cxx
@@ -78,7 +78,7 @@ void FuThesaurus::DoExecute(SfxRequest& rReq)
SdrMark* pMark = rMarkList.GetMark(0);
SdrObject* pObj = pMark->GetMarkedSdrObj();
- pTextObj = dynamic_cast<SdrTextObj *>( pObj );
+ pTextObj = DynCastSdrTextObj( pObj );
}
}
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 52e05557e903..2bd908fe93d0 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -568,7 +568,7 @@ void SlotManager::GetMenuState (SfxItemSet& rSet)
else
{
// check if the object is in edit, then if it's temporarily not empty
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
if( pTextObj )
{
if( pTextObj->CanCreateEditOutlinerParaObject() )
diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index f2843311c2b9..21b9df9ad4aa 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -152,7 +152,7 @@ static void InsertTableImpl(const DrawViewShell* pShell,
// #i123359# if an object is to be replaced/manipulated it may be that it is in text edit mode,
// so to be on the safe side call SdrEndTextEdit here
- SdrTextObj* pCheckForTextEdit = dynamic_cast< SdrTextObj* >(pPickObj);
+ SdrTextObj* pCheckForTextEdit = DynCastSdrTextObj(pPickObj);
if(pCheckForTextEdit && pCheckForTextEdit->IsInEditMode())
{
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 14eb0a38d279..990f9c84b625 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1763,7 +1763,7 @@ vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( const Sd
{
SdrInventor nInventor = rObject.GetObjInventor();
SdrObjKind nIdentifier = rObject.GetObjIdentifier();
- bool bIsTextObj = dynamic_cast< const SdrTextObj *>( &rObject ) != nullptr;
+ bool bIsTextObj = DynCastSdrTextObj( &rObject ) != nullptr;
if ( nInventor == SdrInventor::Default )
{
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index b90636070135..3994b9f63f60 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -839,7 +839,7 @@ bool SdXShape::IsEmptyPresObj() const
if( (pObj != nullptr) && pObj->IsEmptyPresObj() )
{
// check if the object is in edit, then if it's temporarily not empty
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
if( pTextObj == nullptr )
return true;
@@ -890,7 +890,7 @@ void SdXShape::SetEmptyPresObj(bool bEmpty)
// really delete SdrOutlinerObj at pObj
pObj->NbcSetOutlinerParaObject(std::nullopt);
if( bVertical )
- if (auto pTextObj = dynamic_cast<SdrTextObj*>( pObj ) )
+ if (auto pTextObj = DynCastSdrTextObj( pObj ) )
pTextObj->SetVerticalWriting( true );
SdrGrafObj* pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj );
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 307c0d324bb9..3d58ef849104 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1642,7 +1642,7 @@ private:
if (pObj->GetObjInventor() == SdrInventor::Default
&& pObj->GetObjIdentifier() == SdrObjKind::TitleText)
{
- pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ pTextObj = DynCastSdrTextObj(pObj);
}
}
@@ -1666,7 +1666,7 @@ private:
if (pObj->GetObjInventor() == SdrInventor::Default
&& pObj->GetObjIdentifier() == SdrObjKind::OutlineText)
{
- pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ pTextObj = DynCastSdrTextObj(pObj);
}
}
@@ -1674,7 +1674,7 @@ private:
if (!pTextObj)
{
bSubTitle = true;
- pTextObj = dynamic_cast<SdrTextObj*>(pPage->GetPresObj(PresObjKind::Text)); // is there a subtitle?
+ pTextObj = DynCastSdrTextObj(pPage->GetPresObj(PresObjKind::Text)); // is there a subtitle?
}
sal_Int32 nParaCount1 = pOutliner->GetParagraphCount();
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 3bb0afc7b406..4773b3badf4f 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1160,7 +1160,7 @@ namespace
bool lclIsValidTextObject(const sd::outliner::IteratorPosition& rPosition)
{
- auto* pObject = dynamic_cast< SdrTextObj* >( rPosition.mxObject.get().get() );
+ auto* pObject = DynCastSdrTextObj( rPosition.mxObject.get().get() );
return (pObject != nullptr) && pObject->HasText() && ! pObject->IsEmptyPresObj();
}
@@ -1469,7 +1469,7 @@ bool SdOutliner::ShowWrapAroundDialog()
void SdOutliner::PutTextIntoOutliner()
{
- mpSearchSpellTextObj = dynamic_cast<SdrTextObj*>( mpObj );
+ mpSearchSpellTextObj = DynCastSdrTextObj( mpObj );
if ( mpSearchSpellTextObj && mpSearchSpellTextObj->HasText() && !mpSearchSpellTextObj->IsEmptyPresObj() )
{
SdrText* pText = mpSearchSpellTextObj->getText( maCurrentPosition.mnText );
diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx
index 57e912c1fcdb..ac3f1bc29601 100644
--- a/sd/source/ui/view/OutlinerIterator.cxx
+++ b/sd/source/ui/view/OutlinerIterator.cxx
@@ -436,7 +436,7 @@ IteratorImplBase* SelectionIteratorImpl::Clone (IteratorImplBase* pObject) const
void SelectionIteratorImpl::GotoNextText()
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mrObjectList.at(mnObjectIndex).get().get() );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mrObjectList.at(mnObjectIndex).get().get() );
if (mbDirectionIsForward)
{
if( pTextObj )
@@ -472,7 +472,7 @@ void SelectionIteratorImpl::GotoNextText()
if( (maPosition.mnText == -1) && (mnObjectIndex >= 0) )
{
- pTextObj = dynamic_cast< SdrTextObj* >( mrObjectList.at(mnObjectIndex).get().get() );
+ pTextObj = DynCastSdrTextObj( mrObjectList.at(mnObjectIndex).get().get() );
if( pTextObj )
maPosition.mnText = pTextObj->getTextCount() - 1;
}
@@ -561,7 +561,7 @@ IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const
void ViewIteratorImpl::GotoNextText()
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( maPosition.mxObject.get().get() );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() );
if( pTextObj )
{
if (mbDirectionIsForward)
@@ -601,7 +601,7 @@ void ViewIteratorImpl::GotoNextText()
maPosition.mnText = 0;
if( !mbDirectionIsForward && maPosition.mxObject.get().is() )
{
- pTextObj = dynamic_cast< SdrTextObj* >( maPosition.mxObject.get().get() );
+ pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() );
if( pTextObj )
maPosition.mnText = pTextObj->getTextCount() - 1;
}
@@ -656,7 +656,7 @@ void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex)
maPosition.mnText = 0;
if( !mbDirectionIsForward && maPosition.mxObject.get().is() )
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( maPosition.mxObject.get().get() );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() );
if( pTextObj )
maPosition.mnText = pTextObj->getTextCount() - 1;
}
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index e4cdf010736c..2c972b065570 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -593,7 +593,7 @@ void DrawView::DeleteMarked()
default:
break;
}
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
bool bVertical = pTextObj && pTextObj->IsVerticalWriting();
::tools::Rectangle aRect( pObj->GetLogicRect() );
SdrObject* pNewObj = pPage->InsertAutoLayoutShape( nullptr, ePresObjKind, bVertical, aRect, true );
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index d9cf5656e063..e3181ba50d03 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -208,7 +208,7 @@ bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin)
{
SdrObject* pObj = aIter.Next();
- if(auto pSdrTextObj = dynamic_cast<SdrTextObj *>( pObj ))
+ if(auto pSdrTextObj = DynCastSdrTextObj( pObj ))
{
SdrInventor nInv(pObj->GetObjInventor());
SdrObjKind nKnd(pObj->GetObjIdentifier());
diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx
index 45b6edd5c0d6..bd34aa5a0267 100644
--- a/sd/source/ui/view/drviews6.cxx
+++ b/sd/source/ui/view/drviews6.cxx
@@ -82,7 +82,7 @@ void DrawViewShell::GetFormTextState(SfxItemSet& rSet)
if ( rMarkList.GetMarkCount() == 1 )
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
+ const SdrTextObj* pTextObj = DynCastSdrTextObj(pObj);
const bool bDeactivate(
!pObj ||
!pTextObj ||
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 4f375dc6a05c..b7968a638ce5 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -414,7 +414,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
else
{
// check if the object is in edit, then if it's temporarily not empty
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
if( pTextObj )
{
if( pTextObj->CanCreateEditOutlinerParaObject() )
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 8aab2c57602e..e74fe71dd45e 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -684,7 +684,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
const size_t nMarkCount = rMarkList.GetMarkCount();
for (size_t nIndex = 0; nIndex < nMarkCount; ++nIndex)
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(rMarkList.GetMark(nIndex)->GetMarkedSdrObj());
+ SdrTextObj* pTextObj = DynCastSdrTextObj(rMarkList.GetMark(nIndex)->GetMarkedSdrObj());
if (pTextObj && pTextObj->GetObjInventor() == SdrInventor::Default)
{
if (pTextObj->GetObjIdentifier() != SdrObjKind::OLE2)
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 856c49748ea4..10a6e7620afe 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -956,7 +956,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
else
{
// check if the object is in edit, then if it's temporarily not empty
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
if( pTextObj )
{
if( pTextObj->CanCreateEditOutlinerParaObject() )
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 5007f6dd52af..c92ee1113e3c 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -221,7 +221,7 @@ void ViewRedirector::createRedirectedPrimitive2DSequence(
{
bool bCreateOutline(false);
- if( pObject->IsEmptyPresObj() && dynamic_cast< SdrTextObj *>( pObject ) != nullptr )
+ if( pObject->IsEmptyPresObj() && DynCastSdrTextObj( pObject ) != nullptr )
{
if( !bSubContentProcessing || !pObject->IsNotVisibleAsMaster() )
{
@@ -367,7 +367,7 @@ void ViewRedirector::createRedirectedPrimitive2DSequence(
aObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
// create font
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pObject );
const SdrTextVertAdjust eTVA(pTextObj ? pTextObj->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_CENTER);
vcl::Font aScaledVclFont;
@@ -1220,7 +1220,7 @@ bool View::ShouldToggleOn(
const size_t nMarkCount = GetMarkedObjectCount();
for (size_t nIndex = 0; nIndex < nMarkCount && !bToggleOn; ++nIndex)
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
+ SdrTextObj* pTextObj = DynCastSdrTextObj(GetMarkedObjectByIndex(nIndex));
if (!pTextObj || pTextObj->IsTextEditActive())
continue;
if( dynamic_cast< const SdrTableObj *>( pTextObj ) != nullptr)
@@ -1291,7 +1291,7 @@ void View::ChangeMarkedObjectsBulletsNumbering(
const size_t nMarkCount = GetMarkedObjectCount();
for (size_t nIndex = 0; nIndex < nMarkCount; ++nIndex)
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
+ SdrTextObj* pTextObj = DynCastSdrTextObj(GetMarkedObjectByIndex(nIndex));
if (!pTextObj || pTextObj->IsTextEditActive())
continue;
if( dynamic_cast< SdrTableObj *>( pTextObj ) != nullptr)
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 1c1f964f971a..e5d937094d17 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -152,7 +152,7 @@ void AccessibleShape::Init()
if( !pSdrObject )
return;
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pSdrObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pSdrObject );
const bool hasOutlinerParaObject = (pTextObj && pTextObj->CanCreateEditOutlinerParaObject()) || (pSdrObject->GetOutlinerParaObject() != nullptr);
// create AccessibleTextHelper to handle this shape's text
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 86a1b15b64e4..18df6d5a6a98 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -632,7 +632,7 @@ void E3dView::ImpIsConvertTo3DPossible(SdrObject const * pObj, bool& rAny3D,
void E3dView::ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj)
{
- if(dynamic_cast<const SdrTextObj*>( pObj) == nullptr)
+ if(DynCastSdrTextObj( pObj) == nullptr)
return;
const SfxItemSet& rSet = pObj->GetMergedItemSet();
diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
index 1483b57645f8..5f13af5cbe65 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -98,7 +98,7 @@ ViewContact* ViewContactOfSdrObj::GetParentContact() const
void ViewContactOfSdrObj::ActionChanged()
{
// look for own changes
- if (SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(&GetSdrObject()))
+ if (SdrTextObj* pTextObj = DynCastSdrTextObj(&GetSdrObject()))
{
// tdf#146860 no idea why, but calling this makes the text boxes render properly
pTextObj->GetTextAniKind();
diff --git a/svx/source/sidebar/SelectionAnalyzer.cxx b/svx/source/sidebar/SelectionAnalyzer.cxx
index 193b6b6b7d60..dc8073ec6c41 100644
--- a/svx/source/sidebar/SelectionAnalyzer.cxx
+++ b/svx/source/sidebar/SelectionAnalyzer.cxx
@@ -42,7 +42,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC(const SdrMarkL
case 1:
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- auto pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ auto pTextObj = DynCastSdrTextObj(pObj);
if (pTextObj && pTextObj->IsInEditMode())
{
eContext = EnumContext::Context::DrawText;
@@ -125,7 +125,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD(const SdrMarkL
case 1:
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- auto pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ auto pTextObj = DynCastSdrTextObj(pObj);
if (pTextObj && pTextObj->IsInEditMode())
{
if (pObj->GetObjIdentifier() == SdrObjKind::Table)
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 100a7dcc8e16..5c04ce2706b6 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -188,7 +188,7 @@ namespace
if((pObj->GetObjInventor() == SdrInventor::Default) && (SdrObjKind::Text == eKind || SdrObjKind::TitleText == eKind || SdrObjKind::OutlineText == eKind))
{
- const SdrTextObj* pSdrTextObj = dynamic_cast< const SdrTextObj* >(pObj);
+ const SdrTextObj* pSdrTextObj = DynCastSdrTextObj(pObj);
if(pSdrTextObj && pSdrTextObj->HasText())
{
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 7c5d2c76f9e9..27b62dd17946 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -419,7 +419,7 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
{
mpMarkedObj=GetMarkedObjectByIndex(0);
if ( mpMarkedObj &&
- dynamic_cast<const SdrTextObj*>( mpMarkedObj) != nullptr &&
+ DynCastSdrTextObj( mpMarkedObj) != nullptr &&
static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame() )
bSingleTextObjMark = true;
}
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 012b5153207f..58812d849403 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -1025,11 +1025,11 @@ void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrO
if(IsTextEdit())
{
#ifdef DBG_UTIL
- if(auto pTextObj = dynamic_cast< SdrTextObj* >(pOldObj))
+ if(auto pTextObj = DynCastSdrTextObj(pOldObj))
if (pTextObj->IsTextEditActive())
OSL_ENSURE(false, "OldObject is in TextEdit mode, this has to be ended before replacing it using SdrEndTextEdit (!)");
- if(auto pTextObj = dynamic_cast< SdrTextObj* >(pNewObj))
+ if(auto pTextObj = DynCastSdrTextObj(pNewObj))
if (pTextObj->IsTextEditActive())
OSL_ENSURE(false, "NewObject is in TextEdit mode, this has to be ended before replacing it using SdrEndTextEdit (!)");
#endif
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 6d4fe7cfa181..2e4d218a3aee 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -1181,7 +1181,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll)
// multiple portions exist with multiple formats. If an OutlinerParaObject
// really exists and needs to be rescued is evaluated in the undo
// implementation itself.
- const bool bRescueText = dynamic_cast< SdrTextObj* >(pObj) != nullptr;
+ const bool bRescueText = DynCastSdrTextObj(pObj) != nullptr;
// add attribute undo
AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,false,bHasEEItems || bPossibleGeomChange || bRescueText));
@@ -1226,7 +1226,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll)
}
}
- if(auto pTextObj = dynamic_cast<SdrTextObj*>( pObj))
+ if(auto pTextObj = DynCastSdrTextObj( pObj))
{
if(!aCharWhichIds.empty())
{
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index caaeb93f1a00..38c07fbba1f0 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -1237,7 +1237,7 @@ void SdrEditView::CombineMarkedTextObjects()
while ( aIter.IsMore() )
{
SdrObject* pObj = aIter.Next();
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pObj );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
const OutlinerParaObject* pOPO = pTextObj ? pTextObj->GetOutlinerParaObject() : nullptr;
if ( pOPO && pTextObj->IsTextFrame()
&& pTextObj->GetObjIdentifier() == SdrObjKind::Text // not callouts (OBJ_CAPTION)
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 838876afa707..77b5f9cea719 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1232,7 +1232,7 @@ bool SdrObjEditView::SdrBeginTextEdit(SdrObject* pObj_, SdrPageView* pPV, vcl::W
// FIXME this encourages all sorts of bad habits and should be removed
SdrEndTextEdit();
- SdrTextObj* pObj = dynamic_cast<SdrTextObj*>(pObj_);
+ SdrTextObj* pObj = DynCastSdrTextObj(pObj_);
if (!pObj)
return false; // currently only possible with text objects
@@ -2963,7 +2963,7 @@ void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, bool bNoChara
}
// now apply character and paragraph formatting to text, if the shape has any
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTextObj = DynCastSdrTextObj(pObj);
if (pTextObj)
{
sal_Int32 nText = pTextObj->getTextCount();
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 203b566002b8..b642f8e69117 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -504,7 +504,7 @@ namespace
}
else
{
- SdrTextObj* pText = dynamic_cast< SdrTextObj * >(pObj);
+ SdrTextObj* pText = DynCastSdrTextObj(pObj);
// Exclude zero master page object (i.e. background shape) from color query
if(pText
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 587ca14a4637..eb1c9648b127 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -465,7 +465,7 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj1, bool bScale)
const SdrLayerID aOldLayer(pObj->GetLayer());
const SfxItemSet aOldItemSet(pObj->GetMergedItemSet());
const SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(pObj.get());
- const SdrTextObj* pSdrTextObj = dynamic_cast< SdrTextObj* >(pObj.get());
+ const SdrTextObj* pSdrTextObj = DynCastSdrTextObj(pObj.get());
if(pSdrTextObj && pSdrTextObj->HasText())
{
@@ -611,7 +611,7 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj1, bool bScale)
if(!bVisible)
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj.get());
+ SdrTextObj* pTextObj = DynCastSdrTextObj(pObj.get());
if(pTextObj && pTextObj->HasText())
{
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index 58963a9f4ab8..9df4b8dc32f1 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -421,7 +421,7 @@ const OUString& SdrMarkList::GetMarkDescription() const
{
// if it's a single selection, cache only text frame
const SdrObject* pObj = GetMark(0)->GetMarkedSdrObj();
- const SdrTextObj* pTextObj = dynamic_cast<const SdrTextObj*>( pObj );
+ const SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
if(!pTextObj || !pTextObj->IsTextFrame())
{
@@ -511,7 +511,7 @@ const OUString& SdrMarkList::GetPointMarkDescription(bool bGlue) const
{
// if it's a single selection, cache only text frame
const SdrObject* pObj = GetMark(0)->GetMarkedSdrObj();
- const SdrTextObj* pTextObj = dynamic_cast<const SdrTextObj*>( pObj );
+ const SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
if(!pTextObj || !pTextObj->IsTextFrame())
{
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 90ebb72a7cc9..912135b0d1c0 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1214,7 +1214,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
if(nullptr != mpMarkedObj)
{
bSingleTextObjMark =
- dynamic_cast<const SdrTextObj*>( mpMarkedObj) != nullptr &&
+ DynCastSdrTextObj( mpMarkedObj) != nullptr &&
static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame();
// RotGrfFlyFrame: we may have limited rotation
@@ -1254,7 +1254,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
// Also formerly #122142#: Pretty much the same for SdrCaptionObj's in calc.
if(static_cast<SdrView*>(this)->IsTextEdit())
{
- const SdrTextObj* pSdrTextObj = dynamic_cast< const SdrTextObj* >(mpMarkedObj);
+ const SdrTextObj* pSdrTextObj = DynCastSdrTextObj(mpMarkedObj);
if (pSdrTextObj && pSdrTextObj->IsInEditMode())
{
@@ -2307,7 +2307,7 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT
const bool bCheckIfMarkable(nOptions & SdrSearchOptions::TESTMARKABLE);
const bool bDeep(nOptions & SdrSearchOptions::DEEP);
const bool bOLE(dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr);
- auto pTextObj = dynamic_cast<const SdrTextObj*>( pObj);
+ auto pTextObj = DynCastSdrTextObj( pObj);
const bool bTXT(pTextObj && pTextObj->IsTextFrame());
SdrObject* pRet=nullptr;
tools::Rectangle aRect(pObj->GetCurrentBoundRect());
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index becc4cd3cdbe..877744f4e273 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1107,7 +1107,7 @@ basegfx::B2DPolyPolygon SdrObject::TakeContour() const
if(pClone)
{
- const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(this);
+ const SdrTextObj* pTextObj = DynCastSdrTextObj(this);
if(pTextObj)
{
@@ -3209,6 +3209,15 @@ E3dObject* DynCastE3dObject(SdrObject* pObj)
return nullptr;
}
+SdrTextObj* DynCastSdrTextObj(SdrObject* pObj)
+{
+ // SdrTextObj has a lot of subclasses, with lots of SdrObjKind identifiers, so use a virtual method
+ // to be safer.
+ if( pObj && pObj->IsSdrTextObj() )
+ return static_cast<SdrTextObj*>(pObj);
+ return nullptr;
+}
+
rtl::Reference<SdrObject> SdrObjFactory::CreateObjectFromFactory(SdrModel& rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier)
{
SdrObjCreatorParams aParams { nInventor, nObjIdentifier, rSdrModel };
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 53b32ddf28b2..8ca01ffd74b2 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1911,7 +1911,7 @@ static void ImpUpdateChainLinks(SdrTextObj *pTextObj, std::u16string_view aNextL
SdrPage *pPage(pTextObj->getSdrPageFromSdrObject());
assert(pPage);
- SdrTextObj *pNextTextObj = dynamic_cast< SdrTextObj * >
+ SdrTextObj *pNextTextObj = DynCastSdrTextObj
(ImpGetObjByName(pPage, aNextLinkName));
if (!pNextTextObj) {
SAL_INFO("svx.chaining", "[CHAINING] Can't find object as next link.");
@@ -2033,7 +2033,7 @@ bool SdrTextObj::GetPreventChainable() const
rtl::Reference<SdrObject> SdrTextObj::getFullDragClone() const
{
rtl::Reference<SdrObject> pClone = SdrAttrObj::getFullDragClone();
- SdrTextObj *pTextObjClone = dynamic_cast<SdrTextObj *>(pClone.get());
+ SdrTextObj *pTextObjClone = DynCastSdrTextObj(pClone.get());
if (pTextObjClone != nullptr) {
// Avoid transferring of text for chainable object during dragging
pTextObjClone->mbIsUnchainableClone = true;
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 0c8928891231..90fddd223263 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1498,7 +1498,7 @@ void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutlin
size_t nObjCount(getSdrPageFromSdrObject()->GetObjCount());
for (size_t i = 0; i < nObjCount; i++)
{
- SdrTextObj* pCurObj(dynamic_cast< SdrTextObj* >(getSdrPageFromSdrObject()->GetObj(i)));
+ SdrTextObj* pCurObj(DynCastSdrTextObj(getSdrPageFromSdrObject()->GetObj(i)));
if(pCurObj == this)
{
SAL_INFO("svx.chaining", "Working on TextBox " << i);
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 16745d445e13..7509991ba346 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -416,7 +416,7 @@ void ImpSdrPdfImport::InsertObj(SdrObject* pObj1, bool bScale)
const SdrLayerID aOldLayer(pObj->GetLayer());
const SfxItemSet aOldItemSet(pObj->GetMergedItemSet());
const SdrGrafObj* pSdrGrafObj = dynamic_cast<SdrGrafObj*>(pObj.get());
- const SdrTextObj* pSdrTextObj = dynamic_cast<SdrTextObj*>(pObj.get());
+ const SdrTextObj* pSdrTextObj = DynCastSdrTextObj(pObj.get());
if (pSdrTextObj && pSdrTextObj->HasText())
{
@@ -561,7 +561,7 @@ void ImpSdrPdfImport::InsertObj(SdrObject* pObj1, bool bScale)
if (!bVisible)
{
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj.get());
+ SdrTextObj* pTextObj = DynCastSdrTextObj(pObj.get());
if (pTextObj && pTextObj->HasText())
{
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 0df375d266a6..20be7b878845 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -1023,7 +1023,7 @@ void SdrUndoObjSetText::AfterSetText()
void SdrUndoObjSetText::Undo()
{
// only works with SdrTextObj
- SdrTextObj* pTarget = dynamic_cast< SdrTextObj* >(mxObj.get());
+ SdrTextObj* pTarget = DynCastSdrTextObj(mxObj.get());
if(!pTarget)
{
@@ -1065,7 +1065,7 @@ void SdrUndoObjSetText::Undo()
void SdrUndoObjSetText::Redo()
{
// only works with SdrTextObj
- SdrTextObj* pTarget = dynamic_cast< SdrTextObj* >(mxObj.get());
+ SdrTextObj* pTarget = DynCastSdrTextObj(mxObj.get());
if(!pTarget)
{
@@ -1125,7 +1125,7 @@ void SdrUndoObjSetText::SdrRepeat(SdrView& rView)
for (size_t nm=0; nm<nCount; ++nm)
{
SdrObject* pObj2=rML.GetMark(nm)->GetMarkedSdrObj();
- SdrTextObj* pTextObj=dynamic_cast<SdrTextObj*>( pObj2 );
+ SdrTextObj* pTextObj=DynCastSdrTextObj( pObj2 );
if (pTextObj!=nullptr)
{
if( bUndo )
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 42399006bf47..e4e40a5ba2aa 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -438,7 +438,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
// check for URL field
if (eHit==SdrHitKind::UnmarkedObject)
{
- SdrTextObj* pTextObj=dynamic_cast<SdrTextObj*>( pHitObj );
+ SdrTextObj* pTextObj=DynCastSdrTextObj( pHitObj );
if (pTextObj!=nullptr && pTextObj->HasText())
{
// use the primitive-based HitTest which is more accurate anyways. It
@@ -518,7 +518,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
tools::Rectangle aBoundRect(pHitObj->GetCurrentBoundRect());
// Force to SnapRect when Fontwork
- if( auto pTextObj = dynamic_cast<const SdrTextObj*>(pHitObj) )
+ if( auto pTextObj = DynCastSdrTextObj(pHitObj) )
if( pTextObj->IsFontwork() )
aBoundRect = pHitObj->GetSnapRect();
@@ -1041,7 +1041,7 @@ PointerStyle SdrView::GetPreferredPointer(const Point& rMousePos, const OutputDe
case SdrHitKind::TextEdit :
case SdrHitKind::TextEditObj:
{
- SdrTextObj* pText = dynamic_cast< SdrTextObj* >(aVEvt.mpObj);
+ SdrTextObj* pText = DynCastSdrTextObj(aVEvt.mpObj);
if(pText && pText->HasText())
{
OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index b1ffa6449007..66af82d6baac 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -837,7 +837,7 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
else if( rSettings.mbScrollText )
{
SdrObject* pObj = aShapes.front();
- auto pTextObj = dynamic_cast<SdrTextObj*>( pObj);
+ auto pTextObj = DynCastSdrTextObj( pObj);
if( pTextObj && pTextObj->HasText() )
{
tools::Rectangle aScrollRectangle;
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index a37e6ef4c65c..38d5ee335af5 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -175,7 +175,7 @@ protected:
/// Calculates what scaling factor will be used for autofit text scaling of this shape.
sal_Int16 GetTextFitToSizeScale(SdrObject* pObject)
{
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObject);
+ SdrTextObj* pTextObj = DynCastSdrTextObj(pObject);
if (!pTextObj)
{
return 0;
@@ -2436,7 +2436,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
case OWN_ATTR_TEXTCOLUMNS:
{
- if (auto pTextObj = dynamic_cast<SdrTextObj*>(pSdrObject.get()))
+ if (auto pTextObj = DynCastSdrTextObj(pSdrObject.get()))
{
css::uno::Reference<css::text::XTextColumns> xTextColumns;
if (rValue >>= xTextColumns)
@@ -2566,7 +2566,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
case OWN_ATTR_ISFONTWORK:
{
bool bIsFontwork = false;
- if (const SdrTextObj* pTextObj = dynamic_cast<const SdrTextObj*>(GetSdrObject()))
+ if (const SdrTextObj* pTextObj = DynCastSdrTextObj(GetSdrObject()))
bIsFontwork = pTextObj->IsFontwork();
rValue <<= bIsFontwork;
break;
@@ -2883,7 +2883,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
case OWN_ATTR_TEXTCOLUMNS:
{
- if (auto pTextObj = dynamic_cast<const SdrTextObj*>(GetSdrObject()))
+ if (auto pTextObj = DynCastSdrTextObj(GetSdrObject()))
{
if (pTextObj->HasTextColumnsNumber() || pTextObj->HasTextColumnsSpacing())
{
@@ -3888,7 +3888,7 @@ bool SvxShapeText::setPropertyValueImpl( const OUString& rName, const SfxItemPro
if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetSdrObject() );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( GetSdrObject() );
if( pTextObj )
{
css::text::WritingMode eMode;
@@ -3906,7 +3906,7 @@ bool SvxShapeText::getPropertyValueImpl( const OUString& rName, const SfxItemPro
{
if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetSdrObject() );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( GetSdrObject() );
if( pTextObj && pTextObj->IsVerticalWriting() )
rValue <<= css::text::WritingMode_TB_RL;
else
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 9dc311f9c438..b1ca3ff0c65e 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -110,7 +110,7 @@ private:
{
if (!mbShapeIsEditMode)
return false;
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
return pTextObj && pTextObj->IsTextEditActive();
}
@@ -170,7 +170,7 @@ SvxTextEditSourceImpl::SvxTextEditSourceImpl( SdrObject* pObject, SdrText* pText
if( !mpText )
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
if( pTextObj )
mpText = pTextObj->getText( 0 );
}
@@ -201,7 +201,7 @@ SvxTextEditSourceImpl::SvxTextEditSourceImpl( SdrObject& rObject, SdrText* pText
{
if( !mpText )
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
if( pTextObj )
mpText = pTextObj->getText( 0 );
}
@@ -441,7 +441,7 @@ void SvxTextEditSourceImpl::SetupOutliner()
if( !(mpObject && mpOutliner) )
return;
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
if( pTextObj )
{
tools::Rectangle aPaintRect;
@@ -462,7 +462,7 @@ void SvxTextEditSourceImpl::UpdateOutliner()
if( !(mpObject && mpOutliner) )
return;
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
if( pTextObj )
{
tools::Rectangle aPaintRect;
@@ -486,7 +486,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
{
if( mpOutliner == nullptr )
{
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
OutlinerMode nOutlMode = OutlinerMode::TextObject;
if( pTextObj && pTextObj->IsTextFrame() && pTextObj->GetTextKind() == SdrObjKind::OutlineText )
nOutlMode = OutlinerMode::OutlineObject;
@@ -536,7 +536,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
mpTextForwarder->flushCache();
std::optional<OutlinerParaObject> pOutlinerParaObject;
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
if( pTextObj && pTextObj->getActiveText() == mpText )
pOutlinerParaObject = pTextObj->CreateEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active
bool bOwnParaObj(false);
@@ -665,7 +665,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetTextForwarder()
{
assert(!mbForwarderIsEditMode); // because without a view there is no other option except !mbForwarderIsEditMode
bool bTextEditActive = false;
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(mpObject);
+ SdrTextObj* pTextObj = DynCastSdrTextObj(mpObject);
// similar to the GetBackgroundTextForwarder check, see if the text edit is active
if (pTextObj && pTextObj->getActiveText() == mpText && pTextObj->CanCreateEditOutlinerParaObject())
bTextEditActive = true; // text edit active
@@ -685,7 +685,7 @@ std::unique_ptr<SvxDrawOutlinerViewForwarder> SvxTextEditSourceImpl::CreateViewF
mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, SvxTextEditSourceImpl, NotifyHdl) );
mbNotifyEditOutlinerSet = true;
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
if( pTextObj )
{
tools::Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() );
@@ -736,7 +736,7 @@ SvxEditViewForwarder* SvxTextEditSourceImpl::GetEditViewForwarder( bool bCreate
if(mpView->SdrBeginTextEdit(mpObject))
{
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
if (pTextObj && pTextObj->IsTextEditActive())
{
// create new view forwarder
@@ -773,7 +773,7 @@ void SvxTextEditSourceImpl::UpdateData()
{
if( mpOutliner && mpObject && mpText )
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject );
+ SdrTextObj* pTextObj = DynCastSdrTextObj( mpObject );
if( pTextObj )
{
if( (mpOutliner->GetParagraphCount() == 1 && mpOutliner->GetEditEngine().GetTextLen( 0 ) == 0 )
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index feda2a494469..7d8f76698cb0 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -4932,7 +4932,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf137185)
auto xTextFrame = SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat);
CPPUNIT_ASSERT_EQUAL(OUString("Align me!"), xTextFrame->getText()->getString());
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ SdrTextObj* pTextObj = DynCastSdrTextObj(pObj);
CPPUNIT_ASSERT(pTextObj);
const auto& aOutStr = pTextObj->GetOutlinerParaObject()->GetTextObject();
diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx
index 990bb8a4732b..7f3098ef6672 100644
--- a/sw/source/core/doc/DocumentDrawModelManager.cxx
+++ b/sw/source/core/doc/DocumentDrawModelManager.cxx
@@ -309,7 +309,7 @@ bool DocumentDrawModelManager::Search(const SwPaM& rPaM, const SvxSearchItem& rS
// Does the shape have matching text?
SdrOutliner& rOutliner = GetDrawModel()->GetDrawOutliner();
SdrObject* pObject = const_cast<SdrObject*>(rFrameFormat.FindSdrObject());
- SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObject);
+ SdrTextObj* pTextObj = DynCastSdrTextObj(pObject);
if (!pTextObj)
continue;
const OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 5658d1075862..6c1af8270b65 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -186,7 +186,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, SdrObject* pObject, bool bCo
if (pObject)
{
- auto pSourceText = dynamic_cast<SdrTextObj*>(pObject);
+ auto pSourceText = DynCastSdrTextObj(pObject);
uno::Reference<text::XTextRange> xDestText(xRealTextFrame, uno::UNO_QUERY);
xDestText->setString(sCopyableText);
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index fe19106949b7..f1375a85eb45 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1616,13 +1616,12 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
//iterate inside of a grouped object
while(aListIter.IsMore())
{
- SdrObject* pSdrOElement = aListIter.Next();
- auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrOElement));
+ SdrTextObj* pTextObj = DynCastSdrTextObj(aListIter.Next());
if(pTextObj && pTextObj->HasText())
pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
}
}
- else if(auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrO)))
+ else if(SdrTextObj* pTextObj = DynCastSdrTextObj(pSdrO))
{
if(pTextObj->HasText())
pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 1b2b4ead071d..46e17971f5c7 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -3199,7 +3199,7 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect
pCaptionObj->SetTailPos(
aRect.TopLeft() - Point(aRect.GetWidth() / 2, aRect.GetHeight() / 2));
}
- else if(auto pText = dynamic_cast<SdrTextObj*>( pObj.get()))
+ else if(auto pText = DynCastSdrTextObj( pObj.get()))
{
pText->SetLogicRect(aRect);
diff --git a/sw/source/filter/indexing/IndexingExport.cxx b/sw/source/filter/indexing/IndexingExport.cxx
index 3839b5598875..13da0b722cf1 100644
--- a/sw/source/filter/indexing/IndexingExport.cxx
+++ b/sw/source/filter/indexing/IndexingExport.cxx
@@ -118,7 +118,7 @@ public:
m_rXmlWriter.endElement();
- SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pObject);
+ SdrTextObj* pTextObject = DynCastSdrTextObj(pObject);
if (!pTextObject)
return;
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 2820aa68eb89..05413a8d2eb6 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -587,7 +587,7 @@ sal_Int32 RtfSdrExport::StartShape()
}
}
- auto pTextObj = dynamic_cast<const SdrTextObj*>(m_pSdrObject);
+ auto pTextObj = DynCastSdrTextObj(m_pSdrObject);
if (pTextObj)
{
const OutlinerParaObject* pParaObj = nullptr;
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 60a77ead72c8..842bf958def4 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -2273,8 +2273,8 @@ bool WW8_WrPlcSubDoc::WriteGenericText( WW8Export& rWrt, sal_uInt8 nTTyp,
rWrt.GetOCXExp().ExportControl(rWrt, dynamic_cast<const SdrUnoObj&>(rObj));
rWrt.m_nTextTyp = nOldTyp;
}
- else if( dynamic_cast<const SdrTextObj*>( &rObj) != nullptr )
- rWrt.WriteSdrTextObj(dynamic_cast<const SdrTextObj&>(rObj), nTTyp);
+ else if( auto pText = DynCastSdrTextObj(&rObj) )
+ rWrt.WriteSdrTextObj(*pText, nTTyp);
else
{
const SwFrameFormat* pFormat = ::FindFrameFormat( &rObj );
@@ -2522,7 +2522,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
// is it a writer or sdr - textbox?
const SdrObject* pObj = static_cast<SdrObject const *>(m_aContent[ i ]);
sal_Int32 nCnt = 1;
- if (dynamic_cast< const SdrTextObj *>( pObj ))
+ if (DynCastSdrTextObj( pObj ))
{
// find the "highest" SdrObject of this
const SwFrameFormat& rFormat = *::FindFrameFormat( pObj );
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index d803e5619614..7fcbde440d68 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2880,7 +2880,7 @@ SwFrameFormat* SwWW8ImplReader::MungeTextIntoDrawBox(SvxMSDffImportRec& rRecord,
pThisGroup->GetSubList()->NbcInsertObject(pSdrTextObj.get());
}
else
- pSdrTextObj = dynamic_cast<SdrTextObj*>(rRecord.pObj.get());
+ pSdrTextObj = DynCastSdrTextObj(rRecord.pObj.get());
if( pSdrTextObj )
{
@@ -2976,7 +2976,7 @@ SwFlyFrameFormat* SwWW8ImplReader::ConvertDrawTextToFly(rtl::Reference<SdrObject
MatchSdrItemsIntoFlySet(rpObject.get(), rFlySet, rRecord.eLineStyle, rRecord.eLineDashing,
rRecord.eShapeType, aInnerDist);
- SdrTextObj *pSdrTextObj = dynamic_cast<SdrTextObj*>(rpObject.get());
+ SdrTextObj *pSdrTextObj = DynCastSdrTextObj(rpObject.get());
if (pSdrTextObj && pSdrTextObj->IsVerticalWriting())
rFlySet.Put(SvxFrameDirectionItem(SvxFrameDirection::Vertical_RL_TB, RES_FRAMEDIR));
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 700b2765e247..1d38928e0689 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -912,7 +912,7 @@ rtl::Reference<SdrObject> SwMSDffManager::ProcessObj(SvStream& rSt,
if (bVerticalText)
{
- SdrTextObj *pTextObj = dynamic_cast< SdrTextObj* >(pObj.get());
+ SdrTextObj *pTextObj = DynCastSdrTextObj(pObj.get());
if (pTextObj)
pTextObj->SetVerticalWriting(true);
}
diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
index 08b99101eee6..44e06191929a 100644
--- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
@@ -723,7 +723,7 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh)
if ( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- if( auto pSdrTextObj = dynamic_cast<SdrTextObj *>( pObj ) )
+ if( auto pSdrTextObj = DynCastSdrTextObj( pObj ) )
pCurrentTextObj = pSdrTextObj;
}
// at first fill the list of drawing objects
diff --git a/sw/source/uibase/ribbar/conrect.cxx b/sw/source/uibase/ribbar/conrect.cxx
index 837d5c3074d1..577ca06a4394 100644
--- a/sw/source/uibase/ribbar/conrect.cxx
+++ b/sw/source/uibase/ribbar/conrect.cxx
@@ -109,7 +109,7 @@ bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
}
else if(mbVertical)
{
- if (SdrTextObj* pText = dynamic_cast<SdrTextObj*>(pObj))
+ if (SdrTextObj* pText = DynCastSdrTextObj(pObj))
{
SfxItemSet aSet(pSdrView->GetModel()->GetItemPool());
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 0d235828e8e9..f539d5a2189e 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -599,7 +599,7 @@ void SwDrawShell::GetFormTextState(SfxItemSet& rSet)
if ( rMarkList.GetMarkCount() == 1 )
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
+ const SdrTextObj* pTextObj = DynCastSdrTextObj(pObj);
const bool bDeactivate(
!pObj ||
!pTextObj ||
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 776cd31c01da..8f86fb5fc9d1 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -234,7 +234,7 @@ void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet)
if ( rMarkList.GetMarkCount() == 1 )
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
+ const SdrTextObj* pTextObj = DynCastSdrTextObj(pObj);
const bool bDeactivate(
!pObj ||
!pTextObj ||
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 4925a137f06b..dc140402412b 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -480,9 +480,9 @@ bool SwView::EnterDrawTextMode(const Point& aDocPos)
{
// To allow SwDrawVirtObj text objects to be activated, allow their type, too.
auto pVirtObj = dynamic_cast<SwDrawVirtObj*>( pObj );
- if ( (pVirtObj && dynamic_cast< const SdrTextObj *>(&pVirtObj->GetReferencedObj() ) != nullptr &&
+ if ( (pVirtObj && DynCastSdrTextObj(&pVirtObj->GetReferencedObj() ) != nullptr &&
m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE) ||
- dynamic_cast< const SdrTextObj *>( pObj ) != nullptr )
+ DynCastSdrTextObj( pObj ) != nullptr )
{
// Refuse to edit editeng text of the shape if it has textbox attached.
if (!lcl_isTextBox(pObj))