diff options
author | Sumit Chauhan <sumitcn25@gmail.com> | 2019-07-20 02:43:15 +0530 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-07-22 06:36:27 +0200 |
commit | 22f2ecbcabf3928d5486690ca6465b7b37bc8a10 (patch) | |
tree | 281eb62271bbe44280a19163ad893813116e15fb /vcl | |
parent | 82c3e68642de445064313e353812b54df76c7fe9 (diff) |
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>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/NotebookBarAddonsMerger.cxx | 21 |
1 files changed, 18 insertions, 3 deletions
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(); } |