[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 8 commits - cui/source cui/uiconfig desktop/source include/vcl sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk sd/uiconfig sd/UIConfig_sdraw.mk sd/UIConfig_simpress.mk sfx2/source sw/uiconfig sw/UIConfig_swriter.mk vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 19 13:52:46 UTC 2021


 cui/source/customize/cfgutil.cxx               |    8 -
 cui/source/inc/cfgutil.hxx                     |    3 
 cui/uiconfig/ui/macroselectordialog.ui         |  126 ++-----------------------
 desktop/source/lib/init.cxx                    |   13 ++
 include/vcl/WeldedTabbedNotebookbar.hxx        |    4 
 include/vcl/layout.hxx                         |    7 -
 include/vcl/uitest/uiobject.hxx                |    2 
 sc/UIConfig_scalc.mk                           |    1 
 sc/inc/scabstdlg.hxx                           |    2 
 sc/source/ui/attrdlg/scdlgfact.cxx             |   10 +
 sc/source/ui/attrdlg/scdlgfact.hxx             |    2 
 sc/source/ui/cctrl/checklistmenu.cxx           |    4 
 sc/source/ui/dbgui/PivotLayoutTreeList.cxx     |   24 ++--
 sc/source/ui/dbgui/PivotLayoutTreeListData.cxx |   22 ++--
 sc/source/ui/dbgui/pvfundlg.cxx                |   13 ++
 sc/source/ui/inc/PivotLayoutTreeList.hxx       |    3 
 sc/source/ui/inc/PivotLayoutTreeListData.hxx   |    3 
 sc/source/ui/inc/pvfundlg.hxx                  |    1 
 sc/source/ui/view/cellsh1.cxx                  |  101 ++++++++++++--------
 sc/uiconfig/scalc/ui/notebookbar_online.ui     |   93 ++++++++++++++++++
 sd/UIConfig_sdraw.mk                           |    1 
 sd/UIConfig_simpress.mk                        |    1 
 sd/uiconfig/sdraw/ui/notebookbar_online.ui     |   69 +++++++++++++
 sd/uiconfig/simpress/ui/notebookbar_online.ui  |   69 +++++++++++++
 sfx2/source/notebookbar/SfxNotebookBar.cxx     |   11 +-
 sw/UIConfig_swriter.mk                         |    1 
 sw/uiconfig/swriter/ui/notebookbar_online.ui   |   95 ++++++++++++++++++
 vcl/source/control/WeldedTabbedNotebookbar.cxx |    2 
 vcl/source/control/notebookbar.cxx             |    6 -
 vcl/source/uitest/uiobject.cxx                 |   39 +++++++
 vcl/source/window/layout.cxx                   |    8 +
 31 files changed, 554 insertions(+), 190 deletions(-)

New commits:
commit 366f87403a83ceddf0330a0ed8cf9534191dc921
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 6 12:38:40 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Apr 19 15:17:01 2021 +0200

    autofilter: show menu only if has items
    
    Change-Id: Ie6b7158e74a8bdccdbafaa9b6d9b09b3796088ba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108846
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111895
    Tested-by: Jenkins

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index e33c0b891360..54c87adad219 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -134,6 +134,7 @@ void ScCheckListMenuControl::addMenuItem(const OUString& rText, Action* pAction)
     aItem.mxAction.reset(pAction);
     maMenuItems.emplace_back(std::move(aItem));
 
+    mxMenu->show();
     mxMenu->append_text(rText);
     if (mbCanHaveSubMenu)
         mxMenu->set_image(mxMenu->n_children() - 1, css::uno::Reference<css::graphic::XGraphic>(), 1);
@@ -182,6 +183,7 @@ ScCheckListMenuWindow* ScCheckListMenuControl::addSubMenuItem(const OUString& rT
                                                                    pNotifier));
     maMenuItems.emplace_back(std::move(aItem));
 
+    mxMenu->show();
     mxMenu->append_text(rText);
     if (mbCanHaveSubMenu)
         mxMenu->set_image(mxMenu->n_children() - 1, *mxDropDown, 1);
