[Libreoffice-commits] core.git: sfx2/source vcl/source
Sumit Chauhan (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 22 04:37:05 UTC 2019
sfx2/source/notebookbar/SfxNotebookBar.cxx | 18 ++++++++++++++++--
vcl/source/window/NotebookBarAddonsMerger.cxx | 21 ++++++++++++++++++---
2 files changed, 34 insertions(+), 5 deletions(-)
New commits:
commit 22f2ecbcabf3928d5486690ca6465b7b37bc8a10
Author: Sumit Chauhan <sumitcn25 at gmail.com>
AuthorDate: Sat Jul 20 02:43:15 2019 +0530
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jul 22 06:36:27 2019 +0200
Patch fixes the image rendering issue of extension in NotebookBar
Change-Id: I7645766af1a6acfd7117fce3fcb29da038d9d92f
Reviewed-on: https://gerrit.libreoffice.org/75986
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 3b56156b7c2c..73ca5614935e 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -39,6 +39,8 @@ using namespace css::ui;
using namespace css;
#define MENUBAR_STR "private:resource/menubar/menubar"
+
+static const char MERGE_NOTEBOOKBAR_URL[] = "URL";
static const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier";
bool SfxNotebookBar::m_bLock = false;
@@ -59,14 +61,26 @@ static void NotebookbarAddonValues(
{
css::uno::Sequence<css::beans::PropertyValue> pExtensionVal = aExtension[nSecIdx];
Image aImage;
-
+ bool isBigImage = true;
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);
+ aImage = framework::AddonsOptions().GetImageFromURL(sImage, isBigImage);
+ }
+ }
+ if(!aImage)
+ {
+ for (int nRes = 0; nRes < pExtensionVal.getLength(); nRes++)
+ {
+ OUString sImage;
+ if (pExtensionVal[nRes].Name == MERGE_NOTEBOOKBAR_URL)
+ {
+ pExtensionVal[nRes].Value >>= sImage;
+ aImage = framework::AddonsOptions().GetImageFromURL(sImage, isBigImage);
+ }
}
}
aImageValues.push_back(aImage);
diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx b/vcl/source/window/NotebookBarAddonsMerger.cxx
index 9bab4a4ea425..d65aba9624f8 100644
--- a/vcl/source/window/NotebookBarAddonsMerger.cxx
+++ b/vcl/source/window/NotebookBarAddonsMerger.cxx
@@ -21,6 +21,9 @@
#include <vcl/commandinfoprovider.hxx>
#include <vcl/toolbox.hxx>
+static const char STYLE_TEXT[] = "Text";
+static const char STYLE_ICON[] = "Icon";
+
static const char MERGE_NOTEBOOKBAR_URL[] = "URL";
static const char MERGE_NOTEBOOKBAR_TITLE[] = "Title";
static const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier";
@@ -77,21 +80,33 @@ void NotebookBarAddonsMerger::MergeNotebookBarAddons(
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);
- pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel);
+
if (nIter < aImageVec.size())
{
- Image sImage = aImageVec[nIter];
+ 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);
}
- nIter++;
}
pToolbox->InsertSeparator();
}
More information about the Libreoffice-commits
mailing list