desktop/source/lib/init.cxx          |    4 +++
 sc/source/ui/app/inputwin.cxx        |   44 +++++++++++++++++++----------------
 sc/source/ui/inc/inputwin.hxx        |   10 ++++---
 vcl/inc/jsdialog/enabled.hxx         |    2 +
 vcl/inc/jsdialog/jsdialogbuilder.hxx |    5 +++
 vcl/jsdialog/enabled.cxx             |   14 +++++++++++
 vcl/jsdialog/jsdialogbuilder.cxx     |    9 +++++++
 vcl/source/window/builder.cxx        |    8 ++++--
 8 files changed, 70 insertions(+), 26 deletions(-)

New commits:
commit 767fc7cfe567c33e80f12cf19140dba8c586b377
Author:     Rashesh <[email protected]>
AuthorDate: Thu Oct 17 12:46:01 2024 +0530
Commit:     Szymon Kłos <[email protected]>
CommitDate: Fri Dec 20 21:30:01 2024 +0100

    sc: fix: unnecessary updates to ScPosWnd even if NamedRanges are same
    
    Change-Id: Idd32343f38d6294f5140835d99137dae9f1237ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175061
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>
    (cherry picked from commit 115776004c875b3a8a861d070129187c893b136a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177647
    Tested-by: Jenkins

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index f9d76b365959..feceafffbe2b 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -2334,19 +2334,13 @@ OUString 
ScPosWnd::createLocalRangeName(std::u16string_view rName, std::u16strin
 
 void ScPosWnd::FillRangeNames()
 {
-    m_xWidget->clear();
-    m_xWidget->freeze();
-
+    std::set<OUString> aSet;
     SfxObjectShell* pObjSh = SfxObjectShell::Current();
-    if ( auto pDocShell = dynamic_cast<ScDocShell*>( pObjSh) )
+    if (auto pDocShell = dynamic_cast<ScDocShell*>(pObjSh))
     {
         ScDocument& rDoc = pDocShell->GetDocument();
 
-        m_xWidget->append_text(ScResId(STR_MANAGE_NAMES));
-        m_xWidget->append_separator(u"separator"_ustr);
-
         ScRange aDummy;
-        std::set<OUString> aSet;
         ScRangeName* pRangeNames = rDoc.GetRangeName();
         for (const auto& rEntry : *pRangeNames)
         {
@@ -2367,14 +2361,24 @@ void ScPosWnd::FillRangeNames()
                 }
             }
         }
+    }
 
-        for (const auto& rItem : aSet)
-        {
-            m_xWidget->append_text(rItem);
-        }
+    if (aSet == aRangeNames && !aSet.empty())
+        return;
+
+    aRangeNames = aSet;
+
+    m_xWidget->clear();
+    m_xWidget->freeze();
+    m_xWidget->append_text(ScResId(STR_MANAGE_NAMES));
+    m_xWidget->append_separator(u"separator"_ustr);
+    for (const auto& rItem : aSet)
+    {
+        m_xWidget->append_text(rItem);
     }
     m_xWidget->thaw();
-    m_xWidget->set_entry_text(aPosStr);
+    if (!aPosStr.isEmpty())
+        m_xWidget->set_entry_text(aPosStr);
 }
 
 void ScPosWnd::FillFunctions()
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 832a37356424..1c5d5b73962f 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include <set>
 #include <vector>
 #include <memory>
 #include <vcl/customweld.hxx>
@@ -167,9 +168,10 @@ private:
 
     ImplSVEvent* m_nAsyncGetFocusId;
 
-    OUString        aPosStr;
-    void*           nTipVisible;
-    bool            bFormulaMode;
+    OUString aPosStr;
+    void* nTipVisible;
+    bool bFormulaMode;
+    std::set<OUString> aRangeNames;
 
 public:
     ScPosWnd(vcl::Window* pParent, ScTabViewShell* pViewSh);
commit 5e2bd2bb4c1a2f8a5467009b4ab7007401a14446
Author:     Rashesh <[email protected]>
AuthorDate: Thu Sep 26 16:39:55 2024 +0530
Commit:     Szymon Kłos <[email protected]>
CommitDate: Fri Dec 20 21:29:52 2024 +0100

    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]>
    (cherry picked from commit 9ffc274bbc414d1e98313af804386861beeff9bf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177645
    Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b7312be1772e..f858b9fdd22a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5206,6 +5206,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))
@@ -5217,6 +5219,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 b70a2d21aa90..f9d76b365959 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),
@@ -2253,8 +2252,9 @@ void ScTextWnd::TextGrabFocus()
 }
 
 // Position window
-ScPosWnd::ScPosWnd(vcl::Window* pParent)
-    : InterimItemWindow(pParent, u"modules/scalc/ui/posbox.ui"_ustr, 
u"PosBox"_ustr)
+ScPosWnd::ScPosWnd(vcl::Window* pParent, ScTabViewShell* pViewShell)
+    : InterimItemWindow(pParent, u"modules/scalc/ui/posbox.ui"_ustr, 
u"PosBox"_ustr, false,
+                        reinterpret_cast<sal_uInt64>(pViewShell))
     , m_xWidget(m_xBuilder->weld_combo_box(u"pos_window"_ustr))
     , m_nAsyncGetFocusId(nullptr)
     , nTipVisible(nullptr)
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index d98b5a85c56f..832a37356424 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -172,7 +172,7 @@ private:
     bool            bFormulaMode;
 
 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 70a867f0acb3..5c85f310f155 100644
--- a/vcl/inc/jsdialog/enabled.hxx
+++ b/vcl/inc/jsdialog/enabled.hxx
@@ -17,6 +17,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile);
 bool isBuilderEnabledForPopup(std::u16string_view rUIFile);
 bool isBuilderEnabledForMenu(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 d7fd64388b4b..e4456af57666 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -159,6 +159,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 cba8047ffd3d..5e25a9977518 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -422,6 +422,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 f4c0c60073e1..2d1c614e1d0c 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -356,6 +356,15 @@ JSInstanceBuilder::CreateFormulabarBuilder(vcl::Window* 
pParent, const OUString&
                                                u"formulabar");
 }
 
+std::unique_ptr<JSInstanceBuilder>
+JSInstanceBuilder::CreateAddressInputBuilder(vcl::Window* pParent, const 
OUString& rUIRoot,
+                                             const OUString& rUIFile, 
sal_uInt64 nLOKWindowId)
+{
+    return std::make_unique<JSInstanceBuilder>(nullptr, pParent, rUIRoot, 
rUIFile,
+                                               
JSInstanceBuilder::Type::Formulabar, nLOKWindowId,
+                                               u"addressinputfield");
+}
+
 JSInstanceBuilder::~JSInstanceBuilder()
 {
     // tab page closed -> refresh parent window
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 62469d222d82..ed59785cc791 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -207,8 +207,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);

Reply via email to