[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source vcl/jsdialog

2022-08-22 Thread Skyler Grey (via logerrit)
 sw/source/ui/dialog/swdlgfact.cxx |   22 +-
 sw/source/ui/dialog/swdlgfact.hxx |   14 +
 sw/source/uibase/shells/tabsh.cxx |   58 --
 vcl/jsdialog/enabled.cxx  |4 +-
 4 files changed, 69 insertions(+), 29 deletions(-)

New commits:
commit e6bfcb1e5d64d3cd76ede9019b4ddaac00159144
Author: Skyler Grey 
AuthorDate: Fri Aug 12 10:31:42 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Aug 22 14:46:14 2022 +0200

Make the number format dialog an async jsdialog

- The dialog needs to be async in order for multiple people to be able
  to use it at once
- If we don't make the item set a shared pointer, we will crash out with
  an error when we try to copy it after the OK button is pressed
- As the dialog is tabbed, we need to enable the dialog for all UI files
  that the dialog uses rather than just the main dialog UI file

Change-Id: I8d684e9e9ad49b8a85ee940864d7219b4115a6e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138270
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index ba883398486a..4c9eac2c2834 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -110,6 +110,16 @@ short SwAbstractSfxController_Impl::Execute()
 return m_xDlg->run();
 }
 
+short AbstractNumFormatDlg_Impl::Execute()
+{
+return m_xDlg->run();
+}
+
+bool AbstractNumFormatDlg_Impl::StartExecuteAsync(AsyncContext )
+{
+return SfxSingleTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractSwAsciiFilterDlg_Impl::Execute()
 {
 return m_xDlg->run();
@@ -356,11 +366,21 @@ const SfxItemSet* 
SwAbstractSfxController_Impl::GetOutputItemSet() const
 return m_xDlg->GetOutputItemSet();
 }
 
+const SfxItemSet* AbstractNumFormatDlg_Impl::GetOutputItemSet() const
+{
+return m_xDlg->GetOutputItemSet();
+}
+
 void SwAbstractSfxController_Impl::SetText(const OUString& rStr)
 {
 m_xDlg->set_title(rStr);
 }
 
+void AbstractNumFormatDlg_Impl::SetText(const OUString& rStr)
+{
+m_xDlg->set_title(rStr);
+}
+
 void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions )
 {
 m_xDlg->FillOptions(rOptions);
@@ -832,7 +852,7 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateSwBackgroundDialog
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateNumFormatDialog(weld::Widget* pParent, 
const SfxItemSet& rSet)
 {
-return 
VclPtr::Create(std::make_unique(pParent,
 rSet));
+return 
VclPtr::Create(std::make_shared(pParent,
 rSet));
 }
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg(weld::Window* pParent,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index b756a4de614e..ce809d3eaaa4 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -125,6 +125,20 @@ public:
 virtual void SetText(const OUString& rStr) override;
 };
 
+class AbstractNumFormatDlg_Impl : public SfxAbstractDialog
+{
+std::shared_ptr m_xDlg;
+public:
+explicit 
AbstractNumFormatDlg_Impl(std::shared_ptr p)
+: m_xDlg(std::move(p))
+{
+}
+virtual short Execute() override;
+virtual bool StartExecuteAsync(AsyncContext ) override;
+virtual const SfxItemSet* GetOutputItemSet() const override;
+virtual void SetText(const OUString& rStr) override;
+};
+
 class AbstractSwAsciiFilterDlg_Impl : public AbstractSwAsciiFilterDlg
 {
 std::unique_ptr m_xDlg;
diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 4d83dd1ec756..9fbd241f3f20 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -695,57 +695,61 @@ void SwTableShell::Execute(SfxRequest )
 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( 
pView) !=  nullptr );
 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< 
sal_uInt16 >(eMetric)));
 SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
-SfxItemSetFixed
-aCoreSet( GetPool() );
+auto pCoreSet = 
std::make_shared>( GetPool() );
 
 SfxItemSetFixed
- aBoxSet( *aCoreSet.GetPool() );
+ aBoxSet( *pCoreSet->GetPool() );
 rSh.GetTableBoxFormulaAttrs( aBoxSet );
 
 SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
 if(eState == SfxItemState::DEFAULT)
 {
-aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
+pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
 pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));
 }
 else
-aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
+

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source vcl/jsdialog

2022-08-21 Thread Skyler Grey (via logerrit)
 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 
AuthorDate: Wed Aug 17 13:17:25 2022 +0100
Commit: Szymon Kłos 
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 
Tested-by: Jenkins CollaboraOffice 

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(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;
 }


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source vcl/jsdialog

2022-08-21 Thread Skyler Grey (via logerrit)
 sw/source/ui/frmdlg/cption.cxx   |7 +++
 sw/source/uibase/inc/cption.hxx  |1 +
 sw/source/uibase/uiview/viewdlg2.cxx |   11 +++
 vcl/jsdialog/enabled.cxx |   10 --
 4 files changed, 19 insertions(+), 10 deletions(-)

New commits:
commit 6b36c22cd3197e79ac3420bdca98eb5574b64f81
Author: Skyler Grey 
AuthorDate: Fri Aug 19 12:23:20 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Aug 22 07:40:24 2022 +0200

Make the insert caption dialog an async jsdialog

- Using StartExecuteAsync instead of Execute to execute the dialog makes
  it run asyncly
- We need to add a handler for the OK button, otherwise the event won't
  be fired when it's clicked. There seem to be varying names for this
  throughout the codebase, I've chosen OKHdl as it's short, appears to
  be relatively common and fits well with the existing OptionHdl and
  CaptionHdl that the other buttons on the dialog use
- Lastly, we need to enable the JSDialog builder in
  vcl/jsdialog/enabled.cxx so that the dialog becomes a JSDialog

Still TODO:
- Convert the dialogs that open when you press "auto" or "options"
  buttons (will be in a followup review)

Change-Id: Ieabbc4e69c4aa065506f7dc6c823d83e4d784c2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138313
Reviewed-by: Szymon Kłos 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 867e16fa56dc..8d8752fb7783 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -137,6 +137,7 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, 
SwView )
 m_xSepEdit->connect_changed(aLk);
 
 m_xFormatBox->connect_changed(LINK(this, SwCaptionDialog, 
SelectListBoxHdl));
+m_xOKButton->connect_clicked(LINK(this, SwCaptionDialog, OKHdl));
 m_xOptionButton->connect_clicked(LINK(this, SwCaptionDialog, OptionHdl));
 m_xAutoCaptionButton->connect_clicked(LINK(this, SwCaptionDialog, 
CaptionHdl));
 
@@ -265,6 +266,12 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, 
SwView )
 DrawSample();
 }
 
+IMPL_LINK_NOARG(SwCaptionDialog, OKHdl, weld::Button&, void)
+{
+Apply();
+m_xDialog->response(RET_OK);
+}
+
 void SwCaptionDialog::Apply()
 {
 InsCaptionOpt aOpt;
diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx
index b442857a44b8..f5640d2b877b 100644
--- a/sw/source/uibase/inc/cption.hxx
+++ b/sw/source/uibase/inc/cption.hxx
@@ -64,6 +64,7 @@ class SwCaptionDialog final : public SfxDialogController
 DECL_LINK(ModifyComboHdl, weld::ComboBox&, void);
 DECL_LINK(OptionHdl, weld::Button&, void);
 DECL_LINK(CaptionHdl, weld::Button&, void);
+DECL_LINK(OKHdl, weld::Button&, void);
 
 void Apply();
 
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx 
b/sw/source/uibase/uiview/viewdlg2.cxx
index dd0da7acef95..c1131f1f590b 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -46,15 +46,18 @@
 
 using namespace css;
 
-void SwView::ExecDlgExt(SfxRequest const )
+void SwView::ExecDlgExt(SfxRequest const& rReq)
 {
-switch ( rReq.GetSlot() )
+switch (rReq.GetSlot())
 {
 case FN_INSERT_CAPTION:
 {
 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-ScopedVclPtr 
pDialog(pFact->CreateSwCaptionDialog(GetFrameWeld(), *this ));
-pDialog->Execute();
+VclPtr pDialog(
+pFact->CreateSwCaptionDialog(GetFrameWeld(), *this));
+pDialog->StartExecuteAsync([pDialog](sal_Int32) {
+pDialog->disposeOnce();
+});
 break;
 }
 case SID_INSERT_SIGNATURELINE:
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 7c1fe9b6f6b2..f608dad9f3e8 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -64,12 +64,10 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/swriter/ui/splittable.ui"
 || rUIFile == u"cui/ui/splitcellsdialog.ui"
 || rUIFile == u"sfx/ui/documentpropertiesdialog.ui"
-|| 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"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")
 {
 return true;
 }


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source vcl/jsdialog

2022-08-04 Thread Skyler Grey (via logerrit)
 sw/source/ui/dialog/swdlgfact.cxx |7 ++-
 sw/source/ui/dialog/swdlgfact.hxx |5 +++--
 sw/source/ui/table/splittbl.cxx   |   11 +--
 sw/source/uibase/inc/splittbl.hxx |   12 ++--
 sw/source/uibase/shells/tabsh.cxx |   18 ++
 vcl/jsdialog/enabled.cxx  |3 ++-
 6 files changed, 36 insertions(+), 20 deletions(-)

New commits:
commit bcabb3d1891fc67fb4e4b35642c2d55340994ecc
Author: Skyler Grey 
AuthorDate: Wed Aug 3 09:54:45 2022 +0100
Commit: Pedro Silva 
CommitDate: Thu Aug 4 10:24:55 2022 +0200

Turn the split table dialog into an async JSDialog

- Previously the split table dialog was not an async dialog, and it
  wasn't a JSDialog either
- A non-async dialog has issues when multiple people try to change
  something using the dialog at the same time. Generally the changes
  from one person will not be applied until all people who opened the
  dialog later than them have submitted
- This PR makes the dialog async, fixing multi-user issues with it
- This PR makes the dialog into a JSDialog, rendering it on the client
  with native HTML elements

Signed-off-by: Skyler Grey 
Change-Id: I9254bc1b635531c8b38d1ade76f99ffdda145b35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137741
Reviewed-by: Szymon Kłos 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 17f0ed1d3a03..ba883398486a 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -120,6 +120,11 @@ short AbstractSplitTableDialog_Impl::Execute()
 return m_xDlg->run();
 }
 
+bool AbstractSplitTableDialog_Impl::StartExecuteAsync(AsyncContext )
+{
+return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractSwTableWidthDlg_Impl::Execute()
 {
 return m_xDlg->run();
@@ -972,7 +977,7 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateSwSortingDialog(we
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSplitTableDialog(weld::Window *pParent, 
SwWrtShell )
 {
-return 
VclPtr::Create(std::make_unique(pParent,
 rSh));
+return 
VclPtr::Create(std::make_shared(pParent,
 rSh));
 }
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(weld::Window *pParent, 
const OUString )
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index 8690d9db8129..b756a4de614e 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -222,13 +222,14 @@ public:
 
 class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add 
for
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
-explicit AbstractSplitTableDialog_Impl(std::unique_ptr p)
+explicit AbstractSplitTableDialog_Impl(std::shared_ptr p)
 : m_xDlg(std::move(p))
 {
 }
 virtual short Execute() override;
+virtual bool  StartExecuteAsync(AsyncContext ) override;
 virtual SplitTable_HeadlineOption GetSplitMode() override;
 };
 
diff --git a/sw/source/ui/table/splittbl.cxx b/sw/source/ui/table/splittbl.cxx
index 0deb5d03093c..0af89a160121 100644
--- a/sw/source/ui/table/splittbl.cxx
+++ b/sw/source/ui/table/splittbl.cxx
@@ -28,21 +28,12 @@ SwSplitTableDlg::SwSplitTableDlg(weld::Window* pParent, 
SwWrtShell& rSh)
 , m_xBoxAttrCopyNoParaRB(m_xBuilder->weld_radio_button("customheading"))
 , m_xBorderCopyRB(m_xBuilder->weld_radio_button("noheading"))
 , rShell(rSh)
-, m_nSplit(SplitTable_HeadlineOption::ContentCopy)
 {
 }
 
 void SwSplitTableDlg::Apply()
 {
-m_nSplit = SplitTable_HeadlineOption::ContentCopy;
-if (m_xBoxAttrCopyWithParaRB->get_active())
-m_nSplit = SplitTable_HeadlineOption::BoxAttrAllCopy;
-else if (m_xBoxAttrCopyNoParaRB->get_active())
-m_nSplit = SplitTable_HeadlineOption::BoxAttrCopy;
-else if (m_xBorderCopyRB->get_active())
-m_nSplit = SplitTable_HeadlineOption::BorderCopy;
-
-rShell.SplitTable(m_nSplit);
+rShell.SplitTable(GetSplitMode());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/splittbl.hxx 
b/sw/source/uibase/inc/splittbl.hxx
index 99e61f7d4075..b826914e4720 100644
--- a/sw/source/uibase/inc/splittbl.hxx
+++ b/sw/source/uibase/inc/splittbl.hxx
@@ -34,7 +34,6 @@ private:
 std::unique_ptr m_xBorderCopyRB;
 
 SwWrtShell& rShell;
-SplitTable_HeadlineOption m_nSplit;
 
 void Apply();
 
@@ -49,7 +48,16 @@ public:
 return nRet;
 }
 
-SplitTable_HeadlineOption GetSplitMode() const { return m_nSplit; }
+SplitTable_HeadlineOption GetSplitMode() const {
+auto nSplit = SplitTable_HeadlineOption::ContentCopy;
+if (m_xBoxAttrCopyWithParaRB->get_active())
+nSplit = SplitTable_HeadlineOption::BoxAttrAllCopy;
+else if (m_xBoxAttrCopyNoParaRB->get_active())
+nSplit = SplitTable_HeadlineOption::BoxAttrCopy;

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source vcl/jsdialog

2022-06-16 Thread rash419 (via logerrit)
 sw/source/ui/misc/contentcontroldlg.cxx |5 -
 vcl/jsdialog/enabled.cxx|4 +++-
 2 files changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 8c53583faa493abf6cd7b2e56b5df7343e922133
Author: rash419 
AuthorDate: Wed Jun 15 17:23:44 2022 +0530
Commit: Miklos Vajna 
CommitDate: Thu Jun 16 15:02:13 2022 +0200

sw: jsdialog: enable contentcontrol and contentcontrollistitem dialogs

contentcontrol: fix: modify, remove, move up/down buttons doesnot work even 
if item is selected in jsdialog

Signed-off-by: rash419 
Change-Id: Ib038ce2a3ff6f92ab7314b18f36a038991a35f3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135902
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/ui/misc/contentcontroldlg.cxx 
b/sw/source/ui/misc/contentcontroldlg.cxx
index 95c86120e497..5e4347e62afb 100644
--- a/sw/source/ui/misc/contentcontroldlg.cxx
+++ b/sw/source/ui/misc/contentcontroldlg.cxx
@@ -374,11 +374,6 @@ IMPL_LINK_NOARG(SwContentControlDlg, MoveDownHdl, 
weld::Button&, void)
 
 IMPL_LINK_NOARG(SwContentControlDlg, SelectionChangedHdl, weld::TreeView&, 
void)
 {
-if (!m_xListItems->has_focus())
-{
-return;
-}
-
 int nRow = m_xListItems->get_selected_index();
 if (nRow < 0)
 {
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index f7849bb9e3e4..7984dab3d6f8 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -58,7 +58,9 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"xmlsec/ui/viewcertdialog.ui" || rUIFile == 
u"xmlsec/ui/certgeneral.ui"
 || rUIFile == u"xmlsec/ui/certpage.ui" || rUIFile == 
u"svx/ui/accessibilitycheckdialog.ui"
 || rUIFile == u"svx/ui/accessibilitycheckentry.ui"
-|| rUIFile == u"cui/ui/widgettestdialog.ui")
+|| rUIFile == u"cui/ui/widgettestdialog.ui"
+|| rUIFile == u"modules/swriter/ui/contentcontroldlg.ui"
+|| rUIFile == u"modules/swriter/ui/contentcontrollistitemdlg.ui")
 {
 return true;
 }