summaryrefslogtreecommitdiff
path: root/sfx2/source/notebookbar
diff options
context:
space:
mode:
authorSumit Chauhan <sumitcn25@gmail.com>2019-07-15 22:19:00 +0530
committerSzymon Kłos <szymon.klos@collabora.com>2019-07-19 11:51:36 +0200
commitfbcd5f074ca3dc105f4fe45b6975c6de2bf60f35 (patch)
treec37b2ef5d2534de3bb32581381a3941cc3be3bed /sfx2/source/notebookbar
parent147e820cc1bd7110331a6ea73db678a4a6c324e0 (diff)
Engine to add Extension inside extension tab in NotebookBar
The patch provides backend for adding the extension.Schema for the adding extension in notebookbar can be seen here https://gerrit.libreoffice.org/#/c/75134/ Change-Id: I10f0e83d1aaec5330c80b3b53cf59a21b93be015 Reviewed-on: https://gerrit.libreoffice.org/75650 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sfx2/source/notebookbar')
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx46
1 files changed, 44 insertions, 2 deletions
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index d1fb95dd730a..3b56156b7c2c 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -30,17 +30,51 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <unotools/confignode.hxx>
#include <comphelper/types.hxx>
-
+#include <framework/addonsoptions.hxx>
+#include <vcl/NotebookBarAddonsMerger.hxx>
+#include <vector>
using namespace sfx2;
using namespace css::uno;
using namespace css::ui;
using namespace css;
#define MENUBAR_STR "private:resource/menubar/menubar"
+static const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier";
bool SfxNotebookBar::m_bLock = false;
bool SfxNotebookBar::m_bHide = false;
+static void NotebookbarAddonValues(
+ std::vector<Image>& aImageValues,
+ std::vector<css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>>>&
+ aExtensionValues)
+{
+ framework::AddonsOptions aAddonsItems;
+
+ for (int nIdx = 0; nIdx < aAddonsItems.GetAddonsNotebookBarCount(); nIdx++)
+ {
+ css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>> aExtension
+ = aAddonsItems.GetAddonsNotebookBarPart(nIdx);
+ for (int nSecIdx = 0; nSecIdx < aExtension.getLength(); nSecIdx++)
+ {
+ css::uno::Sequence<css::beans::PropertyValue> pExtensionVal = aExtension[nSecIdx];
+ Image aImage;
+
+ for (int nRes = 0; nRes < pExtensionVal.getLength(); nRes++)
+ {
+ OUString sImage;
+ if (pExtensionVal[nRes].Name == MERGE_NOTEBOOKBAR_IMAGEID)
+ {
+ pExtensionVal[nRes].Value >>= sImage;
+ aImage = framework::AddonsOptions().GetImageFromURL(sImage, false);
+ }
+ }
+ aImageValues.push_back(aImage);
+ }
+ aExtensionValues.push_back(aExtension);
+ }
+}
+
static Reference<frame::XLayoutManager> lcl_getLayoutManager( const Reference<frame::XFrame>& xFrame )
{
css::uno::Reference<css::frame::XLayoutManager> xLayoutManager;
@@ -336,8 +370,16 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
OUStringBuffer aBuf(rUIFile);
aBuf.append( sFile );
+ //Addons For Notebookbar
+ std::vector<Image> aImageValues;
+ std::vector<css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > > aExtensionValues;
+ NotebookBarAddonsItem aNotebookBarAddonsItem;
+ NotebookbarAddonValues(aImageValues , aExtensionValues);
+ aNotebookBarAddonsItem.aAddonValues = aExtensionValues;
+ aNotebookBarAddonsItem.aImageValues = aImageValues;
+
// setup if necessary
- pSysWindow->SetNotebookBar(aBuf.makeStringAndClear(), xFrame, bReloadNotebookbar);
+ pSysWindow->SetNotebookBar(aBuf.makeStringAndClear(), xFrame, aNotebookBarAddonsItem , bReloadNotebookbar);
pNotebookBar = pSysWindow->GetNotebookBar();
pNotebookBar->Show();
pNotebookBar->GetParent()->Resize();