sw/source/ui/frmdlg/cption.cxx |   34 +++++++++++++++++++---------------
 vcl/jsdialog/enabled.cxx       |    3 ++-
 2 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 62a2c025eb9704dde8c78e86eef1231c2a6cdffc
Author:     Skyler Grey <[email protected]>
AuthorDate: Wed Aug 17 13:17:25 2022 +0100
Commit:     Szymon Kłos <[email protected]>
CommitDate: Mon Aug 22 07:40:50 2022 +0200

    Make the insert caption options an async jsdialog
    
    - In https://gerrit.libreoffice.org/c/core/+/138313, the insert caption
      dialog was converted to an async jsdialog. It has 2 subdialogs which
      it opens when you press the 'options' and 'auto' buttons
    - This review converts the first of these (the options dialog) to an
      async jsdialog as well, bringing it up to parity with the parent
      dialog
    
    Change-Id: I703b66d8c786d8cbb0b1285014247b38d8d70605
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138442
    Reviewed-by: Szymon Kłos <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 8d8752fb7783..f22e881a0210 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -311,21 +311,25 @@ IMPL_LINK_NOARG(SwCaptionDialog, OptionHdl, 
weld::Button&, void)
     OUString sFieldTypeName = m_xCategoryBox->get_active_text();
     if(sFieldTypeName == m_sNone)
         sFieldTypeName.clear();
-    SwSequenceOptionDialog aDlg(m_xDialog.get(), rView, sFieldTypeName);
-    aDlg.SetApplyBorderAndShadow(bCopyAttributes);
-    aDlg.SetCharacterStyle( sCharacterStyle );
-    aDlg.SetOrderNumberingFirst( bOrderNumberingFirst );
-    aDlg.run();
-    bCopyAttributes = aDlg.IsApplyBorderAndShadow();
-    sCharacterStyle = aDlg.GetCharacterStyle();
-    //#i61007# order of captions
-    if( bOrderNumberingFirst != aDlg.IsOrderNumberingFirst() )
-    {
-        bOrderNumberingFirst = aDlg.IsOrderNumberingFirst();
-        
SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst);
-        ApplyCaptionOrder();
-    }
-    DrawSample();
+    auto pDlg = std::make_shared<SwSequenceOptionDialog>(m_xDialog.get(), 
rView, sFieldTypeName);
+    pDlg->SetApplyBorderAndShadow(bCopyAttributes);
+    pDlg->SetCharacterStyle( sCharacterStyle );
+    pDlg->SetOrderNumberingFirst( bOrderNumberingFirst );
+
+    GenericDialogController::runAsync(pDlg, [pDlg, this](sal_Int32 nResult){
+        if (nResult == RET_OK) {
+            bCopyAttributes = pDlg->IsApplyBorderAndShadow();
+            sCharacterStyle = pDlg->GetCharacterStyle();
+            //#i61007# order of captions
+            if( bOrderNumberingFirst != pDlg->IsOrderNumberingFirst() )
+            {
+                bOrderNumberingFirst = pDlg->IsOrderNumberingFirst();
+                
SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst);
+                ApplyCaptionOrder();
+            }
+            DrawSample();
+        }
+    });
 }
 
 IMPL_LINK_NOARG(SwCaptionDialog, SelectListBoxHdl, weld::ComboBox&, void)
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index f608dad9f3e8..2b4e2fcf3957 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -67,7 +67,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
         || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == 
u"sfx/ui/cmisinfopage.ui"
         || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == 
u"sfx/ui/documentinfopage.ui"
         || rUIFile == u"sfx/ui/linefragment.ui" || rUIFile == 
u"sfx/ui/editdurationdialog.ui"
-        || rUIFile == u"modules/swriter/ui/insertcaption.ui")
+        || rUIFile == u"modules/swriter/ui/insertcaption.ui"
+        || rUIFile == u"modules/swriter/ui/captionoptions.ui")
     {
         return true;
     }

Reply via email to