desktop/source/lib/init.cxx | 4 ++++ sc/source/ui/app/inputwin.cxx | 14 +++++++------- sc/source/ui/inc/inputwin.hxx | 2 +- vcl/inc/jsdialog/enabled.hxx | 2 ++ vcl/inc/jsdialog/jsdialogbuilder.hxx | 7 ++++++- vcl/jsdialog/enabled.cxx | 14 ++++++++++++++ vcl/jsdialog/jsdialogbuilder.cxx | 22 +++++++++++++++++----- vcl/source/window/builder.cxx | 8 ++++++-- 8 files changed, 57 insertions(+), 16 deletions(-)
New commits: commit 9ffc274bbc414d1e98313af804386861beeff9bf Author: Rashesh <[email protected]> AuthorDate: Thu Sep 26 16:39:55 2024 +0530 Commit: Szymon Kłos <[email protected]> CommitDate: Sat Oct 19 14:18:27 2024 +0200 cool#10115 sc: enable ScPosWnd for lokit with jsdialog Change-Id: I18829c48a2495e3aa31af83970c8c1c4791a170a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173987 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 62842df51cf8..01bc3b57a4c9 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5224,6 +5224,8 @@ static void lcl_sendDialogEvent(unsigned long long int nWindowId, const char* pA sWindowId = sCurrentShellId + "notebookbar"; if (nWindowId == static_cast<unsigned long long int>(-3)) sWindowId = sCurrentShellId + "formulabar"; + if (nWindowId == static_cast<unsigned long long int>(-4)) + sWindowId = sCurrentShellId + "addressinputfield"; // dialogs send own id but notebookbar and sidebar controls are remembered by SfxViewShell id if (jsdialog::ExecuteAction(sWindowId, sControlId, aMap)) @@ -5235,6 +5237,8 @@ static void lcl_sendDialogEvent(unsigned long long int nWindowId, const char* pA return; if (jsdialog::ExecuteAction(sCurrentShellId + "formulabar", sControlId, aMap)) return; + if (jsdialog::ExecuteAction(sCurrentShellId + "addressinputfield", sControlId, aMap)) + return; // this is needed for dialogs shown before document is loaded: MacroWarning dialog, etc... // these dialogs are created with WindowId "0" if (!SfxViewShell::Current() && jsdialog::ExecuteAction(u"0"_ustr, sControlId, aMap)) diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 3395c1a5fe84..6261437a35e8 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -144,7 +144,7 @@ SfxChildWinInfo ScInputWindowWrapper::GetInfo() const } -static VclPtr<ScInputBarGroup> lcl_chooseRuntimeImpl( vcl::Window* pParent, const SfxBindings* pBind ) +static ScTabViewShell* lcl_chooseRuntimeImpl( const SfxBindings* pBind ) { ScTabViewShell* pViewSh = nullptr; SfxDispatcher* pDisp = pBind->GetDispatcher(); @@ -154,15 +154,14 @@ static VclPtr<ScInputBarGroup> lcl_chooseRuntimeImpl( vcl::Window* pParent, cons if ( pViewFrm ) pViewSh = dynamic_cast<ScTabViewShell*>( pViewFrm->GetViewShell() ); } - - return VclPtr<ScInputBarGroup>::Create( pParent, pViewSh ); + return pViewSh; } ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) : // With WB_CLIPCHILDREN otherwise we get flickering ToolBox ( pParent, WinBits(WB_CLIPCHILDREN | WB_BORDER | WB_NOSHADOW) ), - aWndPos ( !comphelper::LibreOfficeKit::isActive() ? VclPtr<ScPosWnd>::Create(this) : nullptr ), - mxTextWindow ( lcl_chooseRuntimeImpl( this, pBind ) ), + aWndPos ( VclPtr<ScPosWnd>::Create( this, lcl_chooseRuntimeImpl(pBind)) ), + mxTextWindow ( VclPtr<ScInputBarGroup>::Create( this, lcl_chooseRuntimeImpl(pBind)) ), pInputHdl ( nullptr ), mpViewShell ( nullptr ), mnMaxY (0), @@ -2254,8 +2253,9 @@ void ScTextWnd::TextGrabFocus() } // Position window -ScPosWnd::ScPosWnd(vcl::Window* pParent) - : InterimItemWindow(pParent, "modules/scalc/ui/posbox.ui", "PosBox") +ScPosWnd::ScPosWnd(vcl::Window* pParent, ScTabViewShell* pViewShell) + : InterimItemWindow(pParent, "modules/scalc/ui/posbox.ui", "PosBox", false, + reinterpret_cast<sal_uInt64>(pViewShell)) , m_xWidget(m_xBuilder->weld_combo_box("pos_window")) , m_nAsyncGetFocusId(nullptr) , nTipVisible(nullptr) diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx index ee1a6151a0e0..1c5d5b73962f 100644 --- a/sc/source/ui/inc/inputwin.hxx +++ b/sc/source/ui/inc/inputwin.hxx @@ -174,7 +174,7 @@ private: std::set<OUString> aRangeNames; public: - ScPosWnd( vcl::Window* pParent ); + ScPosWnd(vcl::Window* pParent, ScTabViewShell* pViewSh); virtual ~ScPosWnd() override; virtual void dispose() override; diff --git a/vcl/inc/jsdialog/enabled.hxx b/vcl/inc/jsdialog/enabled.hxx index 6354b70a8de7..422a8d80fb50 100644 --- a/vcl/inc/jsdialog/enabled.hxx +++ b/vcl/inc/jsdialog/enabled.hxx @@ -16,6 +16,8 @@ namespace jsdialog bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile); bool isBuilderEnabledForPopup(std::u16string_view rUIFile); bool isBuilderEnabledForSidebar(std::u16string_view rUIFile); +bool isBuilderEnabledForAddressInput(std::u16string_view rUIFile); +bool isBuilderEnabledForFormulabar(std::u16string_view rUIFile); bool isInterimBuilderEnabledForNotebookbar(std::u16string_view rUIFile); } diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 0008f9f5fda9..7d327c76a363 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -259,7 +259,7 @@ public: sal_uInt64 nWindowId = 0); /// used for formulabar JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, - sal_uInt64 nLOKWindowId); + sal_uInt64 nLOKWindowId, const OUString& sTypeOfJSON); static std::unique_ptr<JSInstanceBuilder> CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); @@ -278,6 +278,11 @@ public: const OUString& rUIFile, sal_uInt64 nLOKWindowId); + static std::unique_ptr<JSInstanceBuilder> CreateAddressInputBuilder(vcl::Window* pParent, + const OUString& rUIRoot, + const OUString& rUIFile, + sal_uInt64 nLOKWindowId); + virtual ~JSInstanceBuilder() override; virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OUString& id) override; virtual std::unique_ptr<weld::Dialog> weld_dialog(const OUString& id) override; diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index c932806820fb..d8803bd46945 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -412,6 +412,20 @@ bool isInterimBuilderEnabledForNotebookbar(std::u16string_view rUIFile) return false; } + +bool isBuilderEnabledForAddressInput(std::u16string_view rUIFile) +{ + if (rUIFile == u"modules/scalc/ui/posbox.ui") + return true; + return false; +} + +bool isBuilderEnabledForFormulabar(std::u16string_view rUIFile) +{ + if (rUIFile == u"modules/scalc/ui/inputbar.ui") + return true; + return false; +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index d68a52b7e441..bc5d7d21fd57 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -489,8 +489,10 @@ void JSDropTarget::fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEn OUString JSInstanceBuilder::getMapIdFromWindowId() const { if (m_sTypeOfJSON == "sidebar" || m_sTypeOfJSON == "notebookbar" - || m_sTypeOfJSON == "formulabar") + || m_sTypeOfJSON == "formulabar" || m_sTypeOfJSON == "addressinputfield") + { return OUString::number(m_nWindowId) + m_sTypeOfJSON; + } else return OUString::number(m_nWindowId); } @@ -604,14 +606,15 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); } -// used for formulabar +// used for formulabar and addressinputfield JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, - const OUString& rUIFile, sal_uInt64 nLOKWindowId) + const OUString& rUIFile, sal_uInt64 nLOKWindowId, + const OUString& sTypeOfJSON) : SalInstanceBuilder(pParent, rUIRoot, rUIFile) , m_nWindowId(nLOKWindowId) , m_aParentDialog(nullptr) , m_aContentWindow(nullptr) - , m_sTypeOfJSON("formulabar") + , m_sTypeOfJSON(sTypeOfJSON) , m_bHasTopLevelDialog(false) , m_bIsNotebookbar(false) , m_bSentInitialUpdate(false) @@ -662,7 +665,16 @@ std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateFormulabarBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, sal_uInt64 nLOKWindowId) { - return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, nLOKWindowId); + return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, nLOKWindowId, + "formulabar"); +} + +std::unique_ptr<JSInstanceBuilder> +JSInstanceBuilder::CreateAddressInputBuilder(vcl::Window* pParent, const OUString& rUIRoot, + const OUString& rUIFile, sal_uInt64 nLOKWindowId) +{ + return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, nLOKWindowId, + "addressinputfield"); } JSInstanceBuilder::~JSInstanceBuilder() diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index bc307ba85561..6344cd8e8871 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -205,8 +205,12 @@ std::unique_ptr<weld::Builder> Application::CreateInterimBuilder(vcl::Window* pP // Notebookbar sub controls if (jsdialog::isInterimBuilderEnabledForNotebookbar(rUIFile)) return JSInstanceBuilder::CreateNotebookbarBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile, css::uno::Reference<css::frame::XFrame>(), nLOKWindowId); - else if (rUIFile == u"modules/scalc/ui/inputbar.ui") - return JSInstanceBuilder::CreateFormulabarBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile, nLOKWindowId); + else if (jsdialog::isBuilderEnabledForFormulabar(rUIFile)) + return JSInstanceBuilder::CreateFormulabarBuilder(pParent, AllSettings::GetUIRootDir(), + rUIFile, nLOKWindowId); + else if (jsdialog::isBuilderEnabledForAddressInput(rUIFile)) + return JSInstanceBuilder::CreateAddressInputBuilder( + pParent, AllSettings::GetUIRootDir(), rUIFile, nLOKWindowId); } return ImplGetSVData()->mpDefInst->CreateInterimBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile, bAllowCycleFocusOut, nLOKWindowId);
