LibreOffice Module svx (master) 1
AccessibilityCheckDialog.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 */
10
12
14#include <utility>
15#include <vcl/svapp.hxx>
16
17namespace svx
18{
20 weld::Container* pParent, std::shared_ptr<sfx::AccessibilityIssue> const& rAccessibilityIssue)
21 : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/accessibilitycheckentry.ui"))
22 , m_xContainer(m_xBuilder->weld_container("accessibilityCheckEntryBox"))
23 , m_xLabel(m_xBuilder->weld_label("accessibilityCheckEntryLabel"))
24 , m_xGotoButton(m_xBuilder->weld_button("accessibilityCheckEntryGotoButton"))
25 , m_pAccessibilityIssue(rAccessibilityIssue)
26{
27 m_xLabel->set_label(m_pAccessibilityIssue->m_aIssueText);
28 m_xGotoButton->set_visible(m_pAccessibilityIssue->canGotoIssue());
29 m_xGotoButton->connect_clicked(LINK(this, AccessibilityCheckEntry, GotoButtonClicked));
30 m_xContainer->show();
31}
32
34{
35 m_pAccessibilityIssue->gotoIssue();
36}
37
39 weld::Window* pParent, sfx::AccessibilityIssueCollection aIssueCollection,
40 std::function<sfx::AccessibilityIssueCollection()> getIssueCollection)
41 : GenericDialogController(pParent, "svx/ui/accessibilitycheckdialog.ui",
42 "AccessibilityCheckDialog")
43 , m_aIssueCollection(std::move(aIssueCollection))
44 , m_getIssueCollection(getIssueCollection)
45 , m_xAccessibilityCheckBox(m_xBuilder->weld_box("accessibilityCheckBox"))
46 , m_xRescanBtn(m_xBuilder->weld_button("rescan"))
47{
48 m_xRescanBtn->connect_clicked(LINK(this, AccessibilityCheckDialog, RescanButtonClicked));
49
51}
52
54
56{
57 sal_Int32 i = 0;
58 for (std::shared_ptr<sfx::AccessibilityIssue> const& pIssue : m_aIssueCollection.getIssues())
59 {
60 auto xEntry
61 = std::make_unique<AccessibilityCheckEntry>(m_xAccessibilityCheckBox.get(), pIssue);
62 m_xAccessibilityCheckBox->reorder_child(xEntry->get_widget(), i++);
63 m_aAccessibilityCheckEntries.push_back(std::move(xEntry));
64 }
65}
66
68{
69 // Remove old issue widgets
70 for (auto const& xEntry : m_aAccessibilityCheckEntries)
71 m_xAccessibilityCheckBox->move(xEntry->get_widget(), nullptr);
72
73 m_aIssueCollection = m_getIssueCollection();
74 populateIssues();
75}
76
77} // end svx namespace
78
79/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Label > m_xLabel
std::vector< std::shared_ptr< AccessibilityIssue > > & getIssues()
sfx::AccessibilityIssueCollection m_aIssueCollection
std::unique_ptr< weld::Box > m_xAccessibilityCheckBox
std::vector< std::unique_ptr< AccessibilityCheckEntry > > m_aAccessibilityCheckEntries
AccessibilityCheckDialog(weld::Window *pParent, sfx::AccessibilityIssueCollection rIssueCollection, std::function< sfx::AccessibilityIssueCollection()> getIssueCollection)
std::unique_ptr< weld::Button > m_xRescanBtn
std::unique_ptr< weld::Button > m_xGotoButton
std::unique_ptr< weld::Container > m_xContainer
std::shared_ptr< sfx::AccessibilityIssue > const & m_pAccessibilityIssue
AccessibilityCheckEntry(weld::Container *pParent, std::shared_ptr< sfx::AccessibilityIssue > const &pAccessibilityIssue)
std::unique_ptr< weld::Label > m_xLabel
int i
IMPL_LINK_NOARG(SuggestionDisplay, SelectSuggestionValueSetHdl, ValueSet *, void)
Reference< XNameAccess > m_xContainer