sw/source/uibase/shells/grfsh.cxx | 39 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-)
New commits: commit 6c28e1f133c8f41728b810dee044ab38d26d21ce Author: Caolán McNamara <[email protected]> AuthorDate: Mon Jan 26 16:40:15 2026 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Feb 13 15:31:39 2026 +0100 make the writer CompressGraphicsDialog async Change-Id: I5d9b39ef2ca02d464a97f12149705667490bf583 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198161 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199326 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 75a1c9b0ffca..2a6b8fcad429 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -204,27 +204,32 @@ void SwGrfShell::Execute(SfxRequest &rReq) Graphic aGraphic = *pGraphic; - CompressGraphicsDialog aDialog(GetView().GetFrameWeld(), std::move(aGraphic), aSize, aCropRectangle, GetView().GetViewFrame().GetBindings()); - if (aDialog.run() == RET_OK) - { - rSh.StartAllAction(); - rSh.StartUndo(SwUndoId::START); - tools::Rectangle aScaledCropedRectangle = aDialog.GetScaledCropRectangle(); + auto xDialog = std::make_shared<CompressGraphicsDialog>(GetView().GetFrameWeld(), std::move(aGraphic), aSize, aCropRectangle, GetView().GetViewFrame().GetBindings()); + weld::DialogController::runAsync(xDialog, [this, xDialog, aCrop, aMirror](sal_uInt32 nResult) { + if (nResult == RET_OK) + { + SwWrtShell& rShell = GetShell(); - aCrop.SetLeft( o3tl::toTwips( aScaledCropedRectangle.Left(), o3tl::Length::mm100 )); - aCrop.SetTop( o3tl::toTwips( aScaledCropedRectangle.Top(), o3tl::Length::mm100 )); - aCrop.SetRight( o3tl::toTwips( aScaledCropedRectangle.Right(), o3tl::Length::mm100 )); - aCrop.SetBottom( o3tl::toTwips( aScaledCropedRectangle.Bottom(), o3tl::Length::mm100 )); + rShell.StartAllAction(); + rShell.StartUndo(SwUndoId::START); + tools::Rectangle aScaledCropedRectangle = xDialog->GetScaledCropRectangle(); - Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() ); - rSh.ReRead(OUString(), OUString(), &aCompressedGraphic); + SwCropGrf aNewCrop(aCrop); + aNewCrop.SetLeft(o3tl::toTwips( aScaledCropedRectangle.Left(), o3tl::Length::mm100)); + aNewCrop.SetTop(o3tl::toTwips( aScaledCropedRectangle.Top(), o3tl::Length::mm100)); + aNewCrop.SetRight(o3tl::toTwips( aScaledCropedRectangle.Right(), o3tl::Length::mm100)); + aNewCrop.SetBottom(o3tl::toTwips( aScaledCropedRectangle.Bottom(), o3tl::Length::mm100)); - rSh.SetAttrItem(aCrop); - rSh.SetAttrItem(aMirror); + Graphic aCompressedGraphic( xDialog->GetCompressedGraphic() ); + rShell.ReRead(OUString(), OUString(), &aCompressedGraphic); - rSh.EndUndo(SwUndoId::END); - rSh.EndAllAction(); - } + rShell.SetAttrItem(aNewCrop); + rShell.SetAttrItem(aMirror); + + rShell.EndUndo(SwUndoId::END); + rShell.EndAllAction(); + } + }); } } break;
