sw/source/ui/dialog/uiregionsw.cxx |  102 ++++++++++++++++++-------------------
 vcl/jsdialog/enabled.cxx           |    1 
 2 files changed, 53 insertions(+), 50 deletions(-)

New commits:
commit 6aff11f36ecd02613c0613c9e89883c81656d9f6
Author:     Skyler Grey <skyler.g...@collabora.com>
AuthorDate: Sun Feb 19 13:13:05 2023 +0000
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Jul 6 11:48:41 2023 +0200

    Make the format > sections > options dialog a jsdialog
    
    - This dialog was not properly tunneled so did not show on collabora
      online
    - Running asynchronously as a jsdialog both fixes this issue and is a
      general improvement (in that jsdialog conversion improves
      accessability, looks more consistent with the rest of COOL, etc.)
    
    Note- This commit was previously given the Change-Id
          Ie9a70da70bbb30de039ded82f738285b1b734421 however I have replaced
          it due to accidentally creating it against the wrong base branch.
          To see the old change go to
          https://gerrit.libreoffice.org/c/core/+/147295
    
    Change-Id: I2715eb1d8e3e301e1519e2ef6b69c823e571d08c
    Signed-off-by: Skyler Grey <skyler.g...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151188
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/ui/dialog/uiregionsw.cxx 
b/sw/source/ui/dialog/uiregionsw.cxx
index f3560e8f2b67..89248e7eed8d 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -1048,57 +1048,59 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, 
weld::Button&, void)
     aSet.Put(SwFormatFrameSize(SwFrameSize::Variable, nWidth));
     aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
 
-    SwSectionPropertyTabDialog aTabDlg(m_xDialog.get(), aSet, m_rSh);
-    if (RET_OK != aTabDlg.run())
-        return;
-
-    const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
-    if( !(pOutSet && pOutSet->Count()) )
-        return;
-
-    const SwFormatCol* pColItem = pOutSet->GetItemIfSet(
-                            RES_COL, false );
-    const SvxBrushItem* pBrushItem = pOutSet->GetItemIfSet(
-                            RES_BACKGROUND, false );
-    const SwFormatFootnoteAtTextEnd* pFootnoteItem = pOutSet->GetItemIfSet(
-                            RES_FTN_AT_TXTEND, false );
-    const SwFormatEndAtTextEnd* pEndItem = pOutSet->GetItemIfSet(
-                            RES_END_AT_TXTEND, false );
-    const SwFormatNoBalancedColumns* pBalanceItem = pOutSet->GetItemIfSet(
-                            RES_COLUMNBALANCE, false );
-    const SvxFrameDirectionItem* pFrameDirItem = pOutSet->GetItemIfSet(
-                            RES_FRAMEDIR, false );
-    const SvxLRSpaceItem* pLRSpaceItem = pOutSet->GetItemIfSet(
-                            RES_LR_SPACE, false );
-
-    if( !(pColItem ||
-          pBrushItem ||
-          pFootnoteItem ||
-          pEndItem ||
-          pBalanceItem ||
-          pFrameDirItem ||
-          pLRSpaceItem) )
-        return;
-
-    m_xTree->selected_foreach([&](weld::TreeIter& rEntry)
-    {
-        SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
-        if (pColItem)
-            pRepr->GetCol() = *pColItem;
-        if (pBrushItem)
-            pRepr->GetBackground().reset(pBrushItem->Clone());
-        if (pFootnoteItem)
-            pRepr->GetFootnoteNtAtEnd() = *pFootnoteItem;
-        if (pEndItem)
-            pRepr->GetEndNtAtEnd() = *pEndItem;
-        if (pBalanceItem)
-            pRepr->GetBalance().SetValue(pBalanceItem->GetValue());
-        if (pFrameDirItem)
-            pRepr->GetFrameDir()->SetValue(pFrameDirItem->GetValue());
-        if (pLRSpaceItem)
-            pRepr->GetLRSpace().reset(pLRSpaceItem->Clone());
-        return false;
+    auto pDlg = std::make_shared<SwSectionPropertyTabDialog>(m_xDialog.get(), 
aSet, m_rSh);
+    SfxTabDialogController::runAsync(pDlg, [pDlg, this](sal_Int32 nResult){
+        if (nResult == RET_OK) {
+            const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+            if( !(pOutSet && pOutSet->Count()) )
+                return;
+
+            const SwFormatCol* pColItem = pOutSet->GetItemIfSet(
+                                    RES_COL, false );
+            const SvxBrushItem* pBrushItem = pOutSet->GetItemIfSet(
+                                    RES_BACKGROUND, false );
+            const SwFormatFootnoteAtTextEnd* pFootnoteItem = 
pOutSet->GetItemIfSet(
+                                    RES_FTN_AT_TXTEND, false );
+            const SwFormatEndAtTextEnd* pEndItem = pOutSet->GetItemIfSet(
+                                    RES_END_AT_TXTEND, false );
+            const SwFormatNoBalancedColumns* pBalanceItem = 
pOutSet->GetItemIfSet(
+                                    RES_COLUMNBALANCE, false );
+            const SvxFrameDirectionItem* pFrameDirItem = pOutSet->GetItemIfSet(
+                                    RES_FRAMEDIR, false );
+            const SvxLRSpaceItem* pLRSpaceItem = pOutSet->GetItemIfSet(
+                                    RES_LR_SPACE, false );
+
+            if( !(pColItem ||
+                  pBrushItem ||
+                  pFootnoteItem ||
+                  pEndItem ||
+                  pBalanceItem ||
+                  pFrameDirItem ||
+                  pLRSpaceItem) )
+                return;
+
+            m_xTree->selected_foreach([&](weld::TreeIter& rEntry)
+            {
+                SectRepr* pRepr = 
weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
+                if (pColItem)
+                    pRepr->GetCol() = *pColItem;
+                if (pBrushItem)
+                    pRepr->GetBackground().reset(pBrushItem->Clone());
+                if (pFootnoteItem)
+                    pRepr->GetFootnoteNtAtEnd() = *pFootnoteItem;
+                if (pEndItem)
+                    pRepr->GetEndNtAtEnd() = *pEndItem;
+                if (pBalanceItem)
+                    pRepr->GetBalance().SetValue(pBalanceItem->GetValue());
+                if (pFrameDirItem)
+                    pRepr->GetFrameDir()->SetValue(pFrameDirItem->GetValue());
+                if (pLRSpaceItem)
+                    pRepr->GetLRSpace().reset(pLRSpaceItem->Clone());
+                return false;
+            });
+        }
     });
+
 }
 
 IMPL_LINK(SwEditRegionDlg, FileNameComboBoxHdl, weld::ComboBox&, rEdit, void)
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index d2d304ce2014..885eeb520bb6 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -174,6 +174,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
         || rUIFile == u"modules/swriter/ui/footnoteareapage.ui"
         || rUIFile == u"modules/swriter/ui/footnotepage.ui"
         || rUIFile == u"modules/swriter/ui/footnotesendnotestabpage.ui"
+        || rUIFile == u"modules/swriter/ui/formatsectiondialog.ui"
         || rUIFile == u"modules/swriter/ui/formattablepage.ui"
         || rUIFile == u"modules/swriter/ui/frmaddpage.ui"
         || rUIFile == u"modules/swriter/ui/frmurlpage.ui"

Reply via email to