include/vcl/NotebookBarAddonsMerger.hxx | 9 +- include/vcl/OptionalBox.hxx | 9 -- sfx2/Library_sfx.mk | 1 sfx2/source/notebookbar/PriorityMergedHBox.cxx | 2 sw/uiconfig/swriter/ui/notebookbar.ui | 34 -------- vcl/Library_vcl.mk | 1 vcl/source/window/NotebookBarAddonsMerger.cxx | 104 ++++++++++++++++--------- vcl/source/window/OptionalBox.cxx | 4 vcl/source/window/builder.cxx | 5 - 9 files changed, 86 insertions(+), 83 deletions(-)
New commits: commit e0d29fb937b0f423f151e0a504bfe326f4d8279e Author: Sumit Chauhan <sumitc...@gmail.com> AuthorDate: Mon Aug 5 20:27:54 2019 +0530 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Aug 28 08:13:11 2019 +0200 GtkWidget for the priority of extension under Extension Tab. The new structure : PriorityMergedHBox --OptionalBox --ToolBoxExtension --Extension1 --OptionalBox ..... Change-Id: I72760e4f0d60eb6f1f82c1e928601d41a2e4b6ce Reviewed-on: https://gerrit.libreoffice.org/76987 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/include/vcl/NotebookBarAddonsMerger.hxx b/include/vcl/NotebookBarAddonsMerger.hxx index fde1196e4a63..ccd45ffb0f65 100644 --- a/include/vcl/NotebookBarAddonsMerger.hxx +++ b/include/vcl/NotebookBarAddonsMerger.hxx @@ -30,6 +30,7 @@ #include <com/sun/star/uno/Sequence.h> #include <memory> #include <vector> +#include <map> class PopupMenu; @@ -62,11 +63,15 @@ struct AddonNotebookBarItem class NotebookBarAddonsMerger { public: + typedef std::map<OString, OUString> stringmap; + typedef void (*customMakeWidget)(VclPtr<vcl::Window>& rRet, VclPtr<vcl::Window>& pParent, + stringmap& rVec); NotebookBarAddonsMerger(); ~NotebookBarAddonsMerger(); - static void MergeNotebookBarAddons(vcl::Window* pParent, + static void MergeNotebookBarAddons(vcl::Window* pParent, const customMakeWidget& pFunction, const css::uno::Reference<css::frame::XFrame>& rFrame, - const NotebookBarAddonsItem& aNotebookBarAddonsItem); + const NotebookBarAddonsItem& aNotebookBarAddonsItem, + stringmap rVec); static void MergeNotebookBarMenuAddons(PopupMenu* pPopupMenu, sal_Int16 nItemId, const OString& sItemIdName, NotebookBarAddonsItem& aNotebookBarAddonsItem); diff --git a/sfx2/source/notebookbar/OptionalBox.hxx b/include/vcl/OptionalBox.hxx similarity index 83% rename from sfx2/source/notebookbar/OptionalBox.hxx rename to include/vcl/OptionalBox.hxx index ad36540aed61..0b6731bd15c1 100644 --- a/sfx2/source/notebookbar/OptionalBox.hxx +++ b/include/vcl/OptionalBox.hxx @@ -17,19 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SFX2_NOTEBOOKBAR_OPTIONALBOX_HXX -#define INCLUDED_SFX2_NOTEBOOKBAR_OPTIONALBOX_HXX +#ifndef INCLUDED_VCL_OPTIONALBOX_HXX +#define INCLUDED_VCL_OPTIONALBOX_HXX #include <vcl/builderfactory.hxx> #include <vcl/IPrioritable.hxx> #include <vcl/layout.hxx> -#include <sfx2/dllapi.h> -#include <sfx2/viewfrm.hxx> #include <vcl/floatwin.hxx> #include <vcl/toolbox.hxx> -#include <sfx2/tbxctrl.hxx> -class SFX2_DLLPUBLIC OptionalBox : public VclHBox, public vcl::IPrioritable +class OptionalBox : public VclHBox, public vcl::IPrioritable { private: bool m_bInFullView; diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 6abba0617c7f..2ca29436aff7 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -238,7 +238,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/inet/inettbc \ sfx2/source/notebookbar/ContextVBox \ sfx2/source/notebookbar/DropdownBox \ - sfx2/source/notebookbar/OptionalBox \ sfx2/source/notebookbar/PriorityHBox \ sfx2/source/notebookbar/PriorityMergedHBox \ sfx2/source/notebookbar/SfxNotebookBar \ diff --git a/sfx2/source/notebookbar/PriorityMergedHBox.cxx b/sfx2/source/notebookbar/PriorityMergedHBox.cxx index 4e7fa0c16d2a..e187306ff437 100644 --- a/sfx2/source/notebookbar/PriorityMergedHBox.cxx +++ b/sfx2/source/notebookbar/PriorityMergedHBox.cxx @@ -22,7 +22,7 @@ #include <sfx2/dllapi.h> #include <sfx2/viewfrm.hxx> #include <bitmaps.hlst> -#include "OptionalBox.hxx" +#include <vcl/OptionalBox.hxx> #include "PriorityHBox.hxx" #include "NotebookbarPopup.hxx" diff --git a/sw/uiconfig/swriter/ui/notebookbar.ui b/sw/uiconfig/swriter/ui/notebookbar.ui index c7c8ac3976c1..06149f4798ce 100644 --- a/sw/uiconfig/swriter/ui/notebookbar.ui +++ b/sw/uiconfig/swriter/ui/notebookbar.ui @@ -17440,46 +17440,16 @@ <property name="valign">center</property> <property name="vexpand">True</property> <child> - <object class="sfxlo-OptionalBox" id="AddonSections"> + <object class="NotebookBarAddonsToolMergePoint" id="AddonCommands"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> <property name="vexpand">True</property> - <child> - <object class="sfxlo-NotebookbarToolBox" id="SectionBottom52"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">center</property> - <property name="vexpand">True</property> - <property name="toolbar_style">both</property> - <property name="show_arrow">False</property> - <property name="icon_size">3</property> - <child> - <object class="NotebookBarAddonsToolMergePoint" id="AddonCommand"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action_name">AddonCommand</property> - </object> - <packing> - <property name="expand">False</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> - <style> - <class name="priority-30"/> - </style> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> </object> diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index a1fc61a12be7..c8e4aa75dccb 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -160,6 +160,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/window/mouse \ vcl/source/window/msgbox \ vcl/source/window/NotebookBarAddonsMerger \ + vcl/source/window/OptionalBox \ vcl/source/window/popupmenuwindow \ vcl/source/window/printdlg \ vcl/source/window/scrwnd \ diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx b/vcl/source/window/NotebookBarAddonsMerger.cxx index 5fc0b14b8087..f9f4c70343fa 100644 --- a/vcl/source/window/NotebookBarAddonsMerger.cxx +++ b/vcl/source/window/NotebookBarAddonsMerger.cxx @@ -21,6 +21,10 @@ #include <vcl/commandinfoprovider.hxx> #include <vcl/vclenum.hxx> #include <vcl/toolbox.hxx> +#include <osl/module.hxx> +#include <vcl/OptionalBox.hxx> +#include <sfx2/sidebar/SidebarToolBox.hxx> +#include <vcl/IPrioritable.hxx> static const char STYLE_TEXT[] = "Text"; static const char STYLE_ICON[] = "Icon"; @@ -58,16 +62,61 @@ static void GetAddonNotebookBarItem(const css::uno::Sequence<css::beans::Propert } } +static void CreateNotebookBarToolBox(vcl::Window* pNotebookbarToolBox, + const css::uno::Reference<css::frame::XFrame>& m_xFrame, + const AddonNotebookBarItem& aAddonNotebookBarItem, + const std::vector<Image>& aImageVec, + const unsigned long& nIter) +{ + sal_uInt16 nItemId = 0; + ToolBox* pToolbox = dynamic_cast<ToolBox*>(pNotebookbarToolBox); + if (pToolbox) + { + pToolbox->InsertSeparator(); + pToolbox->Show(); + Size aSize(0, 0); + Image sImage; + pToolbox->InsertItem(aAddonNotebookBarItem.sCommandURL, m_xFrame, ToolBoxItemBits::NONE, + aSize); + nItemId = pToolbox->GetItemId(aAddonNotebookBarItem.sCommandURL); + pToolbox->SetItemCommand(nItemId, aAddonNotebookBarItem.sCommandURL); + pToolbox->SetQuickHelpText(nItemId, aAddonNotebookBarItem.sLabel); + + if (nIter < aImageVec.size()) + { + sImage = aImageVec[nIter]; + if (!sImage) + { + sImage = vcl::CommandInfoProvider::GetImageForCommand( + aAddonNotebookBarItem.sImageIdentifier, m_xFrame); + } + } + + if (aAddonNotebookBarItem.sStyle == STYLE_TEXT) + pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel); + else if (aAddonNotebookBarItem.sStyle == STYLE_ICON) + pToolbox->SetItemImage(nItemId, sImage); + else + { + pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel); + pToolbox->SetItemImage(nItemId, sImage); + } + pToolbox->Show(); + } +} + NotebookBarAddonsMerger::NotebookBarAddonsMerger() {} NotebookBarAddonsMerger::~NotebookBarAddonsMerger() {} void NotebookBarAddonsMerger::MergeNotebookBarAddons( - vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& m_xFrame, - const NotebookBarAddonsItem& aNotebookBarAddonsItem) + vcl::Window* pParent, const customMakeWidget& pFunction, + const css::uno::Reference<css::frame::XFrame>& m_xFrame, + const NotebookBarAddonsItem& aNotebookBarAddonsItem, NotebookBarAddonsMerger::stringmap rMap) { std::vector<Image> aImageVec = aNotebookBarAddonsItem.aImageValues; unsigned long nIter = 0; + sal_uInt16 nPriorityIdx = aImageVec.size(); css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>> aExtension; for (unsigned long nIdx = 0; nIdx < aNotebookBarAddonsItem.aAddonValues.size(); nIdx++) { @@ -75,44 +124,25 @@ void NotebookBarAddonsMerger::MergeNotebookBarAddons( for (int nSecIdx = 0; nSecIdx < aExtension.getLength(); nSecIdx++) { - sal_uInt16 nItemId = 0; + VclPtr<vcl::Window> pOptionalParent; + pOptionalParent = VclPtr<OptionalBox>::Create(pParent); + pOptionalParent->Show(); + + vcl::IPrioritable* pPrioritable + = dynamic_cast<vcl::IPrioritable*>(pOptionalParent.get()); + if (pPrioritable) + pPrioritable->SetPriority(nPriorityIdx - nIter); + + VclPtr<vcl::Window> pNotebookbarToolBox; + pFunction(pNotebookbarToolBox, pOptionalParent, rMap); + AddonNotebookBarItem aAddonNotebookBarItem; const css::uno::Sequence<css::beans::PropertyValue> pExtension = aExtension[nSecIdx]; GetAddonNotebookBarItem(pExtension, aAddonNotebookBarItem); - ToolBox* pToolbox = dynamic_cast<ToolBox*>(pParent); - if (pToolbox) - { - Size aSize(0, 0); - Image sImage; - pToolbox->InsertItem(aAddonNotebookBarItem.sCommandURL, m_xFrame, - ToolBoxItemBits::NONE, aSize); - nItemId = pToolbox->GetItemId(aAddonNotebookBarItem.sCommandURL); - pToolbox->SetItemCommand(nItemId, aAddonNotebookBarItem.sCommandURL); - pToolbox->SetQuickHelpText(nItemId, aAddonNotebookBarItem.sLabel); - - if (nIter < aImageVec.size()) - { - sImage = aImageVec[nIter]; - if (!sImage) - { - sImage = vcl::CommandInfoProvider::GetImageForCommand( - aAddonNotebookBarItem.sImageIdentifier, m_xFrame); - } - nIter++; - } - - if (aAddonNotebookBarItem.sStyle == STYLE_TEXT) - pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel); - else if (aAddonNotebookBarItem.sStyle == STYLE_ICON) - pToolbox->SetItemImage(nItemId, sImage); - else - { - pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel); - pToolbox->SetItemImage(nItemId, sImage); - } - } - if (nSecIdx == aExtension.getLength() - 1) - pToolbox->InsertSeparator(); + + CreateNotebookBarToolBox(pNotebookbarToolBox, m_xFrame, aAddonNotebookBarItem, + aImageVec, nIter); + nIter++; } } } diff --git a/sfx2/source/notebookbar/OptionalBox.cxx b/vcl/source/window/OptionalBox.cxx similarity index 95% rename from sfx2/source/notebookbar/OptionalBox.cxx rename to vcl/source/window/OptionalBox.cxx index 6a343ce48d07..6f47b468f194 100644 --- a/sfx2/source/notebookbar/OptionalBox.cxx +++ b/vcl/source/window/OptionalBox.cxx @@ -19,9 +19,7 @@ #include <vcl/builderfactory.hxx> #include <vcl/layout.hxx> -#include <sfx2/dllapi.h> -#include <sfx2/viewfrm.hxx> -#include "OptionalBox.hxx" +#include <vcl/OptionalBox.hxx> /* * OptionalBox - shows or hides the content. To use with PriorityHBox diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 3b7db3eea3ab..b4678d20d77e 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2187,7 +2187,10 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & } else if (name == "NotebookBarAddonsToolMergePoint") { - NotebookBarAddonsMerger::MergeNotebookBarAddons(pParent, m_xFrame, m_pNotebookBarAddonsItem); + customMakeWidget pFunction = nullptr; + ModuleMap::iterator aI = g_aModuleMap.find("libsfxlo.so"); + pFunction = reinterpret_cast<customMakeWidget>(aI->second->getFunctionSymbol("makeNotebookbarToolBox")); + NotebookBarAddonsMerger::MergeNotebookBarAddons( pParent, pFunction, m_xFrame, m_pNotebookBarAddonsItem, rMap ); return nullptr; } else if (name == "GtkToolButton" || name == "GtkMenuToolButton" || _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits