[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - include/sfx2 officecfg/registry sfx2/Library_sfx.mk sfx2/sdi sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 2 13:43:27 UTC 2021


Rebased ref, commits from common ancestor:
commit f3e939a81eacf5d816213c8d7bf390f63a50f687
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue May 22 14:44:39 2018 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Tue Mar 2 22:42:29 2021 +0900

    Command Popup
    
    Change-Id: I92cdd3130b8de42ee0863c9e7154e7c7246d9377

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 3f9d4a232fb7..e2a9a8cdaab6 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -385,7 +385,7 @@ class SvxSearchItem;
 
 // default-ids for windows
 
-// free                                     (SID_SFX_START + 610)
+#define SID_COMMAND_POPUP                   (SID_SFX_START + 610)
 #define SID_NEWWINDOW                       (SID_SFX_START + 620)
 #define SID_CLOSEWIN                        (SID_SFX_START + 621)
 #define SID_VIEWSHELL                       (SID_SFX_START + 623)
diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
index 967aa98a04db..8f95ee9125aa 100644
--- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
@@ -313,6 +313,12 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some emoji thing
           <value xml:lang="en-US" install:module="unxwnt">.uno:OptionsTreeDialog</value>
         </prop>
       </node>
+      <node oor:name="F1_MOD1" oor:op="replace">
+        <prop oor:name="Command">
+          <value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
+          <value xml:lang="en-US">.uno:CommandPopup</value>
+        </prop>
+      </node>
     </node>
     <node oor:name="Modules">
       <node oor:name="com.sun.star.script.BasicIDE" oor:op="replace">
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 756bdd288b91..ad77ca0a19a5 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6537,6 +6537,14 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:CommandPopup" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Command Popup</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:DevelopmentToolsDockingWindow" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Development Tool</value>
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index b5126ca87893..941b11e59f94 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -291,6 +291,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/styles/StyleManager \
     sfx2/source/toolbox/tbxitem \
     sfx2/source/toolbox/weldutils \
+    sfx2/source/view/CommandPopup \
     sfx2/source/view/classificationcontroller \
     sfx2/source/view/classificationhelper \
     sfx2/source/view/frame \
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index 7bdbd7a85a1e..ec80ab16de65 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
 	sfx2/uiconfig/ui/classificationbox \
 	sfx2/uiconfig/ui/cmisinfopage \
 	sfx2/uiconfig/ui/cmisline \
+	sfx2/uiconfig/ui/commandpopup \
 	sfx2/uiconfig/ui/custominfopage \
 	sfx2/uiconfig/ui/decktitlebar \
 	sfx2/uiconfig/ui/descriptioninfopage \
diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi
index 09aafef95b7d..a7c8a472e73d 100644
--- a/sfx2/sdi/frmslots.sdi
+++ b/sfx2/sdi/frmslots.sdi
@@ -262,6 +262,11 @@ interface TopWindow : BrowseWindow
         ExecMethod = MiscExec_Impl ;
         StateMethod = MiscState_Impl ;
     ]
+    SID_COMMAND_POPUP
+    [
+        ExecMethod = MiscExec_Impl ;
+        StateMethod = MiscState_Impl ;
+    ]
     SID_CLOSEWIN // ole(no) api(final/play/rec)
     [
         ExecMethod = Exec_Impl ;
@@ -307,4 +312,3 @@ shell SfxViewFrame
         StateMethod = GetState_Impl ;
     ]
 }
-
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 425724440d13..85523a6f0b46 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -1271,6 +1271,23 @@ SfxStringItem FullName SID_DOCFULLNAME
     GroupId = ;
 ]
 
+SfxVoidItem CommandPopup SID_COMMAND_POPUP
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = TRUE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::View;
+]
 
 SfxBoolItem FullScreen SID_WIN_FULLSCREEN
 
