core.git: Branch 'distro/collabora/co-23.05' - sw/source vcl/jsdialog
sw/source/ui/dialog/swdlgfact.cxx|5 + sw/source/ui/dialog/swdlgfact.hxx|1 + sw/source/ui/dialog/uiregionsw.cxx |7 +-- sw/source/uibase/dialog/regionsw.cxx | 16 +--- vcl/jsdialog/enabled.cxx |1 + 5 files changed, 21 insertions(+), 9 deletions(-) New commits: commit 803d572838d8075e79d001fe6548f45878ea466f Author: Méven Car AuthorDate: Tue Jan 9 15:15:23 2024 +0100 Commit: Miklos Vajna CommitDate: Fri Jan 12 10:38:57 2024 +0100 cool#1770 sw: make Edit Sections dialog async and mark it a jsdialog We want our dialogs to be async so they don't lock documents when opened and to allow concurrent edition. In SwEditRegionDlg, we need to make sure the reference to the SwWrtShell isn't read from 'this' after `response()`, as it is now the dialog is disposed of earlier in the async case. How to test: Create a new Writer document, insert a section, right-click inside the section, pick the 'edit section' menu item to trigger this dialog. Change-Id: Ibafca69542f13d16beef5a8fca006428cbcfe5c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161828 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index f9e05b3f0d35..8c6cabae64cc 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -302,6 +302,11 @@ short AbstractEditRegionDlg_Impl::Execute() return m_xDlg->run(); } +bool AbstractEditRegionDlg_Impl::StartExecuteAsync(AsyncContext ) +{ +return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short AbstractInsertSectionTabDialog_Impl::Execute() { return m_xDlg->run(); diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 359af1bc2e31..e0f21d170b57 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -644,6 +644,7 @@ public: { } virtual short Execute() override; +virtual bool StartExecuteAsync(AsyncContext ) override; virtual voidSelectSection(const OUString& rSectionName) override; }; diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 89248e7eed8d..b3dff074fdc1 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -818,12 +818,15 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void) aOrigArray.clear(); +SwWrtShell& rSh = m_rSh; + // response must be called ahead of EndAction's end, // otherwise ScrollError can occur. m_xDialog->response(RET_OK); -m_rSh.EndUndo(); -m_rSh.EndAllAction(); +// accessing 'this' after response isn't safe, as the callback might cause the dialog to be disposed +rSh.EndUndo(); +rSh.EndAllAction(); } // Toggle protect diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx index 834f1b332bc5..ad020e28b92d 100644 --- a/sw/source/uibase/dialog/regionsw.cxx +++ b/sw/source/uibase/dialog/regionsw.cxx @@ -218,15 +218,17 @@ void SwBaseShell::EditRegionDialog(SfxRequest const & rReq) case FN_EDIT_CURRENT_REGION: { weld::Window* pParentWin = GetView().GetFrameWeld(); + +SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); +VclPtr pEditRegionDlg(pFact->CreateEditRegionDlg(pParentWin, rWrtShell)); + +if(auto pStringItem = dynamic_cast< const SfxStringItem *>( pItem )) { -SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); -ScopedVclPtr pEditRegionDlg(pFact->CreateEditRegionDlg(pParentWin, rWrtShell)); -if(auto pStringItem = dynamic_cast< const SfxStringItem *>( pItem )) -{ -pEditRegionDlg->SelectSection(pStringItem->GetValue()); -} -pEditRegionDlg->Execute(); +pEditRegionDlg->SelectSection(pStringItem->GetValue()); } +pEditRegionDlg->StartExecuteAsync([pEditRegionDlg](sal_Int32 /*nResult */){ +pEditRegionDlg->disposeOnce(); +}); } break; } diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index 058880a97835..c8ed0d73efad 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -178,6 +178,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"modules/swriter/ui/contentcontrollistitemdlg.ui" || rUIFile == u"modules/swriter/ui/dropcapspage.ui" || rUIFile == u"modules/swriter/ui/dropdownfielddialog.ui" +|| rUIFile == u"modules/swriter/ui/editsectiondialog.ui" || rUIFile == u"modules/swriter/ui/endnotepage.ui" || rUIFile == u"modules/swriter/ui/footendnotedialog.ui" || rUIFile ==
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source vcl/jsdialog
sw/source/uibase/shells/textsh.cxx | 71 +++-- vcl/jsdialog/enabled.cxx |1 2 files changed, 39 insertions(+), 33 deletions(-) New commits: commit 355681eead2411d70caf4f52f1b802cf8c61a981 Author: Miklos Vajna AuthorDate: Mon Nov 6 14:45:39 2023 +0100 Commit: Caolán McNamara CommitDate: Tue Nov 7 12:58:37 2023 +0100 sw floattable: make Insert Frame dialog async and mark it as a jsdialog - with this, once a LOK client dispatches .uno:InsertFrame, we don't open two dialogs (one tunelled, one jsdialog) - all the tabpages were already allowed as jsdialogs, the tabpages don't open any unwanted file picker (hyperlink browse button, area -> image -> import button) - switching to async means we can't work with the original SfxRequest (which is no longer there by the time the callback is invoked), but 057eca05f23d9d15465e591bd0da671735d62d50 (sc: convert optimal width/height and normal width/height dialog to async, 2022-04-12) shows we can re-create the SfxRequest after the fact, do the same here - similar problem with SwFlyFrameAttrMgr, but looks like the SwFlyFrameAttrMgr before launching the dialog doesn't share state with the SwFlyFrameAttrMgr after the dialog is gone, so work with two instances here (cherry picked from commit 35925357f86e01612df28a092d71b6e216195636) Change-Id: I97aad336b613d105f380012f8c79e92d89c583ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159053 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 807ee76859e9..a8d24351cdbf 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -526,51 +526,56 @@ void SwTextShell::ExecInsert(SfxRequest ) FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( GetView().GetDocShell()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); -ScopedVclPtr pDlg(pFact->CreateFrameTabDialog("FrameDialog", +VclPtr pDlg(pFact->CreateFrameTabDialog("FrameDialog", GetView().GetViewFrame(), GetView().GetFrameWeld(), aSet)); -if(pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet()) -{ -//local variable necessary at least after call of .AutoCaption() because this could be deleted at this point -SwWrtShell& rShell = GetShell(); -rShell.LockPaint(LockPaintReason::InsertFrame); -rShell.StartAllAction(); -rShell.StartUndo(SwUndoId::INSERT); +pDlg->StartExecuteAsync([pDlg, nSlot, this](sal_Int32 nResult) { +if (nResult == RET_OK && pDlg->GetOutputItemSet()) +{ +SwFlyFrameAttrMgr aAttrMgr( true, GetShellPtr(), Frmmgr_Type::TEXT, nullptr ); +//local variable necessary at least after call of .AutoCaption() because this could be deleted at this point +SwWrtShell& rShell = GetShell(); +rShell.LockPaint(LockPaintReason::InsertFrame); +rShell.StartAllAction(); +rShell.StartUndo(SwUndoId::INSERT); -const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); -aMgr.SetAttrSet(*pOutSet); +const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); +aAttrMgr.SetAttrSet(*pOutSet); -// At first delete the selection at the ClickToEditField. -if( rShell.IsInClickToEdit() ) -rShell.DelRight(); +// At first delete the selection at the ClickToEditField. +if( rShell.IsInClickToEdit() ) +rShell.DelRight(); -aMgr.InsertFlyFrame(); +aAttrMgr.InsertFlyFrame(); -uno::Reference< frame::XDispatchRecorder > xRecorder = -GetView().GetViewFrame()->GetBindings().GetRecorder(); -if ( xRecorder.is() ) -{ -//FN_INSERT_FRAME -sal_uInt16 nAnchor = static_cast(aMgr.GetAnchor()); -rReq.AppendItem(SfxUInt16Item(nSlot, nAnchor)); -rReq.AppendItem(SfxPointItem(FN_PARAM_1, rShell.GetObjAbsPos())); -rReq.AppendItem(SvxSizeItem(FN_PARAM_2, rShell.GetObjSize())); -rReq.Done(); -} +uno::Reference< frame::XDispatchRecorder > xRecorder = +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source vcl/jsdialog
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 AuthorDate: Sun Feb 19 13:13:05 2023 + Commit: Szymon Kłos 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 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151188 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice 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(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(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( +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source vcl/jsdialog
sw/source/ui/dialog/wordcountdialog.cxx |4 ++-- vcl/jsdialog/enabled.cxx|1 + 2 files changed, 3 insertions(+), 2 deletions(-) New commits: commit e7bcf7aa95a31dcefc82f56b23a36424353016c3 Author: Pranam Lashkari AuthorDate: Tue Apr 4 14:52:26 2023 +0100 Commit: Szymon Kłos CommitDate: Wed May 3 09:59:23 2023 +0200 jsdialog: enabled word count dialog (writer) set mobile fields visibility only with mobile phones Change-Id: I5680effe9df5de01221bcf52e339490aa5dd5a6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150024 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx index 6dbd3c780ac4..a96e1c50b3be 100644 --- a/sw/source/ui/dialog/wordcountdialog.cxx +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -87,7 +87,7 @@ void SwWordCountFloatDlg::showCJK(bool bShowCJK) { m_xCurrentCjkcharsFT->set_visible(bShowCJK); m_xDocCjkcharsFT->set_visible(bShowCJK); -if (m_xCjkcharsLabelFT2) +if (IS_MOBILE_PHONE && m_xCjkcharsLabelFT2) m_xCjkcharsLabelFT2->set_visible(bShowCJK); m_xCjkcharsLabelFT->set_visible(bShowCJK); } @@ -96,7 +96,7 @@ void SwWordCountFloatDlg::showStandardizedPages(bool bShowStandardizedPages) { m_xCurrentStandardizedPagesFT->set_visible(bShowStandardizedPages); m_xDocStandardizedPagesFT->set_visible(bShowStandardizedPages); -if (m_xStandardizedPagesLabelFT2) +if (IS_MOBILE_PHONE && m_xStandardizedPagesLabelFT2) m_xStandardizedPagesLabelFT2->set_visible(bShowStandardizedPages); m_xStandardizedPagesLabelFT->set_visible(bShowStandardizedPages); } diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index d620b537c93c..0fd8f6e94293 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -199,6 +199,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"modules/swriter/ui/tocstylespage.ui" || rUIFile == u"modules/swriter/ui/translationdialog.ui" || rUIFile == u"modules/swriter/ui/watermarkdialog.ui" +|| rUIFile == u"modules/swriter/ui/wordcount.ui" // sfx || rUIFile == u"sfx/ui/cmisinfopage.ui" || rUIFile == u"sfx/ui/custominfopage.ui"