Kaydet (Commit) 88ecd04a authored tarafından Caolán McNamara's avatar Caolán McNamara

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: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 10c6c352
...@@ -38,7 +38,7 @@ class PopupMenu; ...@@ -38,7 +38,7 @@ class PopupMenu;
class SalInstanceBuilder; class SalInstanceBuilder;
class ScreenshotTest; class ScreenshotTest;
class ScrollBar; class ScrollBar;
class SvHeaderTabListBox; class SvTabListBox;
class Slider; class Slider;
class DateField; class DateField;
class TimeField; class TimeField;
...@@ -220,7 +220,7 @@ private: ...@@ -220,7 +220,7 @@ private:
const ListStore* get_model_by_name(const OString& sID) const; const ListStore* get_model_by_name(const OString& sID) const;
void mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId); void mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
void mungeModel(ComboBox &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; typedef stringmap TextBuffer;
const TextBuffer* get_buffer_by_name(const OString& sID) const; const TextBuffer* get_buffer_by_name(const OString& sID) const;
......
...@@ -1765,7 +1765,7 @@ class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::Tr ...@@ -1765,7 +1765,7 @@ class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::Tr
private: private:
// owner for UserData // owner for UserData
std::vector<std::unique_ptr<OUString>> m_aUserData; std::vector<std::unique_ptr<OUString>> m_aUserData;
VclPtr<SvHeaderTabListBox> m_xTreeView; VclPtr<SvTabListBox> m_xTreeView;
DECL_LINK(SelectHdl, SvTreeListBox*, void); DECL_LINK(SelectHdl, SvTreeListBox*, void);
DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool); DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
...@@ -1773,7 +1773,7 @@ private: ...@@ -1773,7 +1773,7 @@ private:
DECL_LINK(EndDragHdl, HeaderBar*, void); DECL_LINK(EndDragHdl, HeaderBar*, void);
public: public:
SalInstanceTreeView(SvHeaderTabListBox* pTreeView, bool bTakeOwnership) SalInstanceTreeView(SvTabListBox* pTreeView, bool bTakeOwnership)
: SalInstanceContainer(pTreeView, bTakeOwnership) : SalInstanceContainer(pTreeView, bTakeOwnership)
, m_xTreeView(pTreeView) , m_xTreeView(pTreeView)
{ {
...@@ -1783,7 +1783,8 @@ public: ...@@ -1783,7 +1783,8 @@ public:
m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl)); m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl));
const long aTabPositions[] = { 0 }; const long aTabPositions[] = { 0 };
m_xTreeView->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions); 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 //make the last entry fill available space
pHeaderBar->SetItemSize(pHeaderBar->GetItemId(pHeaderBar->GetItemCount() - 1 ), HEADERBAR_FULLSIZE); pHeaderBar->SetItemSize(pHeaderBar->GetItemId(pHeaderBar->GetItemCount() - 1 ), HEADERBAR_FULLSIZE);
...@@ -1797,7 +1798,8 @@ public: ...@@ -1797,7 +1798,8 @@ public:
aTabPositions.push_back(0); aTabPositions.push_back(0);
aTabPositions.insert(aTabPositions.end(), rWidths.begin(), rWidths.end()); aTabPositions.insert(aTabPositions.end(), rWidths.begin(), rWidths.end());
m_xTreeView->SetTabs(aTabPositions.size(), aTabPositions.data(), MapUnit::MapPixel); 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) for (size_t i = 0; i < rWidths.size(); ++i)
pHeaderBar->SetItemSize(pHeaderBar->GetItemId(i), rWidths[i]); pHeaderBar->SetItemSize(pHeaderBar->GetItemId(i), rWidths[i]);
...@@ -2172,14 +2174,15 @@ public: ...@@ -2172,14 +2174,15 @@ public:
m_xTreeView->SetStyle(m_xTreeView->GetStyle() | WB_SORT); m_xTreeView->SetStyle(m_xTreeView->GetStyle() | WB_SORT);
} }
SvHeaderTabListBox& getTreeView() SvTabListBox& getTreeView()
{ {
return *m_xTreeView; return *m_xTreeView;
} }
virtual ~SalInstanceTreeView() override 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>()); pHeaderBar->SetEndDragHdl(Link<HeaderBar*, void>());
} }
...@@ -3318,7 +3321,7 @@ public: ...@@ -3318,7 +3321,7 @@ public:
virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id, bool bTakeOwnership) override 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; return pTreeView ? o3tl::make_unique<SalInstanceTreeView>(pTreeView, bTakeOwnership) : nullptr;
} }
......
...@@ -519,7 +519,7 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr ...@@ -519,7 +519,7 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
vcl::Window* pTarget = get<vcl::Window>(elem.m_sID); vcl::Window* pTarget = get<vcl::Window>(elem.m_sID);
ListBox *pListBoxTarget = dynamic_cast<ListBox*>(pTarget); ListBox *pListBoxTarget = dynamic_cast<ListBox*>(pTarget);
ComboBox *pComboBoxTarget = dynamic_cast<ComboBox*>(pTarget); ComboBox *pComboBoxTarget = dynamic_cast<ComboBox*>(pTarget);
SvHeaderTabListBox *pTreeBoxTarget = dynamic_cast<SvHeaderTabListBox*>(pTarget); SvTabListBox *pTreeBoxTarget = dynamic_cast<SvTabListBox*>(pTarget);
// pStore may be empty // pStore may be empty
const ListStore *pStore = get_model_by_name(elem.m_sValue.toUtf8()); const ListStore *pStore = get_model_by_name(elem.m_sValue.toUtf8());
SAL_WARN_IF(!pListBoxTarget && !pComboBoxTarget && !pTreeBoxTarget, "vcl", "missing elements of combobox"); 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 & ...@@ -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 //window we want to apply the packing props for this GtkTreeView to
VclPtr<vcl::Window> xWindowForPackingProps; VclPtr<vcl::Window> xWindowForPackingProps;
//To-Do //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 //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 //c) remove the users of makeSvTabListBox and makeSvTreeListBox
extractModel(id, rMap); extractModel(id, rMap);
WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE; 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 & ...@@ -1922,7 +1922,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
} }
else else
{ {
VclPtr<SvHeaderTabListBox> xBox; VclPtr<SvTabListBox> xBox;
bool bHeadersVisible = extractHeadersVisible(rMap); bool bHeadersVisible = extractHeadersVisible(rMap);
if (bHeadersVisible) if (bHeadersVisible)
{ {
...@@ -1936,16 +1936,17 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & ...@@ -1936,16 +1936,17 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
xHeader->SetHelpId(m_sHelpRoot + headerid); xHeader->SetHelpId(m_sHelpRoot + headerid);
m_aChildren.emplace_back(headerid, xHeader, true); m_aChildren.emplace_back(headerid, xHeader, true);
xBox = VclPtr<SvHeaderTabListBox>::Create(xContainer, nWinStyle); VclPtr<SvHeaderTabListBox> xHeaderBox = VclPtr<SvHeaderTabListBox>::Create(xContainer, nWinStyle);
xBox->InitHeaderBar(xHeader); xHeaderBox->InitHeaderBar(xHeader);
xContainer->set_expand(true); xContainer->set_expand(true);
xHeader->Show(); xHeader->Show();
xContainer->Show(); xContainer->Show();
xBox = xHeaderBox;
xWindowForPackingProps = xContainer; xWindowForPackingProps = xContainer;
} }
else else
{ {
xBox = VclPtr<SvHeaderTabListBox>::Create(pRealParent, nWinStyle); xBox = VclPtr<SvTabListBox>::Create(pRealParent, nWinStyle);
xWindowForPackingProps = xBox; xWindowForPackingProps = xBox;
} }
xWindow = xBox; xWindow = xBox;
...@@ -1959,8 +1960,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & ...@@ -1959,8 +1960,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
{ {
if (!m_bLegacy) if (!m_bLegacy)
{ {
SvHeaderTabListBox* pTreeView = static_cast<SvHeaderTabListBox*>(pParent); SvHeaderTabListBox* pTreeView = dynamic_cast<SvHeaderTabListBox*>(pParent);
if (HeaderBar* pHeaderBar = pTreeView->GetHeaderBar()) if (HeaderBar* pHeaderBar = pTreeView ? pTreeView->GetHeaderBar() : nullptr)
{ {
OUString sTitle(extractTitle(rMap)); OUString sTitle(extractTitle(rMap));
auto nItemId = pHeaderBar->GetItemCount() + 1; auto nItemId = pHeaderBar->GetItemCount() + 1;
...@@ -4149,7 +4150,7 @@ void VclBuilder::mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt1 ...@@ -4149,7 +4150,7 @@ void VclBuilder::mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt1
rTarget.SelectEntryPos(nActiveId); 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) for (auto const& entry : rStore.m_aEntries)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment