[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - include/vcl vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Nov 23 20:32:38 UTC 2018
include/vcl/builder.hxx | 4 ++--
vcl/source/app/salvtables.cxx | 17 ++++++++++-------
vcl/source/window/builder.cxx | 21 +++++++++++----------
3 files changed, 23 insertions(+), 19 deletions(-)
New commits:
commit 88ecd04a2b5d4a500fccf5c4e4dcd6e4094870f1
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Nov 23 14:56:54 2018 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Nov 23 21:32:12 2018 +0100
SvHeaderTabListBox a11y assumes it has a HeaderBar and fails if not
so only use it if there is a existing HeaderBar
Change-Id: I29c176702a5f546c787b2e6b6ee03a50f5c55347
Reviewed-on: https://gerrit.libreoffice.org/63888
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index a1a47b9f7047..5fdb061f7b1e 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -38,7 +38,7 @@ class PopupMenu;
class SalInstanceBuilder;
class ScreenshotTest;
class ScrollBar;
-class SvHeaderTabListBox;
+class SvTabListBox;
class Slider;
class DateField;
class TimeField;
@@ -220,7 +220,7 @@ private:
const ListStore* get_model_by_name(const OString& sID) const;
void mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
void mungeModel(ComboBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
- void mungeModel(SvHeaderTabListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
+ void mungeModel(SvTabListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
typedef stringmap TextBuffer;
const TextBuffer* get_buffer_by_name(const OString& sID) const;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 513717687e99..389a0b03c572 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1765,7 +1765,7 @@ class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::Tr
private:
// owner for UserData
std::vector<std::unique_ptr<OUString>> m_aUserData;
- VclPtr<SvHeaderTabListBox> m_xTreeView;
+ VclPtr<SvTabListBox> m_xTreeView;
DECL_LINK(SelectHdl, SvTreeListBox*, void);
DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
@@ -1773,7 +1773,7 @@ private:
DECL_LINK(EndDragHdl, HeaderBar*, void);
public:
- SalInstanceTreeView(SvHeaderTabListBox* pTreeView, bool bTakeOwnership)
+ SalInstanceTreeView(SvTabListBox* pTreeView, bool bTakeOwnership)
: SalInstanceContainer(pTreeView, bTakeOwnership)
, m_xTreeView(pTreeView)
{
@@ -1783,7 +1783,8 @@ public:
m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl));
const long aTabPositions[] = { 0 };
m_xTreeView->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions);
- if (HeaderBar* pHeaderBar = m_xTreeView->GetHeaderBar())
+ SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
//make the last entry fill available space
pHeaderBar->SetItemSize(pHeaderBar->GetItemId(pHeaderBar->GetItemCount() - 1 ), HEADERBAR_FULLSIZE);
@@ -1797,7 +1798,8 @@ public:
aTabPositions.push_back(0);
aTabPositions.insert(aTabPositions.end(), rWidths.begin(), rWidths.end());
m_xTreeView->SetTabs(aTabPositions.size(), aTabPositions.data(), MapUnit::MapPixel);
- if (HeaderBar* pHeaderBar = m_xTreeView->GetHeaderBar())
+ SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
for (size_t i = 0; i < rWidths.size(); ++i)
pHeaderBar->SetItemSize(pHeaderBar->GetItemId(i), rWidths[i]);
@@ -2172,14 +2174,15 @@ public:
m_xTreeView->SetStyle(m_xTreeView->GetStyle() | WB_SORT);
}
- SvHeaderTabListBox& getTreeView()
+ SvTabListBox& getTreeView()
{
return *m_xTreeView;
}
virtual ~SalInstanceTreeView() override
{
- if (HeaderBar* pHeaderBar = m_xTreeView->GetHeaderBar())
+ SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
pHeaderBar->SetEndDragHdl(Link<HeaderBar*, void>());
}
@@ -3318,7 +3321,7 @@ public:
virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id, bool bTakeOwnership) override
{
- SvHeaderTabListBox* pTreeView = m_xBuilder->get<SvHeaderTabListBox>(id);
+ SvTabListBox* pTreeView = m_xBuilder->get<SvTabListBox>(id);
return pTreeView ? o3tl::make_unique<SalInstanceTreeView>(pTreeView, bTakeOwnership) : nullptr;
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index a97608b1873f..30981b107533 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -519,7 +519,7 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
vcl::Window* pTarget = get<vcl::Window>(elem.m_sID);
ListBox *pListBoxTarget = dynamic_cast<ListBox*>(pTarget);
ComboBox *pComboBoxTarget = dynamic_cast<ComboBox*>(pTarget);
- SvHeaderTabListBox *pTreeBoxTarget = dynamic_cast<SvHeaderTabListBox*>(pTarget);
+ SvTabListBox *pTreeBoxTarget = dynamic_cast<SvTabListBox*>(pTarget);
// pStore may be empty
const ListStore *pStore = get_model_by_name(elem.m_sValue.toUtf8());
SAL_WARN_IF(!pListBoxTarget && !pComboBoxTarget && !pTreeBoxTarget, "vcl", "missing elements of combobox");
@@ -1899,9 +1899,9 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
//window we want to apply the packing props for this GtkTreeView to
VclPtr<vcl::Window> xWindowForPackingProps;
//To-Do
- //a) make SvHeaderTabListBox the default target for GtkTreeView
+ //a) make SvHeaderTabListBox/SvTabListBox the default target for GtkTreeView
//b) remove the non-drop down mode of ListBox and convert
- // everything over to SvHeaderTabListBox
+ // everything over to SvHeaderTabListBox/SvTabListBox
//c) remove the users of makeSvTabListBox and makeSvTreeListBox
extractModel(id, rMap);
WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE;
@@ -1922,7 +1922,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
}
else
{
- VclPtr<SvHeaderTabListBox> xBox;
+ VclPtr<SvTabListBox> xBox;
bool bHeadersVisible = extractHeadersVisible(rMap);
if (bHeadersVisible)
{
@@ -1936,16 +1936,17 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
xHeader->SetHelpId(m_sHelpRoot + headerid);
m_aChildren.emplace_back(headerid, xHeader, true);
- xBox = VclPtr<SvHeaderTabListBox>::Create(xContainer, nWinStyle);
- xBox->InitHeaderBar(xHeader);
+ VclPtr<SvHeaderTabListBox> xHeaderBox = VclPtr<SvHeaderTabListBox>::Create(xContainer, nWinStyle);
+ xHeaderBox->InitHeaderBar(xHeader);
xContainer->set_expand(true);
xHeader->Show();
xContainer->Show();
+ xBox = xHeaderBox;
xWindowForPackingProps = xContainer;
}
else
{
- xBox = VclPtr<SvHeaderTabListBox>::Create(pRealParent, nWinStyle);
+ xBox = VclPtr<SvTabListBox>::Create(pRealParent, nWinStyle);
xWindowForPackingProps = xBox;
}
xWindow = xBox;
@@ -1959,8 +1960,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
{
if (!m_bLegacy)
{
- SvHeaderTabListBox* pTreeView = static_cast<SvHeaderTabListBox*>(pParent);
- if (HeaderBar* pHeaderBar = pTreeView->GetHeaderBar())
+ SvHeaderTabListBox* pTreeView = dynamic_cast<SvHeaderTabListBox*>(pParent);
+ if (HeaderBar* pHeaderBar = pTreeView ? pTreeView->GetHeaderBar() : nullptr)
{
OUString sTitle(extractTitle(rMap));
auto nItemId = pHeaderBar->GetItemCount() + 1;
@@ -4149,7 +4150,7 @@ void VclBuilder::mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt1
rTarget.SelectEntryPos(nActiveId);
}
-void VclBuilder::mungeModel(SvHeaderTabListBox& rTarget, const ListStore &rStore, sal_uInt16 nActiveId)
+void VclBuilder::mungeModel(SvTabListBox& rTarget, const ListStore &rStore, sal_uInt16 nActiveId)
{
for (auto const& entry : rStore.m_aEntries)
{
More information about the Libreoffice-commits
mailing list