@@ -459,6 +461,8 @@ ScCheckListMenuControl::ScCheckListMenuControl(ScCheckListMenuWindow* pParent, v
     , maOpenTimer(this)
     , maCloseTimer(this)
 {
+    mxMenu->hide(); // show only when has items
+
     /*
        tdf#136559 If we have no dates we don't need a tree
        structure, just a list. GtkListStore can be then
commit 55866002fae41e2aee4ba4a11f58689f5cf0ce6e
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Mar 11 12:33:52 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Apr 19 15:12:08 2021 +0200

    Remove description from mobile macro selector
    
    Change-Id: I76d9a73c65d0c7759b56a3d7b69aadf5b58d7da1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112327
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114206
    Tested-by: Jenkins

diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 67ea10c2ee97..b17531a111d2 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -1080,6 +1080,7 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
     , m_xOKButton(m_xBuilder->weld_button("ok"))
     , m_xCancelButton(m_xBuilder->weld_button("cancel"))
     , m_xDescriptionText(m_xBuilder->weld_text_view("description"))
+    , m_xDescriptionFrame(m_xBuilder->weld_frame("descriptionframe"))
 {
     m_xCancelButton->show();
     m_xDialogDescription->show();
@@ -1117,7 +1118,7 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
     UpdateUI();
 
     if (comphelper::LibreOfficeKit::isActive())
-        m_xDescriptionText->hide();
+        m_xDescriptionFrame->hide();
 }
 
 SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 04bbbb2e83f6..75bc191f4f76 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -240,6 +240,7 @@ class SvxScriptSelectorDialog : public weld::GenericDialogController
     std::unique_ptr<weld::Button> m_xOKButton;
     std::unique_ptr<weld::Button> m_xCancelButton;
     std::unique_ptr<weld::TextView> m_xDescriptionText;
+    std::unique_ptr<weld::Frame> m_xDescriptionFrame;
 
     DECL_LINK(ClickHdl, weld::Button&, void);
     DECL_LINK(SelectHdl, weld::TreeView&, void);
diff --git a/cui/uiconfig/ui/macroselectordialog.ui b/cui/uiconfig/ui/macroselectordialog.ui
index 9968da4cbe50..c21cc9ff4e70 100644
--- a/cui/uiconfig/ui/macroselectordialog.ui
+++ b/cui/uiconfig/ui/macroselectordialog.ui
@@ -274,7 +274,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkFrame" id="frame1">
+              <object class="GtkFrame" id="descriptionframe">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
commit 8431d7900668fa3ecb76bfcf66df0a54ed86f4fc
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Mar 11 09:11:38 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Apr 19 15:10:49 2021 +0200

    Remove unused code from Macro Selector dialog
    
    Change-Id: I9930fd7eaf2410447f84aa4798478a10915ea738
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112316
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114205
    Tested-by: Jenkins

diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 2c53feab0c30..67ea10c2ee97 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -1076,9 +1076,7 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
     , m_xCategories(new CuiConfigGroupListBox(m_xBuilder->weld_tree_view("categories")))
     , m_xCommands(new CuiConfigFunctionListBox(m_xBuilder->weld_tree_view("commands")))
     , m_xLibraryFT(m_xBuilder->weld_label("libraryft"))
-    , m_xCategoryFT(m_xBuilder->weld_label("categoryft"))
     , m_xMacronameFT(m_xBuilder->weld_label("macronameft"))
-    , m_xCommandsFT(m_xBuilder->weld_label("commandsft"))
     , m_xOKButton(m_xBuilder->weld_button("ok"))
     , m_xCancelButton(m_xBuilder->weld_button("cancel"))
     , m_xDescriptionText(m_xBuilder->weld_text_view("description"))
@@ -1088,9 +1086,7 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
     m_xOKButton->show();
 
     m_xLibraryFT->set_visible(true);
-    m_xCategoryFT->set_visible(false);
     m_xMacronameFT->set_visible(true);
-    m_xCommandsFT->set_visible(false);
 
     const OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
     m_xCategories->SetFunctionListBox(m_xCommands.get());
@@ -1119,6 +1115,9 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
     m_xCategories->SetStylesInfo(&m_aStylesInfo);
 
     UpdateUI();
+
+    if (comphelper::LibreOfficeKit::isActive())
+        m_xDescriptionText->hide();
 }
 
 SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 5959658e84a5..04bbbb2e83f6 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -236,9 +236,7 @@ class SvxScriptSelectorDialog : public weld::GenericDialogController
     std::unique_ptr<CuiConfigGroupListBox> m_xCategories;
     std::unique_ptr<CuiConfigFunctionListBox> m_xCommands;
     std::unique_ptr<weld::Label> m_xLibraryFT;
-    std::unique_ptr<weld::Label> m_xCategoryFT;
     std::unique_ptr<weld::Label> m_xMacronameFT;
-    std::unique_ptr<weld::Label> m_xCommandsFT;
     std::unique_ptr<weld::Button> m_xOKButton;
     std::unique_ptr<weld::Button> m_xCancelButton;
     std::unique_ptr<weld::TextView> m_xDescriptionText;
diff --git a/cui/uiconfig/ui/macroselectordialog.ui b/cui/uiconfig/ui/macroselectordialog.ui
index ec3f0014ef2a..9968da4cbe50 100644
--- a/cui/uiconfig/ui/macroselectordialog.ui
+++ b/cui/uiconfig/ui/macroselectordialog.ui
@@ -37,24 +37,10 @@
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="add">
-                <property name="label" translatable="yes" context="macroselectordialog|add">Add</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
-                <property name="no_show_all">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkButton" id="ok">
                 <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="has_default">True</property>
@@ -71,6 +57,7 @@
             <child>
               <object class="GtkButton" id="cancel">
                 <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="no_show_all">True</property>
@@ -82,20 +69,6 @@
                 <property name="position">2</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkButton" id="close">
-                <property name="label">gtk-close</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="no_show_all">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkButton" id="help">
                 <property name="label">gtk-help</property>
@@ -143,22 +116,6 @@
                 <property name="position">0</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkLabel" id="helptoolbar">
-                <property name="can_focus">False</property>
-                <property name="no_show_all">True</property>
-                <property name="hexpand">True</property>
-                <property name="label" translatable="yes" context="macroselectordialog|helptoolbar">To add a command to a toolbar, select the category and then the command. Then drag the command to the Commands list of the Toolbars tab page in the Customize dialog.</property>
-                <property name="wrap">True</property>
-                <property name="max_width_chars">60</property>
-                <property name="xalign">0</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkBox" id="box2">
                 <property name="visible">True</property>
@@ -225,39 +182,13 @@
                       </object>
                     </child>
                     <child type="label">
-                      <object class="GtkBox" id="box3">
+                      <object class="GtkLabel" id="libraryft">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <child>
-                          <object class="GtkLabel" id="libraryft">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label" translatable="yes" context="macroselectordialog|libraryft">Library</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="categoryft">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label" translatable="yes" context="macroselectordialog|categoryft">Category</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
+                        <property name="label" translatable="yes" context="macroselectordialog|libraryft">Library</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
                       </object>
                     </child>
                   </object>
@@ -318,41 +249,14 @@
                       </object>
                     </child>
                     <child type="label">
-                      <object class="GtkBox" id="box4">
+                      <object class="GtkLabel" id="macronameft">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <child>
-                          <object class="GtkLabel" id="macronameft">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label" translatable="yes" context="macroselectordialog|macronameft">Macro Name</property>
-                            <property name="track_visited_links">False</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="commandsft">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label" translatable="yes" context="macroselectordialog|commandsft">Commands</property>
-                            <property name="track_visited_links">False</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
+                        <property name="label" translatable="yes" context="macroselectordialog|macronameft">Macro Name</property>
+                        <property name="track_visited_links">False</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
                       </object>
                     </child>
                   </object>
@@ -431,10 +335,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="101">add</action-widget>
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
-      <action-widget response="-7">close</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
     <child type="titlebar">
commit 4a3247f090fc1d254311e7e0a15e2c6e51b915f8
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Apr 2 20:13:32 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Apr 19 15:06:19 2021 +0200

    jsdialog: uitest: handle click for drawing area
    
    Change-Id: I5ea78697b87f4b2a468f8507470b62031bee4aa0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113524
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114202
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 855d3acb6d5c..ad3486389c12 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3807,6 +3807,17 @@ static void lcl_sendDialogEvent(unsigned long long int nWindowId, const char* pA
                     aMap["VALUE"] = aMap["data"];
                     pUIWindow->execute(sValue, aMap);
                 }
+                else if (sAction == "click" && aMap["type"] == "drawingarea")
+                {
+                    int separatorPos = aMap["data"].indexOf(';');
+                    if (separatorPos > 0)
+                    {
+                        // x;y
+                        aMap["POSX"] = aMap["data"].copy(0, separatorPos);
+                        aMap["POSY"] = aMap["data"].copy(separatorPos + 1);
+                    }
+                    pUIWindow->execute(sClickAction, aMap);
+                }
                 else
                     pUIWindow->execute(sClickAction, aMap);
             }
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 5c4a60c4f5e8..7c8d2f2c7b9d 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -729,12 +729,7 @@ private:
         }
     }
     virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override;
-    virtual FactoryFunction GetUITestFactory() const override
-    {
-        if (m_pFactoryFunction)
-            return m_pFactoryFunction;
-        return Control::GetUITestFactory();
-    }
+    virtual FactoryFunction GetUITestFactory() const override;
 
 public:
     VclDrawingArea(vcl::Window *pParent, WinBits nStyle)
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index e2cb07384cf7..add706630095 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -555,6 +555,8 @@ protected:
 public:
     DrawingAreaUIObject(const VclPtr<vcl::Window>& rDrawingArea);
     virtual ~DrawingAreaUIObject() override;
+    virtual void execute(const OUString& rAction, const StringMap& rParameters) override;
+    static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
 };
 
 #endif
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 92122b54caab..663d7586fc1b 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -1732,6 +1732,45 @@ DrawingAreaUIObject::~DrawingAreaUIObject()
 {
 }
 
+void DrawingAreaUIObject::execute(const OUString& rAction, const StringMap& rParameters)
+{
+    if (rAction == "CLICK")
+    {
+        // POSX and POSY are percentage of width/height dimensions
+        if (rParameters.find("POSX") != rParameters.end() &&
+            rParameters.find("POSY") != rParameters.end())
+        {
+            auto aPosX = rParameters.find("POSX");
+            auto aPosY = rParameters.find("POSY");
+
+            OString sPosX2 = OUStringToOString(aPosX->second, RTL_TEXTENCODING_ASCII_US);
+            OString sPoxY2 = OUStringToOString(aPosY->second, RTL_TEXTENCODING_ASCII_US);
+
+            if (!sPosX2.isEmpty() && !sPoxY2.isEmpty())
+            {
+                double fPosX = std::atof(sPosX2.getStr());
+                double fPosY = std::atof(sPoxY2.getStr());
+
+                fPosX = fPosX * mxDrawingArea->GetOutputWidthPixel();
+                fPosY = fPosY * mxDrawingArea->GetOutputHeightPixel();
+
+                MouseEvent aEvent(Point(fPosX, fPosY), 1, MouseEventModifiers::NONE, MOUSE_LEFT, 0);
+                mxDrawingArea->MouseButtonDown(aEvent);
+                mxDrawingArea->MouseButtonUp(aEvent);
+            }
+        }
+    }
+    else
+        WindowUIObject::execute(rAction, rParameters);
+}
+
+std::unique_ptr<UIObject> DrawingAreaUIObject::create(vcl::Window* pWindow)
+{
+    VclDrawingArea* pVclDrawingArea = dynamic_cast<VclDrawingArea*>(pWindow);
+    assert(pVclDrawingArea);
+    return std::unique_ptr<UIObject>(new DrawingAreaUIObject(pVclDrawingArea));
+}
+
 IconViewUIObject::IconViewUIObject(const VclPtr<SvTreeListBox>& xIconView):
     TreeListUIObject(xIconView)
 {
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 63d5d1536772..9b0ee7452577 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -29,6 +29,7 @@
 #include <window.h>
 #include <boost/multi_array.hpp>
 #include <vcl/toolkit/vclmedit.hxx>
+#include <vcl/uitest/uiobject.hxx>
 #include <sal/log.hxx>
 #include <tools/json_writer.hxx>
 
@@ -3005,4 +3006,11 @@ void VclDrawingArea::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
     rJsonWriter.put("text", GetQuickHelpText());
 }
 
+FactoryFunction VclDrawingArea::GetUITestFactory() const
+{
+    if (m_pFactoryFunction)
+        return m_pFactoryFunction;
+    return DrawingAreaUIObject::create;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b46bd60ecc3245d204b57957cea876231a71cd28
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Apr 6 07:08:30 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Apr 19 15:01:33 2021 +0200

    notebookbar: minify for online
    
    Notebookbar load takes some time. We don't use most of
    the items in online so minify .ui file to contain
    only needed widgets.
    
    Change-Id: I4796caae14bb63e3e04d318093209adfb87a77df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113623
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114154
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a484cf607d60..855d3acb6d5c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6090,7 +6090,7 @@ static void activateNotebookbar(const OUString& rApp)
 
     if (aAppNode.isValid())
     {
-        aAppNode.setNodeValue("Active", makeAny(OUString("notebookbar.ui")));
+        aAppNode.setNodeValue("Active", makeAny(OUString("notebookbar_online.ui")));
         aAppNode.commit();
     }
 }
diff --git a/include/vcl/WeldedTabbedNotebookbar.hxx b/include/vcl/WeldedTabbedNotebookbar.hxx
index 59190425ecfe..073902f2d166 100644
--- a/include/vcl/WeldedTabbedNotebookbar.hxx
+++ b/include/vcl/WeldedTabbedNotebookbar.hxx
@@ -15,14 +15,14 @@
 #include <vcl/weld.hxx>
 #include <com/sun/star/frame/XFrame.hpp>
 
-/** Tabbed implementation of NotebookBar for Writer
+/**
+ * Welded wrapper for NotebookBar used for online
 */
 class VCL_DLLPUBLIC WeldedTabbedNotebookbar
 {
     std::unique_ptr<weld::Builder> m_xBuilder;
 
     std::unique_ptr<weld::Container> m_xContainer;
-    std::unique_ptr<weld::Notebook> m_xNotebook;
 
 public:
     WeldedTabbedNotebookbar(const VclPtr<vcl::Window>& pContainerWindow,
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index f1a6f4fe902f..cad4805450c6 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -159,6 +159,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
 	sc/uiconfig/scalc/ui/notebookbar_groups \
 	sc/uiconfig/scalc/ui/notebookbar_groupedbar_full \
 	sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact \
+	sc/uiconfig/scalc/ui/notebookbar_online \
 	sc/uiconfig/scalc/ui/numberbox \
 	sc/uiconfig/scalc/ui/managenamesdialog \
 	sc/uiconfig/scalc/ui/mergecellsdialog \
diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui b/sc/uiconfig/scalc/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..fe58b62ac0e0
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.20"/>
+  <requires lib="LibreOffice" version="1.0"/>
+  <!-- interface-local-resource-path ../../../icon-themes/colibre/cmd/ -->
+  <object class="GtkGrid" id="NotebookBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="font">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkToolButton" id="Home-CharFontName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:CharFontName</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="fontheight">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="margin_start">5</property>
+            <child>
+              <object class="GtkToolButton" id="Home-FontHeight">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:FontHeight</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="SectionBottom127">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="toolbar_style">icons</property>
+            <property name="show_arrow">False</property>
+            <child>
+              <object class="GtkToolButton" id="Home-NumberFormatType">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:NumberFormatType</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sd/UIConfig_sdraw.mk b/sd/UIConfig_sdraw.mk
index d757577a97cc..136f84fcd315 100644
--- a/sd/UIConfig_sdraw.mk
+++ b/sd/UIConfig_sdraw.mk
@@ -117,6 +117,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/sdraw,\
 	sd/uiconfig/sdraw/ui/notebookbar_compact \
 	sd/uiconfig/sdraw/ui/notebookbar_single \
 	sd/uiconfig/sdraw/ui/notebookbar_groupedbar_compact \
+	sd/uiconfig/sdraw/ui/notebookbar_online \
 	sd/uiconfig/sdraw/ui/paranumberingtab \
 	sd/uiconfig/sdraw/ui/queryunlinkimagedialog \
 	sd/uiconfig/sdraw/ui/vectorize \
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index 92d12d7ecc5c..ed0fb46479b9 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -142,6 +142,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
 	sd/uiconfig/simpress/ui/notebookbar_groups \
 	sd/uiconfig/simpress/ui/notebookbar_groupedbar_full \
 	sd/uiconfig/simpress/ui/notebookbar_groupedbar_compact \
+	sd/uiconfig/simpress/ui/notebookbar_online \
 	sd/uiconfig/simpress/ui/optimpressgeneralpage \
 	sd/uiconfig/simpress/ui/pagesfieldbox \
 	sd/uiconfig/simpress/ui/photoalbum \
diff --git a/sd/uiconfig/sdraw/ui/notebookbar_online.ui b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..6847a80db253
--- /dev/null
+++ b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.20"/>
+  <requires lib="LibreOffice" version="1.0"/>
+  <!-- interface-local-resource-path ../../../icon-themes/colibre/cmd/ -->
+  <object class="GtkGrid" id="NotebookBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="font">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkToolButton" id="Home-CharFontName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:CharFontName</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="fontheight">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="margin_start">5</property>
+            <child>
+              <object class="GtkToolButton" id="Home-FontHeight">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:FontHeight</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sd/uiconfig/simpress/ui/notebookbar_online.ui b/sd/uiconfig/simpress/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..6847a80db253
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/notebookbar_online.ui
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.20"/>
+  <requires lib="LibreOffice" version="1.0"/>
+  <!-- interface-local-resource-path ../../../icon-themes/colibre/cmd/ -->
+  <object class="GtkGrid" id="NotebookBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="font">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkToolButton" id="Home-CharFontName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:CharFontName</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="fontheight">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="margin_start">5</property>
+            <child>
+              <object class="GtkToolButton" id="Home-FontHeight">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:FontHeight</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index f901b3788fc9..6fe050e5d4b5 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -278,6 +278,9 @@ bool SfxNotebookBar::IsActive()
 
     OUString aActive = comphelper::getString( aAppNode.getNodeValue( "Active" ) );
 
+    if (comphelper::LibreOfficeKit::isActive() && aActive == "notebookbar_online.ui")
+        return true;
+
     const utl::OConfigurationNode aModesNode = aAppNode.openNode("Modes");
     const Sequence<OUString> aModeNodeNames( aModesNode.getNodeNames() );
 
@@ -343,6 +346,8 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
         OUString aModuleName = xModuleManager->identify( xFrame );
         vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum( aModuleName );
         OUString sFile = lcl_getNotebookbarFileName( eApp );
+        if (comphelper::LibreOfficeKit::isActive())
+            sFile = "notebookbar_online.ui";
         OUString sNewFile = rUIFile + sFile;
         OUString sCurrentFile;
         VclPtr<NotebookBar> pNotebookBar = pSysWindow->GetNotebookBar();
@@ -421,8 +426,10 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
     }
     else if (auto pNotebookBar = pSysWindow->GetNotebookBar())
     {
-        pNotebookBar->Hide();
-        pNotebookBar->GetParent()->Resize();
+        vcl::Window* pParent = pNotebookBar->GetParent();
+        RemoveListeners(pSysWindow);
+        pSysWindow->CloseNotebookBar();
+        pParent->Resize();
         SfxNotebookBar::ShowMenubar(true);
     }
 
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 366c1ed19854..7d3e2bf6b7c3 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -231,6 +231,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/notebookbar_groups \
 	sw/uiconfig/swriter/ui/notebookbar_groupedbar_full \
 	sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact \
+	sw/uiconfig/swriter/ui/notebookbar_online \
 	sw/uiconfig/swriter/ui/pagebreakmenu \
 	sw/uiconfig/swriter/ui/pagecolumncontrol \
 	sw/uiconfig/swriter/ui/pagemargincontrol \
diff --git a/sw/uiconfig/swriter/ui/notebookbar_online.ui b/sw/uiconfig/swriter/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..50f557bd2655
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/notebookbar_online.ui
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.20"/>
+  <requires lib="LibreOffice" version="1.0"/>
+  <!-- interface-local-resource-path ../../../icon-themes/colibre/cmd/ -->
+  <object class="GtkGrid" id="NotebookBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="font">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkToolButton" id="Home-CharFontName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:CharFontName</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="fontheight">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="margin_start">5</property>
+            <child>
+              <object class="GtkToolButton" id="Home-FontHeight">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:FontHeight</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="SectionBottom127">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="toolbar_style">icons</property>
+            <property name="show_arrow">False</property>
+            <child>
+              <object class="GtkToolButton" id="Home-StylesPreview">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:StylesPreview</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/vcl/source/control/WeldedTabbedNotebookbar.cxx b/vcl/source/control/WeldedTabbedNotebookbar.cxx
index eb40389733f7..1a3311de9f5b 100644
--- a/vcl/source/control/WeldedTabbedNotebookbar.cxx
+++ b/vcl/source/control/WeldedTabbedNotebookbar.cxx
@@ -18,8 +18,6 @@ WeldedTabbedNotebookbar::WeldedTabbedNotebookbar(
           pContainerWindow, AllSettings::GetUIRootDir(), rUIFilePath, rFrame, nWindowId))
 {
     m_xContainer = m_xBuilder->weld_container("NotebookBar");
-    m_xNotebook = m_xBuilder->weld_notebook("ContextContainer");
-    m_xNotebook->set_current_page("HomeLabel");
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx
index 1c2a7c9d3252..bfe8e724e91c 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -68,11 +68,7 @@ NotebookBar::NotebookBar(Window* pParent, const OString& rID, const OUString& rU
     if ( doesCustomizedUIExist )
         sUIDir = getCustomizedUIRootDir();
 
-    bool bIsWelded = comphelper::LibreOfficeKit::isActive()
-                    && (rUIXMLDescription == "modules/swriter/ui/notebookbar.ui"
-                    || rUIXMLDescription == "modules/scalc/ui/notebookbar.ui"
-                    || rUIXMLDescription == "modules/simpress/ui/notebookbar.ui"
-                    || rUIXMLDescription == "modules/sdraw/ui/notebookbar.ui");
+    bool bIsWelded = comphelper::LibreOfficeKit::isActive();
     if (bIsWelded)
     {
         m_bIsWelded = true;
commit f08480de6f94ccc6be4d2a590c41ae2d46ab9d2d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Sat Mar 6 17:44:11 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Apr 19 15:00:35 2021 +0200

    Pivot table: fix data field subdialog
    
    Changes done in 'Data field' subdialog were not
    applied in the result pivot table.
    
    Change-Id: Ia221380a9ab3d292033512b9b642646f4b53a39d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112096
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114212
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 221fbea7c8ff..063b22eee3cd 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -92,15 +92,15 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool
 
     mpFunctionDlg = pFactory->CreateScDPFunctionDlg(mxControl.get(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData);
 
-    mpFunctionDlg->StartExecuteAsync([this, pCurrentItemValue, rCurrentFunctionData,
+    mpFunctionDlg->StartExecuteAsync([this, pCurrentItemValue,
                                 rCurrentLabelData, nEntry](int nResult) mutable {
         if (nResult == RET_OK)
         {
             ScPivotFuncData& rFunctionData = pCurrentItemValue->maFunctionData;
-            rCurrentFunctionData.mnFuncMask = mpFunctionDlg->GetFuncMask();
+            rFunctionData.mnFuncMask = mpFunctionDlg->GetFuncMask();
             rCurrentLabelData.mnFuncMask = mpFunctionDlg->GetFuncMask();
 
-            rCurrentFunctionData.maFieldRef = mpFunctionDlg->GetFieldRef();
+            rFunctionData.maFieldRef = mpFunctionDlg->GetFieldRef();
 
             ScDPLabelData& rDFData = mpParent->GetLabelData(rFunctionData.mnCol);
 
commit b940edac3b91a76ce6c1a98fb76cd6ad4b1d95ee
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 5 14:54:52 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Apr 19 15:00:02 2021 +0200

    pivot table: make partial sum message box async
    
    Change-Id: I63011526d60f332ee56edebf5bf48b30ad6b2a94
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108807
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114211
    Tested-by: Jenkins

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 84e6422d3511..c9e7a0a57978 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2901,6 +2901,50 @@ void RunPivotLayoutDialog(ScModule* pScMod,
     }
 }
 
+void SetupRangeForPivotTableDialog(const ScRange& rRange,
+                                   ScAddress& rDestPos,
+                                   ScDocument* pDoc,
+                                   const char* pSrcErrorId,
+                                   std::unique_ptr<ScDPObject>& pNewDPObject)
+{
+    ScSheetSourceDesc aShtDesc(pDoc);
+    aShtDesc.SetSourceRange(rRange);
+    pSrcErrorId = aShtDesc.CheckSourceRange();
+    if (!pSrcErrorId)
+    {
+        pNewDPObject.reset(new ScDPObject(pDoc));
+        pNewDPObject->SetSheetDesc( aShtDesc );
+    }
+
+    //  output below source data
+    if ( rRange.aEnd.Row()+2 <= pDoc->MaxRow() - 4 )
+        rDestPos = ScAddress( rRange.aStart.Col(),
+                                rRange.aEnd.Row()+2,
+                                rRange.aStart.Tab() );
+}
+
+void ErrorOrRunPivotLayoutDialog(const char* pSrcErrorId,
+                                 ScAddress& rDestPos,
+                                 ScModule* pScMod,
+                                 ScTabViewShell* pTabViewShell,
+                                 std::unique_ptr<ScDPObject>& pNewDPObject)
+{
+    if (pSrcErrorId)
+    {
+        // Error occurred during data creation.  Launch an error and bail out.
+        std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
+                                                    VclMessageType::Info, VclButtonsType::Ok,
+                                                    ScResId(pSrcErrorId)));
+        xInfoBox->run();
+        return;
+    }
+
+    if ( pNewDPObject )
+        pNewDPObject->SetOutRange( rDestPos );
+
+    RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
+}
+
 }
 
 void ScCellShell::ExecuteDataPilotDialog()
@@ -3015,11 +3059,11 @@ void ScCellShell::ExecuteDataPilotDialog()
                 }
                 else
                 {
-                    std::unique_ptr<ScDPObject> pNewDPObject;
                     const char* pSrcErrorId = nullptr;
 
                     if (pTypeDlg->IsNamedRange())
                     {
+                        std::unique_ptr<ScDPObject> pNewDPObject;
                         OUString aName = pTypeDlg->GetSelectedNamedRange();
                         ScSheetSourceDesc aShtDesc(&rDoc);
                         aShtDesc.SetRangeName(aName);
@@ -3029,6 +3073,8 @@ void ScCellShell::ExecuteDataPilotDialog()
                             pNewDPObject.reset(new ScDPObject(&rDoc));
                             pNewDPObject->SetSheetDesc(aShtDesc);
                         }
+
+                        ErrorOrRunPivotLayoutDialog(pSrcErrorId, aDestPos, pScMod, pTabViewShell, pNewDPObject);
                     }
                     else        // selection
                     {
@@ -3037,6 +3083,8 @@ void ScCellShell::ExecuteDataPilotDialog()
                         ScMarkType eType = GetViewData()->GetSimpleArea(aRange);
                         if ( (eType & SC_MARK_SIMPLE) == SC_MARK_SIMPLE )
                         {
+                            ScDocument* pDoc = &rDoc;
+
                             // Shrink the range to the data area.
                             SCCOL nStartCol = aRange.aStart.Col(), nEndCol = aRange.aEnd.Col();
                             SCROW nStartRow = aRange.aStart.Row(), nEndRow = aRange.aEnd.Row();
@@ -3050,51 +3098,32 @@ void ScCellShell::ExecuteDataPilotDialog()
                                 pTabViewShell->MarkRange(aRange);
                             }
 
-                            bool bOK = true;
                             if ( rDoc.HasSubTotalCells( aRange ) )
                             {
                                 //  confirm selection if it contains SubTotal cells
-                                std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
+                                std::shared_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
                                                                             VclMessageType::Question, VclButtonsType::YesNo,
                                                                             ScResId(STR_DATAPILOT_SUBTOTAL)));
                                 xQueryBox->set_default_response(RET_YES);
-                                if (xQueryBox->run() == RET_NO)
-                                    bOK = false;
+                                xQueryBox->runAsync(xQueryBox, [aRange, pDoc, pTypeDlg, aDestPos,
+                                                                pScMod, pTabViewShell, pSrcErrorId] (int nResult2) mutable {
+                                    if (nResult2 == RET_NO)
+                                        return;
+
+                                    std::unique_ptr<ScDPObject> pNewDPObject;
+                                    SetupRangeForPivotTableDialog(aRange, aDestPos, pDoc, pSrcErrorId, pNewDPObject);
+                                    ErrorOrRunPivotLayoutDialog(pSrcErrorId, aDestPos, pScMod, pTabViewShell, pNewDPObject);
+                                });
+
+                                pTypeDlg->disposeOnce();
+                                return;
                             }
-                            if (bOK)
-                            {
-                                ScSheetSourceDesc aShtDesc(&rDoc);
-                                aShtDesc.SetSourceRange(aRange);
-                                pSrcErrorId = aShtDesc.CheckSourceRange();
-                                if (!pSrcErrorId)
-                                {
-                                    pNewDPObject.reset(new ScDPObject(&rDoc));
-                                    pNewDPObject->SetSheetDesc( aShtDesc );
-                                }
 
-                                //  output below source data
-                                if ( aRange.aEnd.Row()+2 <= rDoc.MaxRow() - 4 )
-                                    aDestPos = ScAddress( aRange.aStart.Col(),
-                                                            aRange.aEnd.Row()+2,
-                                                            aRange.aStart.Tab() );
-                            }
+                            std::unique_ptr<ScDPObject> pNewDPObject;
+                            SetupRangeForPivotTableDialog(aRange, aDestPos, pDoc, pSrcErrorId, pNewDPObject);
+                            ErrorOrRunPivotLayoutDialog(pSrcErrorId, aDestPos, pScMod, pTabViewShell, pNewDPObject);
                         }
                     }
-
-                    if (pSrcErrorId)
-                    {
-                        // Error occurred during data creation.  Launch an error and bail out.
-                        std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
-                                                                    VclMessageType::Info, VclButtonsType::Ok,
-                                                                    ScResId(pSrcErrorId)));
-                        xInfoBox->run();
-                        return;
-                    }
-
-                    if ( pNewDPObject )
-                        pNewDPObject->SetOutRange( aDestPos );
-
-                    RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
                 }
             }
 
