sc/source/ui/view/tabvwsha.cxx |   25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

New commits:
commit fdaec96c0fd6ab0c1dddeadd64e942248daa722e
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Feb 9 14:36:34 2026 +0000
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Feb 11 17:09:56 2026 +0100

    make new style by example async
    
    Change-Id: I9b82bc24b53cd558a8bfe5fa2c1deaac010ca21c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199002
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index d1daae5fb1fa..ee8446ce3774 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -1058,6 +1058,13 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq )
         case SID_STYLE_SHOW:
         case SID_STYLE_NEW_BY_EXAMPLE:
             {
+                auto lambda = [pStylePool, nSlotId, xOldData, xNewData, 
eFamily, this](SfxRequest& rRequest, const OUString& rStyleName)
+                {
+                    SfxStyleSheetBase* pApplyStyleSheet = 
pStylePool->Find(rStyleName, eFamily);
+                    xOldData->InitFromStyle(pApplyStyleSheet);
+                    ExecuteApplyStyle(rRequest, pStylePool, pApplyStyleSheet, 
nSlotId, rStyleName, xOldData, xNewData, eFamily);
+                };
+
                 const SfxPoolItem* pNameItem;
                 if (pArgs && SfxItemState::SET == pArgs->GetItemState(nSlotId, 
true, &pNameItem))
                     aStyleName = static_cast<const 
SfxStringItem*>(pNameItem)->GetValue();
@@ -1066,15 +1073,21 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq )
                     weld::Window* pDialogParent = rReq.GetFrameWeld();
                     if (!pDialogParent)
                         pDialogParent = GetFrameWeld();
+
                     SfxNewStyleDlg aDlg(pDialogParent, *pStylePool, eFamily);
-                    if (aDlg.run() != RET_OK)
-                        return;
-                    aStyleName = aDlg.GetName();
+                    auto xDlg = 
std::make_shared<SfxNewStyleDlg>(pDialogParent, *pStylePool, eFamily);
+                    auto xRequest = std::make_shared<SfxRequest>(rReq);
+                    rReq.Ignore();
+                    weld::GenericDialogController::runAsync(xDlg,[xDlg, 
xRequest, lambda](sal_Int32 nResult){
+                        if (nResult == RET_OK) {
+                            lambda(*xRequest, xDlg->GetName());
+                        }
+                    });
+                    return;
                 }
 
-                pStyleSheet = pStylePool->Find( aStyleName, eFamily );
-
-                xOldData->InitFromStyle( pStyleSheet );
+                lambda(rReq, aStyleName);
+                return;
             }
             break;
 

Reply via email to