From b624b13b3d5a8e573c7de8158cadc66b1982d157 Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 26 Mar 2021 13:35:54 +0200 Subject: loplugin:flatten Change-Id: Ib7a895fba66f8dc9b6501e61631c02694053b7fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113157 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svx/source/items/numfmtsh.cxx | 26 +++++++++++++------------- svx/source/svdraw/svdobj.cxx | 30 +++++++++++++++--------------- svx/source/svdraw/svdoole2.cxx | 40 ++++++++++++++++++++-------------------- 3 files changed, 48 insertions(+), 48 deletions(-) (limited to 'svx') diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 87fe7fa79b39..b38317f5c579 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -192,21 +192,21 @@ void SvxNumberFormatShell::LanguageChanged(LanguageType eLangType, short& rFmtSe void SvxNumberFormatShell::FormatChanged(sal_uInt16 nFmtLbPos, OUString& rPreviewStr, const Color*& rpFontColor) { - if (static_cast(nFmtLbPos) < aCurEntryList.size()) - { - nCurFormatKey = aCurEntryList[nFmtLbPos]; + if (static_cast(nFmtLbPos) >= aCurEntryList.size()) + return; - if (nCurFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND) - { - GetPreviewString_Impl(rPreviewStr, rpFontColor); - } - else if (nCurCategory == SvNumFormatType::CURRENCY) + nCurFormatKey = aCurEntryList[nFmtLbPos]; + + if (nCurFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND) + { + GetPreviewString_Impl(rPreviewStr, rpFontColor); + } + else if (nCurCategory == SvNumFormatType::CURRENCY) + { + if (static_cast(nFmtLbPos) < aCurrencyFormatList.size()) { - if (static_cast(nFmtLbPos) < aCurrencyFormatList.size()) - { - MakePrevStringFromVal(aCurrencyFormatList[nFmtLbPos], rPreviewStr, rpFontColor, - nValNum); - } + MakePrevStringFromVal(aCurrencyFormatList[nFmtLbPos], rPreviewStr, rpFontColor, + nValNum); } } } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 71272cb85a20..8b4dccd1c2e0 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1788,25 +1788,25 @@ void SdrObject::SetOutlinerParaObject(std::unique_ptr pTextO SendUserCall(SdrUserCallType::Resize,aBoundRect0); } - if (getSdrModelFromSdrObject().IsUndoEnabled()) + if (!getSdrModelFromSdrObject().IsUndoEnabled()) + return; + + // Don't do this during import. + SdrObject* pTopGroupObj = nullptr; + if (getParentSdrObjectFromSdrObject()) { - // Don't do this during import. - SdrObject* pTopGroupObj = nullptr; - if (getParentSdrObjectFromSdrObject()) - { - pTopGroupObj = getParentSdrObjectFromSdrObject(); - while (pTopGroupObj->getParentSdrObjectFromSdrObject()) - { - pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject(); - } - } - if (pTopGroupObj) + pTopGroupObj = getParentSdrObjectFromSdrObject(); + while (pTopGroupObj->getParentSdrObjectFromSdrObject()) { - // A shape was modified, which is in a group shape. Empty the group shape's grab-bag, - // which potentially contains the old text of the shapes in case of diagrams. - pTopGroupObj->SetGrabBagItem(uno::makeAny(uno::Sequence())); + pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject(); } } + if (pTopGroupObj) + { + // A shape was modified, which is in a group shape. Empty the group shape's grab-bag, + // which potentially contains the old text of the shapes in case of diagrams. + pTopGroupObj->SetGrabBagItem(uno::makeAny(uno::Sequence())); + } } void SdrObject::NbcSetOutlinerParaObject(std::unique_ptr /*pTextObject*/) diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 3e11292b40f1..15f612c1f4e7 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -726,28 +726,28 @@ SdrOle2Obj::SdrOle2Obj(SdrModel& rSdrModel, SdrOle2Obj const & rSource) mpImpl->mxGraphic.reset(new Graphic(*rSource.mpImpl->mxGraphic)); } - if( !IsEmptyPresObj() ) - { - ::comphelper::IEmbeddedHelper* pDestPers(getSdrModelFromSdrObject().GetPersist()); - ::comphelper::IEmbeddedHelper* pSrcPers(rSource.getSdrModelFromSdrObject().GetPersist()); - if( pDestPers && pSrcPers ) - { - DBG_ASSERT( !mpImpl->mxObjRef.is(), "Object already existing!" ); - comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer(); - uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName ); - if ( xObj.is() ) - { - OUString aTmp; - mpImpl->mxObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( - rContainer, xObj, aTmp, pSrcPers->getDocumentBaseURL(), pDestPers->getDocumentBaseURL()), rSource.GetAspect()); - mpImpl->mbTypeAsked = false; - mpImpl->aPersistName = aTmp; - CheckFileLink_Impl(); - } + if( IsEmptyPresObj() ) + return; - Connect(); - } + ::comphelper::IEmbeddedHelper* pDestPers(getSdrModelFromSdrObject().GetPersist()); + ::comphelper::IEmbeddedHelper* pSrcPers(rSource.getSdrModelFromSdrObject().GetPersist()); + if( !(pDestPers && pSrcPers) ) + return; + + DBG_ASSERT( !mpImpl->mxObjRef.is(), "Object already existing!" ); + comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer(); + uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName ); + if ( xObj.is() ) + { + OUString aTmp; + mpImpl->mxObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( + rContainer, xObj, aTmp, pSrcPers->getDocumentBaseURL(), pDestPers->getDocumentBaseURL()), rSource.GetAspect()); + mpImpl->mbTypeAsked = false; + mpImpl->aPersistName = aTmp; + CheckFileLink_Impl(); } + + Connect(); } SdrOle2Obj::SdrOle2Obj( -- cgit v1.2.3