commit 13a93fd97b01adf5ab6a774cd354c51402dc96ff
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Dec 16 15:59:00 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Apr 19 14:25:35 2021 +0200

    pivot table: properly close all subdialogs
    
    Change-Id: Ieda601ce25d822394d6ddd12da861128b9270aa2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107843
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114207
    Tested-by: Jenkins

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 7feb1eaafbac..a6ba5dcdb4f3 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -295,6 +295,7 @@ protected:
 public:
     virtual PivotFunc  GetFuncMask() const = 0;
     virtual css::sheet::DataPilotFieldReference GetFieldRef() const = 0;
+    virtual void       Response(int nResponse) = 0;
 };
 
 class AbstractScDPSubtotalDlg : public VclAbstractDialog
@@ -304,6 +305,7 @@ protected:
 public:
     virtual PivotFunc  GetFuncMask() const = 0;
     virtual void    FillLabelData( ScDPLabelData& rLabelData ) const = 0;
+    virtual void    Response(int nResponse) = 0;
 };
 
 class AbstractScDPNumGroupDlg : public VclAbstractDialog
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 77bf6c4e9e07..928f235882ad 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -758,6 +758,11 @@ PivotFunc AbstractScDPFunctionDlg_Impl::GetFuncMask() const
      return m_xDlg->GetFuncMask();
 }
 
