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:
parent
82c3e68642
commit
22f2ecbcab
@ -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);
|
||||
|
@ -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,22 +80,34 @@ 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);
|
||||
pToolbox->SetItemImage(nItemId, sImage);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
pToolbox->InsertSeparator();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user