summaryrefslogtreecommitdiff
path: root/vcl/jsdialog
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-06-23 12:49:17 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2020-07-03 12:13:39 +0200
commit9eaaf3b7e1d55d064c0518cbbb7bb724e219e10a (patch)
tree89f24ef15a4c0cf3e3707b2f305eb01d7454c60e /vcl/jsdialog
parent645021ad49628319423ad29d866d7adb3aee9d97 (diff)
jsdialog: get widget depending on viewshell
Notebookbar always gets window id 0 what causes conflict in map and some widgets doesn't work Change-Id: I15b4e83d385e83bcf898148a871ddf540257cc81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97099 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97816 Tested-by: Jenkins
Diffstat (limited to 'vcl/jsdialog')
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 1932bcbd7d02..767a465c5f3f 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -85,7 +85,8 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR
JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot,
const OUString& rUIFile,
- const css::uno::Reference<css::frame::XFrame>& rFrame)
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ sal_uInt64 nWindowId)
: SalInstanceBuilder(pParent, rUIRoot, rUIFile, rFrame)
, m_nWindowId(0)
, m_aParentDialog(nullptr)
@@ -97,23 +98,25 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo
m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier();
if (m_aParentDialog)
m_nWindowId = m_aParentDialog->GetLOKWindowId();
+ if (!m_nWindowId && nWindowId)
+ m_nWindowId = nWindowId;
InsertWindowToMap(m_nWindowId);
}
}
JSInstanceBuilder::~JSInstanceBuilder() { GetLOKWeldWidgetsMap().erase(m_nWindowId); }
-std::map<vcl::LOKWindowId, WidgetMap>& JSInstanceBuilder::GetLOKWeldWidgetsMap()
+std::map<sal_uInt64, WidgetMap>& JSInstanceBuilder::GetLOKWeldWidgetsMap()
{
// Map to remember the LOKWindowId <-> weld widgets binding.
- static std::map<vcl::LOKWindowId, WidgetMap> s_aLOKWeldBuildersMap;
+ static std::map<sal_uInt64, WidgetMap> s_aLOKWeldBuildersMap;
return s_aLOKWeldBuildersMap;
}
namespace jsdialog
{
-weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWidget)
+weld::Widget* FindWeldWidgetsMap(sal_uInt64 nWindowId, const OString& rWidget)
{
const auto it = JSInstanceBuilder::GetLOKWeldWidgetsMap().find(nWindowId);
@@ -128,13 +131,12 @@ weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWid
}
}
-void JSInstanceBuilder::InsertWindowToMap(int nWindowId)
+void JSInstanceBuilder::InsertWindowToMap(sal_uInt64 nWindowId)
{
WidgetMap map;
auto it = GetLOKWeldWidgetsMap().find(nWindowId);
if (it == GetLOKWeldWidgetsMap().end())
- GetLOKWeldWidgetsMap().insert(
- std::map<vcl::LOKWindowId, WidgetMap>::value_type(nWindowId, map));
+ GetLOKWeldWidgetsMap().insert(std::map<sal_uInt64, WidgetMap>::value_type(nWindowId, map));
}
void JSInstanceBuilder::RememberWidget(const OString& id, weld::Widget* pWidget)