+void AbstractScDPFunctionDlg_Impl::Response(int nResponse)
+{
+    m_xDlg->response(nResponse);
+}
+
 css::sheet::DataPilotFieldReference AbstractScDPFunctionDlg_Impl::GetFieldRef() const
 {
     return m_xDlg->GetFieldRef();
@@ -773,6 +778,11 @@ void AbstractScDPSubtotalDlg_Impl::FillLabelData( ScDPLabelData& rLabelData ) co
     m_xDlg->FillLabelData( rLabelData );
 }
 
+void AbstractScDPSubtotalDlg_Impl::Response(int nResponse)
+{
+    m_xDlg->response(nResponse);
+}
+
 ScDPNumGroupInfo AbstractScDPNumGroupDlg_Impl::GetGroupInfo() const
 {
     return m_xDlg->GetGroupInfo();
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index d93b6ddcf89f..46583103919f 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -476,6 +476,7 @@ public:
     virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
     virtual PivotFunc GetFuncMask() const override;
     virtual css::sheet::DataPilotFieldReference GetFieldRef() const override;
+    virtual void Response(int nResponse) override;
 };
 
 class AbstractScDPSubtotalDlg_Impl : public AbstractScDPSubtotalDlg
@@ -490,6 +491,7 @@ public:
     virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
     virtual PivotFunc GetFuncMask() const override;
     virtual void FillLabelData( ScDPLabelData& rLabelData ) const override;
