[Libreoffice-commits] core.git: include/vcl vcl/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Fri Nov 20 01:04:23 PST 2015
include/vcl/toolbox.hxx | 2 +-
vcl/source/window/builder.cxx | 6 ++----
vcl/source/window/menu.cxx | 4 +---
vcl/source/window/toolbox2.cxx | 5 +----
4 files changed, 5 insertions(+), 12 deletions(-)
New commits:
commit e58120920f5dd978213ea4387a42ae7e376b2922
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Fri Nov 20 07:44:17 2015 +0100
tdf#95938 Toolbar context menu has no commands
because of an integer overflow
Change-Id: I75103450d0af59fd6f3196f451984e0dce45c693
Reviewed-on: https://gerrit.libreoffice.org/20072
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 81f6297..362d942 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -78,7 +78,7 @@ inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent( ToolBox* pDropBox,
#define TOOLBOX_ITEM_NOTFOUND ((sal_uInt16)0xFFFF)
// item ids in the custom menu may not exceed this constant
-#define TOOLBOX_MENUITEM_START ((sal_uInt16)0xE000)
+#define TOOLBOX_MENUITEM_START ((sal_uInt16)0x1000)
// defines for the menubutton
#define TOOLBOX_MENUTYPE_NONE ((sal_uInt16)0x0000) // no menu at all, scrolling by spin buttons
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index ad80089..11efd79 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1668,10 +1668,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
}
else
{
- const sal_uInt16 COMMAND_ITEMID_START = 30000;
- nItemId = COMMAND_ITEMID_START + pToolBox->GetItemCount();
- pToolBox->InsertItem(nItemId,
- OStringToOUString(extractLabel(rMap), RTL_TEXTENCODING_UTF8), nBits);
+ nItemId = pToolBox->GetItemCount() + 1;
+ pToolBox->InsertItem(nItemId, OStringToOUString(extractLabel(rMap), RTL_TEXTENCODING_UTF8), nBits);
pToolBox->SetItemCommand(nItemId, aCommand);
pToolBox->SetHelpId(nItemId, m_sHelpRoot + id);
}
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 803c8a4..3a6e54c 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -533,9 +533,7 @@ void Menu::InsertItem(const OUString& rCommand, const uno::Reference<frame::XFra
OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, /*bLarge=*/ false, rFrame));
- // let's invent an ItemId
- const sal_uInt16 COMMAND_ITEMID_START = 30000;
- sal_uInt16 nItemId = COMMAND_ITEMID_START + GetItemCount();
+ sal_uInt16 nItemId = GetItemCount() + 1;
InsertItem(nItemId, aLabel, aImage, nBits, rIdent, nPos);
SetItemCommand(nItemId, rCommand);
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 8899577..26d7498 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -601,10 +601,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const uno::Reference<frame::X
OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommand, (GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE), rFrame));
- // let's invent an ItemId
- const sal_uInt16 COMMAND_ITEMID_START = 30000;
- sal_uInt16 nItemId = COMMAND_ITEMID_START + GetItemCount();
-
+ sal_uInt16 nItemId = GetItemCount() + 1;
InsertItem(nItemId, aImage, aLabel, nBits, nPos);
SetItemCommand(nItemId, rCommand);
SetQuickHelpText(nItemId, aTooltip);
More information about the Libreoffice-commits
mailing list