diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-07 18:41:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-08 07:40:01 +0100 |
commit | c7b898df4d452746399621f6adc8e7da088f0f3a (patch) | |
tree | eb4cb09ceef899c3015724b6d3f81f1e8a4a6ce1 /sd | |
parent | 04e7a34a19b3658de57c4f2b3b0fa8445b01f199 (diff) |
clean up some more dynamic/static casting
using a hacked version of the staticdynamic plugin
and some judgement
Change-Id: I5e6668b19320025e419f84bebceade4239577729
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112137
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/drawdoc.cxx | 23 | ||||
-rw-r--r-- | sd/source/core/sdpage.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/app/sdxfer.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/fupoor.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/func/futext.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/sdview2.cxx | 8 |
6 files changed, 26 insertions, 25 deletions
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index c257fa909ae2..48769e0b88da 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -887,19 +887,20 @@ void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool } } - if( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr && pObj->IsEmptyPresObj()) - { - PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj); - OUString aString( pPage->GetPresObjText(ePresObjKind) ); - - if (!aString.isEmpty()) + if( auto pTextObj = dynamic_cast<SdrTextObj *>( pObj ) ) + if (pTextObj->IsEmptyPresObj()) { - SdOutliner* pInternalOutl = GetInternalOutliner(); - pPage->SetObjText( static_cast<SdrTextObj*>(pObj), pInternalOutl, ePresObjKind, aString ); - pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( ePresObjKind ), true ); - pInternalOutl->Clear(); + PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj); + OUString aString( pPage->GetPresObjText(ePresObjKind) ); + + if (!aString.isEmpty()) + { + SdOutliner* pInternalOutl = GetInternalOutliner(); + pPage->SetObjText( pTextObj, pInternalOutl, ePresObjKind, aString ); + pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( ePresObjKind ), true ); + pInternalOutl->Clear(); + } } - } } } } diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 5f8280dd8f51..2be8b854a23c 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -439,12 +439,12 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t InsertObject(pSdrObj); - if ( dynamic_cast< const SdrTextObj *>( pSdrObj ) != nullptr ) + if ( auto pTextObj = dynamic_cast<SdrTextObj *>( pSdrObj ) ) { // Tell the object EARLY that it is vertical to have the // defaults for AutoGrowWidth/Height reversed if(bVertical) - static_cast<SdrTextObj*>(pSdrObj)->SetVerticalWriting(true); + pTextObj->SetVerticalWriting(true); SfxItemSet aTempAttr(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool()); if( bVertical ) @@ -1543,7 +1543,7 @@ static void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDe if( pPersist ) { uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer(). - GetEmbeddedObject( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() ); + GetEmbeddedObject( pOle2->GetPersistName() ); // TODO CL->KA: Why is this not working anymore? if( xObject.is() ) diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 1b8698d0f6a1..6a5476f84886 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -158,7 +158,7 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj ) uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY ); if( xObj.is() && xPersist.is() && xPersist->hasEntry() ) { - mpOLEDataHelper.reset( new TransferableDataHelper( new SvEmbedTransferHelper( xObj, static_cast< SdrOle2Obj* >( pObj )->GetGraphic(), static_cast< SdrOle2Obj* >( pObj )->GetAspect() ) ) ); + mpOLEDataHelper.reset( new TransferableDataHelper( new SvEmbedTransferHelper( xObj, pOleObj->GetGraphic(), pOleObj->GetAspect() ) ) ); // TODO/LATER: the standalone handling of the graphic should not be used any more in future // The EmbedDataHelper should bring the graphic in future diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx index 7d1728be115e..817d0f8c6014 100644 --- a/sd/source/ui/func/fupoor.cxx +++ b/sd/source/ui/func/fupoor.cxx @@ -194,7 +194,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) { SdrObject* pObj = aIter.Next(); - if(dynamic_cast< const SdrTextObj *>( pObj )) + if(auto pTextObj = dynamic_cast<SdrTextObj *>( pObj )) { SdrInventor nInv(pObj->GetObjInventor()); sal_uInt16 nKnd(pObj->GetObjIdentifier()); @@ -202,7 +202,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) if(SdrInventor::Default == nInv && (OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd)) { - pCandidate = static_cast<SdrTextObj*>(pObj); + pCandidate = pTextObj; } } } @@ -824,14 +824,14 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) { SdrObject* pObj = aIter.Next(); - if(dynamic_cast< const SdrTextObj *>( pObj )) + if(auto pTextObj = dynamic_cast< SdrTextObj *>( pObj )) { SdrInventor nInv(pObj->GetObjInventor()); sal_uInt16 nKnd(pObj->GetObjIdentifier()); if(SdrInventor::Default == nInv && OBJ_TITLETEXT == nKnd) { - pCandidate = static_cast<SdrTextObj*>(pObj); + pCandidate = pTextObj; } } } diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index db565991a74c..be5a00c89c44 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -264,11 +264,11 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt) { const SvxFieldData* pField = pFieldItem->GetField(); - if (pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr) + if (auto pURLField = dynamic_cast< const SvxURLField *>( pField )) { eHit = SdrHitKind::MarkedObject; aVEvt.eEvent = SdrEventKind::ExecuteUrl; - aVEvt.pURLField = static_cast<const SvxURLField*>(pField); + aVEvt.pURLField = pURLField; } } } diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index f71246ea651e..5b7ba59e8e60 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -108,7 +108,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat { SdrObject* pObj = GetMarkedObjectByIndex(0); - if( auto pOle2Obj = dynamic_cast< const SdrOle2Obj *>( pObj ) ) + if( auto pOle2Obj = dynamic_cast<SdrOle2Obj *>( pObj ) ) if( pOle2Obj->GetObjRef() ) { // If object has no persistence it must be copied as part of the document @@ -116,7 +116,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat { uno::Reference< embed::XEmbedPersist > xPersObj( pOle2Obj->GetObjRef(), uno::UNO_QUERY ); if ( xPersObj.is() && xPersObj->hasEntry() ) - pSdrOleObj = static_cast<SdrOle2Obj*>(pObj); + pSdrOleObj = pOle2Obj; } catch( uno::Exception& ) {} @@ -154,7 +154,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateDragDataObje { SdrObject* pObj = GetMarkedObjectByIndex( 0 ); - if( auto pOle2Obj = dynamic_cast< const SdrOle2Obj *>( pObj ) ) + if( auto pOle2Obj = dynamic_cast<SdrOle2Obj *>( pObj ) ) if( pOle2Obj->GetObjRef() ) { // If object has no persistence it must be copied as part of the document @@ -162,7 +162,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateDragDataObje { uno::Reference< embed::XEmbedPersist > xPersObj( pOle2Obj->GetObjRef(), uno::UNO_QUERY ); if ( xPersObj.is() && xPersObj->hasEntry() ) - pSdrOleObj = static_cast<SdrOle2Obj*>(pObj); + pSdrOleObj = pOle2Obj; } catch( uno::Exception& ) {} |