sw/source/uibase/shells/frmsh.cxx | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
New commits: commit b1be5fffeb2f845ad40d7f7ceff03f563ebcf8d4 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Mar 20 10:10:53 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Mar 21 17:06:44 2024 +0100 avoid O(n^2) loop in writer Change-Id: Iea5f98e5eb39fb6527be59f2f3dec89a41288a36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165045 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 05176a0980f0..2785f7133031 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -81,17 +81,6 @@ using namespace ::com::sun::star::uno; // Prototypes static void lcl_FrameGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine); -static const SwFrameFormat* lcl_GetFrameFormatByName(SwWrtShell const & rSh, std::u16string_view rName) -{ - const size_t nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM); - for( size_t i = 0; i < nCount; ++i ) - { - const SwFrameFormat* pFormat = rSh.GetFlyNum(i, FLYCNTTYPE_FRM); - if(pFormat->GetName() == rName) - return pFormat; - } - return nullptr; -} SFX_IMPL_INTERFACE(SwFrameShell, SwBaseShell) @@ -604,8 +593,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) if (!sPrevName.isEmpty()) { //needs cast - no non-const method available - SwFrameFormat* pPrevFormat = const_cast<SwFrameFormat*>( - lcl_GetFrameFormatByName(rSh, sPrevName)); + SwFrameFormat* pPrevFormat = rSh.GetDoc()->GetFlyFrameFormatByName(sPrevName); SAL_WARN_IF(!pPrevFormat, "sw.ui", "No frame found!"); if(pPrevFormat) { @@ -636,8 +624,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) if (!sNextName.isEmpty()) { //needs cast - no non-const method available - SwFrameFormat* pNextFormat = const_cast<SwFrameFormat*>( - lcl_GetFrameFormatByName(rSh, sNextName)); + SwFrameFormat* pNextFormat = rSh.GetDoc()->GetFlyFrameFormatByName(sNextName); SAL_WARN_IF(!pNextFormat, "sw.ui", "No frame found!"); if(pNextFormat) {