diff --git a/sfx2/source/view/CommandPopup.cxx b/sfx2/source/view/CommandPopup.cxx
new file mode 100644
index 000000000000..d44613280b65
--- /dev/null
+++ b/sfx2/source/view/CommandPopup.cxx
@@ -0,0 +1,308 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "CommandPopup.hxx"
+
+#include <vcl/layout.hxx>
+#include <workwin.hxx>
+#include <sfx2/msgpool.hxx>
+#include <sfx2/bindings.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/dispatchcommand.hxx>
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
+#include <com/sun/star/frame/theUICommandDescription.hpp>
+#include <com/sun/star/ui/theUICategoryDescription.hpp>
+
+#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+#include <vcl/commandinfoprovider.hxx>
+
+using namespace css;
+
+struct CurrentEntry
+{
+    OUString m_aCommandURL;
+    OUString m_aTooltip;
+
+    CurrentEntry(OUString const& rCommandURL, OUString const& rTooltip)
+        : m_aCommandURL(rCommandURL)
+        , m_aTooltip(rTooltip)
+    {
+    }
+};
+
+struct MenuContent
+{
+    OUString m_aCommandURL;
+    OUString m_aMenuLabel;
+    OUString m_aFullLabelWithPath;
+    OUString m_aTooltip;
+    std::vector<MenuContent> m_aSubMenuContent;
+};
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
+
+class MenuContentHandler
+{
+private:
+    css::uno::Reference<css::frame::XFrame> m_xFrame;
+    MenuContent m_aMenuContent;
+    OUString m_sModuleLongName;
+
+public:
+    MenuContentHandler(uno::Reference<frame::XFrame> const& xFrame)
+        : m_xFrame(xFrame)
+        , m_sModuleLongName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame))
+    {
+        auto xComponentContext = comphelper::getProcessComponentContext();
+
+        uno::Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleConfigSupplier;
+        xModuleConfigSupplier.set(
+            ui::theModuleUIConfigurationManagerSupplier::get(xComponentContext));
+
+        uno::Reference<ui::XUIConfigurationManager> xConfigurationManager;
+        xConfigurationManager = xModuleConfigSupplier->getUIConfigurationManager(m_sModuleLongName);
+
+        uno::Reference<container::XIndexAccess> xConfigData;
+        xConfigData = xConfigurationManager->getSettings("private:resource/menubar/menubar", false);
+
+        gatherMenuContent(xConfigData, m_aMenuContent);
+    }
+
+    void gatherMenuContent(uno::Reference<container::XIndexAccess> const& xIndexAccess,
+                           MenuContent& rMenuContent)
+    {
+        for (sal_Int32 n = 0; n < xIndexAccess->getCount(); n++)
+        {
+            MenuContent aNewContent;
+            uno::Sequence<beans::PropertyValue> aProperties;
+            uno::Reference<container::XIndexAccess> xIndexContainer;
+
+            if (!(xIndexAccess->getByIndex(n) >>= aProperties))
+                continue;
+
+            bool bIsVisible = true;
+            bool bIsEnabled = true;
+
+            for (auto const& rProperty : aProperties)
+            {
+                OUString aPropertyName = rProperty.Name;
+                if (aPropertyName == "CommandURL")
+                    rProperty.Value >>= aNewContent.m_aCommandURL;
+                else if (aPropertyName == "ItemDescriptorContainer")
+                    rProperty.Value >>= xIndexContainer;
+                else if (aPropertyName == "IsVisible")
+                    rProperty.Value >>= bIsVisible;
+                else if (aPropertyName == "Enabled")
+                    rProperty.Value >>= bIsEnabled;
+            }
+
+            if (!bIsEnabled || !bIsVisible)
+                continue;
+
+            auto aCommandProperties = vcl::CommandInfoProvider::GetCommandProperties(
+                aNewContent.m_aCommandURL, m_sModuleLongName);
+            OUString aLabel = vcl::CommandInfoProvider::GetLabelForCommand(aCommandProperties);
+            aNewContent.m_aMenuLabel = aLabel;
+
+            if (!rMenuContent.m_aFullLabelWithPath.isEmpty())
+                aNewContent.m_aFullLabelWithPath = rMenuContent.m_aFullLabelWithPath + " / ";
+            aNewContent.m_aFullLabelWithPath += aNewContent.m_aMenuLabel;
+
+            aNewContent.m_aTooltip = vcl::CommandInfoProvider::GetTooltipForCommand(
+                aNewContent.m_aCommandURL, aCommandProperties, m_xFrame);
+
+            if (xIndexContainer.is())
+                gatherMenuContent(xIndexContainer, aNewContent);
+
+            rMenuContent.m_aSubMenuContent.push_back(aNewContent);
+        }
+    }
+
+    void findInMenu(OUString const& rText, std::unique_ptr<weld::TreeView>& rpCommandTreeView,
+                    std::vector<CurrentEntry>& rCommandList)
+    {
+        findInMenuRecursive(m_aMenuContent, rText, rpCommandTreeView, rCommandList);
+    }
+
+private:
+    void findInMenuRecursive(MenuContent const& rMenuContent, OUString const& rText,
+                             std::unique_ptr<weld::TreeView>& rpCommandTreeView,
+                             std::vector<CurrentEntry>& rCommandList)
+    {
+        for (MenuContent const& aSubContent : rMenuContent.m_aSubMenuContent)
+        {
+            if (aSubContent.m_aMenuLabel.toAsciiLowerCase().startsWith(rText))
+            {
+                OUString sCommandURL = aSubContent.m_aCommandURL;
+                util::URL aCommandURL;
+                aCommandURL.Complete = sCommandURL;
+                uno::Reference<uno::XComponentContext> xContext
+                    = comphelper::getProcessComponentContext();
+                uno::Reference<util::XURLTransformer> xParser
+                    = util::URLTransformer::create(xContext);
+                xParser->parseStrict(aCommandURL);
+
+                auto* pViewFrame = SfxViewFrame::Current();
+
+                SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
+                const SfxSlot* pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
+                if (pSlot)
+                {
+                    std::unique_ptr<SfxPoolItem> pState;
+                    SfxItemState eState
+                        = pViewFrame->GetBindings().QueryState(pSlot->GetSlotId(), pState);
+
+                    if (eState != SfxItemState::DISABLED)
+                    {
+                        auto xGraphic = vcl::CommandInfoProvider::GetXGraphicForCommand(sCommandURL,
+                                                                                        m_xFrame);
+                        rCommandList.emplace_back(sCommandURL, aSubContent.m_aTooltip);
+
+                        auto pIter = rpCommandTreeView->make_iterator();
+                        rpCommandTreeView->insert(nullptr, -1, &aSubContent.m_aFullLabelWithPath,
+                                                  nullptr, nullptr, nullptr, false, pIter.get());
+                        rpCommandTreeView->set_image(*pIter, xGraphic);
+                    }
+                }
+            }
+            findInMenuRecursive(aSubContent, rText, rpCommandTreeView, rCommandList);
+        }
+    }
+};
+
+CommandListBox::CommandListBox(vcl::Window* pParent, CommandPopup& rPopUp,
+                               uno::Reference<frame::XFrame> const& xFrame)
+    : InterimItemWindow(pParent, "sfx/ui/commandpopup.ui", "CommandBox")
+    , m_rPopUp(rPopUp)
+    , m_pEntry(m_xBuilder->weld_entry("command_entry"))
+    , m_pCommandTreeView(m_xBuilder->weld_tree_view("command_treeview"))
+    , m_pMenuContentHandler(std::make_unique<MenuContentHandler>(xFrame))
+{
+    m_pEntry->connect_changed(LINK(this, CommandListBox, ModifyHdl));
+    m_pEntry->connect_key_press(LINK(this, CommandListBox, TreeViewKeyPress));
+    m_pCommandTreeView->connect_query_tooltip(LINK(this, CommandListBox, QueryTooltip));
+    m_pCommandTreeView->connect_row_activated(LINK(this, CommandListBox, RowActivated));
+}
+
+void CommandListBox::initialize()
+{
+    Size aSize(400, 400);
+    SetSizePixel(aSize);
+    m_rPopUp.SetSizePixel(aSize);
+    Size aFrameSize = m_rPopUp.GetParent()->GetOutputSizePixel();
+    m_rPopUp.StartPopupMode(tools::Rectangle(Point(aFrameSize.Width(), 0), Size(0, 0)),
+                            FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus);
+
+    Show();
+    GrabFocus();
+    m_pEntry->grab_focus();
+}
+
+void CommandListBox::dispose()
+{
+    m_pEntry.reset();
+    m_pCommandTreeView.reset();
+
+    InterimItemWindow::dispose();
+}
+
+IMPL_LINK_NOARG(CommandListBox, QueryTooltip, const weld::TreeIter&, OUString)
+{
+    size_t nSelected = m_pCommandTreeView->get_selected_index();
+    if (nSelected < m_aCommandList.size())
+    {
+        auto const& rCurrent = m_aCommandList[nSelected];
+        return rCurrent.m_aTooltip;
+    }
+    return OUString();
+}
+
+IMPL_LINK_NOARG(CommandListBox, RowActivated, weld::TreeView&, bool)
+{
+    OUString aCommandURL;
+    int nSelected = m_pCommandTreeView->get_selected_index();
+    if (nSelected < int(m_aCommandList.size()))
+    {
+        auto const& rCurrent = m_aCommandList[nSelected];
+        aCommandURL = rCurrent.m_aCommandURL;
+    }
+    dispatchCommandAndClose(aCommandURL);
+    return true;
+}
+
+IMPL_LINK(CommandListBox, TreeViewKeyPress, const KeyEvent&, rKeyEvent, bool)
+{
+    if (rKeyEvent.GetKeyCode().GetCode() == KEY_DOWN || rKeyEvent.GetKeyCode().GetCode() == KEY_UP)
+    {
+        int nDirection = rKeyEvent.GetKeyCode().GetCode() == KEY_DOWN ? 1 : -1;
+        int nNewIndex = m_pCommandTreeView->get_selected_index() + nDirection;
+        nNewIndex = std::clamp(nNewIndex, 0, m_pCommandTreeView->n_children());
+        m_pCommandTreeView->select(nNewIndex);
+        m_pCommandTreeView->set_cursor(nNewIndex);
+        return true;
+    }
+    else if (rKeyEvent.GetKeyCode().GetCode() == KEY_RETURN)
+    {
+        RowActivated(*m_pCommandTreeView);
+    }
+
+    return false;
+}
+
+IMPL_LINK_NOARG(CommandListBox, ModifyHdl, weld::Entry&, void)
+{
+    m_pCommandTreeView->clear();
+    m_aCommandList.clear();
+
+    OUString sText = m_pEntry->get_text();
+    if (sText.isEmpty())
+        return;
+
+    m_pCommandTreeView->freeze();
+    m_pMenuContentHandler->findInMenu(sText.toAsciiLowerCase(), m_pCommandTreeView, m_aCommandList);
+    m_pCommandTreeView->thaw();
+
+    if (m_pCommandTreeView->n_children() > 0)
+    {
+        m_pCommandTreeView->set_cursor(0);
+        m_pCommandTreeView->select(0);
+    }
+
+    m_pEntry->grab_focus();
+}
+
+void CommandListBox::dispatchCommandAndClose(OUString const& rCommand)
+{
+    m_rPopUp.EndPopupMode(FloatWinPopupEndFlags::CloseAll);
+    if (!rCommand.isEmpty())
+        comphelper::dispatchCommand(rCommand, uno::Sequence<beans::PropertyValue>());
+}
+
+CommandPopup::CommandPopup(vcl::Window* pParent)
+    : FloatingWindow(pParent, WB_BORDER | WB_SYSTEMWINDOW)
+{
+}
+
+CommandPopup::~CommandPopup() { disposeOnce(); }
+
+void CommandPopup::dispose() { FloatingWindow::dispose(); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/CommandPopup.hxx b/sfx2/source/view/CommandPopup.hxx
new file mode 100644
index 000000000000..0659e608566a
--- /dev/null
+++ b/sfx2/source/view/CommandPopup.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/layout.hxx>
+
+#include <sfx2/dllapi.h>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/floatwin.hxx>
+
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/weld.hxx>
+#include <vcl/window.hxx>
+
+struct CurrentEntry;
+class MenuContentHandler;
+
+class SFX2_DLLPUBLIC CommandPopup : public FloatingWindow
+{
+public:
+    explicit CommandPopup(vcl::Window* pWorkWindow);
+
+    ~CommandPopup() override;
+
+    void dispose() override;
+};
+
+class SFX2_DLLPUBLIC CommandListBox final : public InterimItemWindow
+{
+private:
+    CommandPopup& m_rPopUp;
+
+    std::unique_ptr<weld::Entry> m_pEntry;
+    std::unique_ptr<weld::TreeView> m_pCommandTreeView;
+
+    std::vector<CurrentEntry> m_aCommandList;
+    OUString m_PreviousText;
+    std::unique_ptr<MenuContentHandler> m_pMenuContentHandler;
+
+    DECL_LINK(QueryTooltip, const weld::TreeIter&, OUString);
+    DECL_LINK(RowActivated, weld::TreeView&, bool);
+    DECL_LINK(ModifyHdl, weld::Entry&, void);
+    DECL_LINK(SelectionChanged, weld::TreeView&, void);
+    DECL_LINK(TreeViewKeyPress, const KeyEvent&, bool);
+
+    void dispatchCommandAndClose(OUString const& rCommand);
+
+public:
+    CommandListBox(vcl::Window* pParent, CommandPopup& rPopUp,
+                   css::uno::Reference<css::frame::XFrame> const& xFrame);
+
+    void initialize();
+
+    void dispose() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 170ce543da3b..d946525c4fd3 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -25,6 +25,7 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/classificationhelper.hxx>
 #include <sfx2/notebookbar/SfxNotebookBar.hxx>
+#include <svx/svdview.hxx>
 #include <com/sun/star/document/MacroExecMode.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/DispatchRecorder.hpp>
@@ -90,6 +91,7 @@
 
 #include <unotools/configmgr.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include "CommandPopup.hxx"
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -2913,8 +2915,26 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq )
             rReq.Done();
             break;
         }