+    virtual void Response(int nResponse) override;
 };
 
 class AbstractScDPNumGroupDlg_Impl : public AbstractScDPNumGroupDlg
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index 65e055477276..083dd509438d 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -15,7 +15,6 @@
 
 #include <vcl/event.hxx>
 #include <pivot.hxx>
-#include <scabstdlg.hxx>
 
 ScPivotLayoutTreeList::ScPivotLayoutTreeList(std::unique_ptr<weld::TreeView> xControl)
     : ScPivotLayoutTreeListBase(std::move(xControl))
@@ -24,7 +23,14 @@ ScPivotLayoutTreeList::ScPivotLayoutTreeList(std::unique_ptr<weld::TreeView> xCo
     mxControl->connect_row_activated(LINK(this, ScPivotLayoutTreeList, DoubleClickHdl));
 }
 
-ScPivotLayoutTreeList::~ScPivotLayoutTreeList() {}
+ScPivotLayoutTreeList::~ScPivotLayoutTreeList()
+{
+    if (mpSubtotalDlg)
+    {
+        mpSubtotalDlg->Response(RET_CANCEL);
+        mpSubtotalDlg.clear();
+    }
+}
 
 void ScPivotLayoutTreeList::Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType)
 {
@@ -53,18 +59,18 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeList, DoubleClickHdl, weld::TreeView&, bool)
     maDataFieldNames.clear();
     mpParent->PushDataFieldNames(maDataFieldNames);
 
