sw/source/uibase/shells/grfsh.cxx | 39 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-)
New commits: commit 39c50e27975155379e870ff0386c8760f527fbd5 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Jan 26 16:40:15 2026 +0000 Commit: Miklos Vajna <[email protected]> CommitDate: Tue Jan 27 11:34:10 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]> diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 75c13f0c6765..cf18ffd88ef2 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -206,27 +206,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(), const_cast<const Graphic*>(&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(), const_cast<const Graphic*>(&aCompressedGraphic)); - rSh.EndUndo(SwUndoId::END); - rSh.EndAllAction(); - } + rShell.SetAttrItem(aNewCrop); + rShell.SetAttrItem(aMirror); + + rShell.EndUndo(SwUndoId::END); + rShell.EndAllAction(); + } + }); } } break;