+        case SID_COMMAND_POPUP:
+        {
+            static VclPtr<CommandPopup> spCommandPopup;
+            static VclPtr<CommandListBox> spCommandListBox;
+
+            if (spCommandListBox)
+                spCommandListBox.disposeAndClear();
+
+            if (spCommandPopup)
+                spCommandPopup.disposeAndClear();
+
+            css::uno::Reference<css::frame::XFrame> xFrame(GetFrame().GetFrameInterface(), css::uno::UNO_QUERY);
+            spCommandPopup.reset(VclPtr<CommandPopup>::Create(&GetWindow()));
 
-        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+            spCommandListBox.reset(VclPtr<CommandListBox>::Create(spCommandPopup.get(), *spCommandPopup.get(), xFrame));
+            spCommandListBox->initialize();
+
+            rReq.Done();
+            break;
+        }
         case SID_WIN_FULLSCREEN:
         {
             const SfxBoolItem* pItem = rReq.GetArg<SfxBoolItem>(rReq.GetSlot());
diff --git a/sfx2/uiconfig/ui/commandpopup.ui b/sfx2/uiconfig/ui/commandpopup.ui
new file mode 100644
index 000000000000..713f1680a628
--- /dev/null
+++ b/sfx2/uiconfig/ui/commandpopup.ui
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
+<interface domain="sfx">
+  <requires lib="gtk+" version="3.18"/>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name icon -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name tooltip -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkBox" id="CommandBox">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="border-width">6</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkEntry" id="command_entry">
+        <property name="visible">True</property>
+        <property name="can-focus">True</property>
+        <property name="caps-lock-warning">False</property>
+        <property name="placeholder-text" translatable="yes" context="commandpopup|entry">Search command</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkScrolledWindow">
+        <property name="visible">True</property>
+        <property name="can-focus">True</property>
+        <property name="shadow-type">in</property>
+        <child>
+          <object class="GtkViewport">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <child>
+              <object class="GtkTreeView" id="command_treeview">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="model">liststore1</property>
+                <property name="headers-visible">False</property>
+                <property name="headers-clickable">False</property>
+                <property name="enable-search">False</property>
+                <property name="search-column">0</property>
+                <property name="hover-selection">True</property>
+                <property name="show-expanders">False</property>
+                <property name="tooltip-column">2</property>
+                <property name="activate-on-single-click">True</property>
+                <child internal-child="selection">
+                  <object class="GtkTreeSelection"/>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="column">
+                    <property name="sizing">fixed</property>
+                    <child>
+                      <object class="GtkCellRendererPixbuf" id="cellrenderericon"/>
+                      <attributes>
+                        <attribute name="pixbuf">0</attribute>
+                      </attributes>
+                    </child>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext"/>
+                      <attributes>
+                        <attribute name="text">1</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list