-    VclPtr<AbstractScDPSubtotalDlg> pDialog(
-        pFactory->CreateScDPSubtotalDlg(mxControl.get(), mpParent->maPivotTableObject,
-                                        rCurrentLabelData, rCurrentFunctionData, maDataFieldNames));
+    mpSubtotalDlg = pFactory->CreateScDPSubtotalDlg(mxControl.get(), mpParent->maPivotTableObject,
+                                                    rCurrentLabelData, rCurrentFunctionData,
+                                                    maDataFieldNames);
 
-    pDialog->StartExecuteAsync([this, pDialog, pCurrentItemValue, nCurrentColumn](int nResult) {
+    mpSubtotalDlg->StartExecuteAsync([this, pCurrentItemValue, nCurrentColumn](int nResult) {
         if (nResult == RET_OK)
         {
-            pDialog->FillLabelData(mpParent->GetLabelData(nCurrentColumn));
-            pCurrentItemValue->maFunctionData.mnFuncMask = pDialog->GetFuncMask();
+            mpSubtotalDlg->FillLabelData(mpParent->GetLabelData(nCurrentColumn));
+            pCurrentItemValue->maFunctionData.mnFuncMask = mpSubtotalDlg->GetFuncMask();
         }
 
-        pDialog->disposeOnce();
+        mpSubtotalDlg.disposeAndClear();
     });
 
     return true;
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index b01286755e20..221fbea7c8ff 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -15,7 +15,6 @@
 
 #include <vcl/event.hxx>
 #include <pivot.hxx>
-#include <scabstdlg.hxx>
 #include <globstr.hrc>
 #include <scresid.hxx>
 
@@ -69,7 +68,13 @@ ScPivotLayoutTreeListData::ScPivotLayoutTreeListData(std::unique_ptr<weld::TreeV
 }
 
 ScPivotLayoutTreeListData::~ScPivotLayoutTreeListData()
-{}
+{
+    if (mpFunctionDlg)
+    {
+        mpFunctionDlg->Response(RET_CANCEL);
+        mpFunctionDlg.clear();
+    }
+}
 
 IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool)
 {
@@ -85,18 +90,17 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool
 
     ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create();
 
-    VclPtr<AbstractScDPFunctionDlg> pDialog(
-        pFactory->CreateScDPFunctionDlg(mxControl.get(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData));
+    mpFunctionDlg = pFactory->CreateScDPFunctionDlg(mxControl.get(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData);
 
-    pDialog->StartExecuteAsync([this, pDialog, pCurrentItemValue,
+    mpFunctionDlg->StartExecuteAsync([this, pCurrentItemValue, rCurrentFunctionData,
                                 rCurrentLabelData, nEntry](int nResult) mutable {
         if (nResult == RET_OK)
         {
             ScPivotFuncData& rFunctionData = pCurrentItemValue->maFunctionData;
-            rFunctionData.mnFuncMask = pDialog->GetFuncMask();
-            rCurrentLabelData.mnFuncMask = pDialog->GetFuncMask();
+            rCurrentFunctionData.mnFuncMask = mpFunctionDlg->GetFuncMask();
+            rCurrentLabelData.mnFuncMask = mpFunctionDlg->GetFuncMask();
 
-            rFunctionData.maFieldRef = pDialog->GetFieldRef();
+            rCurrentFunctionData.maFieldRef = mpFunctionDlg->GetFieldRef();
 
             ScDPLabelData& rDFData = mpParent->GetLabelData(rFunctionData.mnCol);
 
@@ -110,7 +114,7 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool
             mxControl->set_text(nEntry, sDataItemName);
         }
 
-        pDialog->disposeOnce();
+        mpFunctionDlg->disposeOnce();
     });
 
     return true;
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 45c831e998cd..21ad541f6675 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -482,6 +482,16 @@ ScDPSubtotalDlg::ScDPSubtotalDlg(weld::Widget* pParent, ScDPObject& rDPObj,
 
 ScDPSubtotalDlg::~ScDPSubtotalDlg()
 {
+    CloseSubdialog();
+}
+
+void ScDPSubtotalDlg::CloseSubdialog()
+{
+    if (mxOptionsDlg && mxOptionsDlg->getDialog())
+    {
+        mxOptionsDlg->getDialog()->response(RET_CANCEL);
+        mxOptionsDlg = nullptr;
+    }
 }
 
 PivotFunc ScDPSubtotalDlg::GetFuncMask() const
@@ -544,6 +554,8 @@ void ScDPSubtotalDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncDa
 
 IMPL_LINK(ScDPSubtotalDlg, ButtonClicked, weld::Button&, rButton, void)
 {
+    CloseSubdialog();
+
     if (&rButton == mxBtnOk.get())
         response(RET_OK);
     else
@@ -570,6 +582,7 @@ IMPL_LINK(ScDPSubtotalDlg, ClickHdl, weld::Button&, rBtn, void)
         weld::DialogController::runAsync(mxOptionsDlg, [this](int nResult) {
             if (nResult == RET_OK)
                 mxOptionsDlg->FillLabelData(maLabelData);
+            mxOptionsDlg = nullptr;
         });
     }
 }
diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx b/sc/source/ui/inc/PivotLayoutTreeList.hxx
index 3dfcc0551f19..9484326d504b 100644
--- a/sc/source/ui/inc/PivotLayoutTreeList.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx
@@ -14,6 +14,7 @@
 #include <memory>
 #include <tools/solar.h>
 #include "PivotLayoutTreeListBase.hxx"
+#include <scabstdlg.hxx>
 
 class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
 {
@@ -21,6 +22,8 @@ private:
     std::vector<std::unique_ptr<ScItemValue>> maItemValues;
     std::vector<ScDPName> maDataFieldNames;
 
+    VclPtr<AbstractScDPSubtotalDlg> mpSubtotalDlg;
+
     DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
     DECL_LINK(DoubleClickHdl, weld::TreeView&, bool);
 
diff --git a/sc/source/ui/inc/PivotLayoutTreeListData.hxx b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
index 5041ff12b8ea..74adc1781f03 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListData.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
@@ -15,6 +15,7 @@
 #include <tools/solar.h>
 #include <vector>
 #include <memory>
+#include <scabstdlg.hxx>
 
 class ScPivotLayoutTreeListData final : public ScPivotLayoutTreeListBase
 {
@@ -36,6 +37,8 @@ private:
     void AdjustDuplicateCount(ScItemValue* pInputItemValue);
 
     std::vector<std::unique_ptr<ScItemValue>> maDataItemValues;
+
+    VclPtr<AbstractScDPFunctionDlg> mpFunctionDlg;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx
index 6f562f39efa2..01f675909c38 100644
--- a/sc/source/ui/inc/pvfundlg.hxx
+++ b/sc/source/ui/inc/pvfundlg.hxx
@@ -107,6 +107,7 @@ public:
 
 private:
     void                Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
+    void                CloseSubdialog();
 
     DECL_LINK( DblClickHdl, weld::TreeView&, bool );
     DECL_LINK( RadioClickHdl, weld::Button&, void );


More information about the Libreoffice-commits mailing list