[Libreoffice-commits] core.git: sw/source vcl/jsdialog

2023-11-06 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/shells/textsh.cxx |   71 +++--
 vcl/jsdialog/enabled.cxx   |1 
 2 files changed, 39 insertions(+), 33 deletions(-)

New commits:
commit 35925357f86e01612df28a092d71b6e216195636
Author: Miklos Vajna 
AuthorDate: Mon Nov 6 14:45:39 2023 +0100
Commit: Miklos Vajna 
CommitDate: Mon Nov 6 18:29:06 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

Change-Id: I97aad336b613d105f380012f8c79e92d89c583ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158978
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/source/uibase/shells/textsh.cxx 
b/sw/source/uibase/shells/textsh.cxx
index 76e0bc0a3511..c9e0e8a4d6f9 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -527,51 +527,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 =
+GetView().GetViewFrame().GetBindings().GetRecorder();
+if ( xRecorder.is() 

[Libreoffice-commits] core.git: sw/source vcl/jsdialog

2023-07-07 Thread Szymon Kłos (via logerrit)
 sw/source/ui/misc/titlepage.cxx|1 +
 sw/source/uibase/inc/titlepage.hxx |1 +
 vcl/jsdialog/enabled.cxx   |1 +
 3 files changed, 3 insertions(+)

New commits:
commit cc397d753936745fccaa1780a5e3cdd2c2d596bf
Author: Szymon Kłos 
AuthorDate: Fri Jun 16 18:30:35 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri Jul 7 09:54:01 2023 +0200

jsdialog: enable Insert Title Page dialog

we need to weld also RB_INSERT_NEW_PAGES so
when we check it - JSDialog executor will make
it active and RB_USE_EXISTING_PAGES inactive

Change-Id: I0abc5b6610e301abb1d24ecea680f63358dc5584
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153189
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153987
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx
index 4308c8db246d..0d8c776cce64 100644
--- a/sw/source/ui/misc/titlepage.cxx
+++ b/sw/source/ui/misc/titlepage.cxx
@@ -150,6 +150,7 @@ SwTitlePageDlg::SwTitlePageDlg(weld::Window *pParent)
 , mpIndexDesc(nullptr)
 , mpNormalDesc(nullptr)
 , 
m_xUseExistingPagesRB(m_xBuilder->weld_radio_button("RB_USE_EXISTING_PAGES"))
+, m_xInsertNewPagesRB(m_xBuilder->weld_radio_button("RB_INSERT_NEW_PAGES"))
 , m_xPageCountNF(m_xBuilder->weld_spin_button("NF_PAGE_COUNT"))
 , m_xDocumentStartRB(m_xBuilder->weld_radio_button("RB_DOCUMENT_START"))
 , m_xPageStartRB(m_xBuilder->weld_radio_button("RB_PAGE_START"))
diff --git a/sw/source/uibase/inc/titlepage.hxx 
b/sw/source/uibase/inc/titlepage.hxx
index 9e8c58984652..13f167786339 100644
--- a/sw/source/uibase/inc/titlepage.hxx
+++ b/sw/source/uibase/inc/titlepage.hxx
@@ -31,6 +31,7 @@ private:
 const SwPageDesc* mpNormalDesc;
 
 std::unique_ptr m_xUseExistingPagesRB;
+std::unique_ptr m_xInsertNewPagesRB; // required by LOK 
JSDialogs
 std::unique_ptr m_xPageCountNF;
 std::unique_ptr m_xDocumentStartRB;
 std::unique_ptr m_xPageStartRB;
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 171294bf5372..d58839e33af7 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -200,6 +200,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/swriter/ui/templatedialog2.ui"
 || rUIFile == u"modules/swriter/ui/templatedialog8.ui"
 || rUIFile == u"modules/swriter/ui/textgridpage.ui"
+|| rUIFile == u"modules/swriter/ui/titlepage.ui"
 || rUIFile == u"modules/swriter/ui/tocdialog.ui"
 || rUIFile == u"modules/swriter/ui/tocentriespage.ui"
 || rUIFile == u"modules/swriter/ui/tocindexpage.ui"


[Libreoffice-commits] core.git: sw/source vcl/jsdialog

2023-05-03 Thread Pranam Lashkari (via logerrit)
 sw/source/ui/dialog/wordcountdialog.cxx |4 ++--
 vcl/jsdialog/enabled.cxx|1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit a4e8c663b613fcd2ec26211faedb6e703f27806b
Author: Pranam Lashkari 
AuthorDate: Tue Apr 4 14:52:26 2023 +0100
Commit: Pranam Lashkari 
CommitDate: Wed May 3 20:46:27 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 
(cherry picked from commit e7bcf7aa95a31dcefc82f56b23a36424353016c3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151280
Tested-by: Jenkins
Reviewed-by: Pranam Lashkari 

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 0ed9c299bc00..86528c4c6ca8 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -198,6 +198,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"


[Libreoffice-commits] core.git: sw/source vcl/jsdialog

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

New commits:
commit b5d3a3ac031d055e433eb2b79b48f6d00fb0e0d6
Author: Skyler Grey 
AuthorDate: Wed Aug 3 09:54:45 2022 +0100
Commit: Szymon Kłos 
CommitDate: Sun Nov 20 10:40:49 2022 +0100

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 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142972
Tested-by: Jenkins

diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 6e9ebc873ab7..68135716fcb9 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();
@@ -978,7 +983,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 f97ff430c294..c0326249a15b 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -236,13 +236,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/uibase/inc/splittbl.hxx 
b/sw/source/uibase/inc/splittbl.hxx
index 8c8891c1df1b..0311f08d4043 100644
--- a/sw/source/uibase/inc/splittbl.hxx
+++ b/sw/source/uibase/inc/splittbl.hxx
@@ -49,7 +49,17 @@ 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;
+else if (m_xBorderCopyRB->get_active())
+nSplit = SplitTable_HeadlineOption::BorderCopy;
+return nSplit;
+}
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 01bd9389c152..ab93b027e69f 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -1082,10 +1082,20 @@ void SwTableShell::Execute(SfxRequest )
 else
 {
 SwAbstractDialogFactory* pFact = 
SwAbstractDialogFactory::Create();
-ScopedVclPtr 
pDlg(pFact->CreateSplitTableDialog(GetView().GetFrameWeld(), rSh));
-pDlg->Execute();
-rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, 
static_cast(pDlg->GetSplitMode()) ) );
-bCallDone = true;
+VclPtr 
pDlg(pFact->CreateSplitTableDialog(GetView().GetFrameWeld(), rSh));
+
+SwWrtShell* pSh = 
+
+pDlg->StartExecuteAsync([pDlg, pSh](int nResult) {
+if (nResult == RET_OK)
+{
+const auto aSplitMode = 

[Libreoffice-commits] core.git: sw/source vcl/jsdialog

2022-11-20 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 67160035d65f9b43b8483e5900d2a2812e1bbecc
Author: rash419 
AuthorDate: Wed Jun 15 17:23:44 2022 +0530
Commit: Szymon Kłos 
CommitDate: Sun Nov 20 10:40:33 2022 +0100

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 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142971
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sw/source/ui/misc/contentcontroldlg.cxx 
b/sw/source/ui/misc/contentcontroldlg.cxx
index ec45e87066c4..799f722945ff 100644
--- a/sw/source/ui/misc/contentcontroldlg.cxx
+++ b/sw/source/ui/misc/contentcontroldlg.cxx
@@ -400,11 +400,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 6ba2adc8b1fc..efb87ac0b9fe 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -61,7 +61,9 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"xmlsec/ui/certpage.ui" || rUIFile == 
u"svx/ui/accessibilitycheckdialog.ui"
 || rUIFile == u"modules/swriter/ui/translationdialog.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;
 }