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@collabora.com>
This commit is contained in:
Sumit Chauhan
2019-07-20 02:43:15 +05:30
committed by Szymon Kłos
parent 82c3e68642
commit 22f2ecbcab
2 changed files with 34 additions and 5 deletions

View File

@@ -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);

View File

@@ -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();
}