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

2023-11-07 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 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

2023-07-06 Thread Skyler Grey (via logerrit)
 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

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 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"