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:
committed by
Szymon Kłos
parent
82c3e68642
commit
22f2ecbcab
@@ -39,6 +39,8 @@ using namespace css::ui;
|
|||||||
using namespace css;
|
using namespace css;
|
||||||
|
|
||||||
#define MENUBAR_STR "private:resource/menubar/menubar"
|
#define MENUBAR_STR "private:resource/menubar/menubar"
|
||||||
|
|
||||||
|
static const char MERGE_NOTEBOOKBAR_URL[] = "URL";
|
||||||
static const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier";
|
static const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier";
|
||||||
|
|
||||||
bool SfxNotebookBar::m_bLock = false;
|
bool SfxNotebookBar::m_bLock = false;
|
||||||
@@ -59,14 +61,26 @@ static void NotebookbarAddonValues(
|
|||||||
{
|
{
|
||||||
css::uno::Sequence<css::beans::PropertyValue> pExtensionVal = aExtension[nSecIdx];
|
css::uno::Sequence<css::beans::PropertyValue> pExtensionVal = aExtension[nSecIdx];
|
||||||
Image aImage;
|
Image aImage;
|
||||||
|
bool isBigImage = true;
|
||||||
for (int nRes = 0; nRes < pExtensionVal.getLength(); nRes++)
|
for (int nRes = 0; nRes < pExtensionVal.getLength(); nRes++)
|
||||||
{
|
{
|
||||||
OUString sImage;
|
OUString sImage;
|
||||||
if (pExtensionVal[nRes].Name == MERGE_NOTEBOOKBAR_IMAGEID)
|
if (pExtensionVal[nRes].Name == MERGE_NOTEBOOKBAR_IMAGEID)
|
||||||
{
|
{
|
||||||
pExtensionVal[nRes].Value >>= sImage;
|
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);
|
aImageValues.push_back(aImage);
|
||||||
|
@@ -21,6 +21,9 @@
|
|||||||
#include <vcl/commandinfoprovider.hxx>
|
#include <vcl/commandinfoprovider.hxx>
|
||||||
#include <vcl/toolbox.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_URL[] = "URL";
|
||||||
static const char MERGE_NOTEBOOKBAR_TITLE[] = "Title";
|
static const char MERGE_NOTEBOOKBAR_TITLE[] = "Title";
|
||||||
static const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier";
|
static const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier";
|
||||||
@@ -77,22 +80,34 @@ void NotebookBarAddonsMerger::MergeNotebookBarAddons(
|
|||||||
if (pToolbox)
|
if (pToolbox)
|
||||||
{
|
{
|
||||||
Size aSize(0, 0);
|
Size aSize(0, 0);
|
||||||
|
Image sImage;
|
||||||
pToolbox->InsertItem(aAddonNotebookBarItem.sCommandURL, m_xFrame,
|
pToolbox->InsertItem(aAddonNotebookBarItem.sCommandURL, m_xFrame,
|
||||||
ToolBoxItemBits::NONE, aSize);
|
ToolBoxItemBits::NONE, aSize);
|
||||||
nItemId = pToolbox->GetItemId(aAddonNotebookBarItem.sCommandURL);
|
nItemId = pToolbox->GetItemId(aAddonNotebookBarItem.sCommandURL);
|
||||||
pToolbox->SetItemCommand(nItemId, aAddonNotebookBarItem.sCommandURL);
|
pToolbox->SetItemCommand(nItemId, aAddonNotebookBarItem.sCommandURL);
|
||||||
pToolbox->SetQuickHelpText(nItemId, aAddonNotebookBarItem.sLabel);
|
pToolbox->SetQuickHelpText(nItemId, aAddonNotebookBarItem.sLabel);
|
||||||
pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel);
|
|
||||||
if (nIter < aImageVec.size())
|
if (nIter < aImageVec.size())
|
||||||
{
|
{
|
||||||
Image sImage = aImageVec[nIter];
|
sImage = aImageVec[nIter];
|
||||||
if (!sImage)
|
if (!sImage)
|
||||||
|
{
|
||||||
sImage = vcl::CommandInfoProvider::GetImageForCommand(
|
sImage = vcl::CommandInfoProvider::GetImageForCommand(
|
||||||
aAddonNotebookBarItem.sImageIdentifier, m_xFrame);
|
aAddonNotebookBarItem.sImageIdentifier, m_xFrame);
|
||||||
pToolbox->SetItemImage(nItemId, sImage);
|
|
||||||
}
|
}
|
||||||
nIter++;
|
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();
|
pToolbox->InsertSeparator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user