diff options
Diffstat (limited to 'sd')
35 files changed, 109 insertions, 109 deletions
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) |