1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
11 #include <svx/GenericCheckDialog.hxx>
12 #include <vcl/svapp.hxx>
16 GenericCheckEntry::GenericCheckEntry(weld::Container
* pParent
,
17 std::unique_ptr
<CheckData
>& pCheckData
)
18 : m_xBuilder(Application::CreateBuilder(pParent
, "svx/ui/genericcheckentry.ui"))
19 , m_xContainer(m_xBuilder
->weld_container("checkEntryBox"))
20 , m_xLabel(m_xBuilder
->weld_label("label"))
21 , m_xMarkButton(m_xBuilder
->weld_button("markButton"))
22 , m_xPropertiesButton(m_xBuilder
->weld_button("propertiesButton"))
23 , m_pCheckData(pCheckData
)
25 m_xLabel
->set_label(m_pCheckData
->getText());
26 m_xMarkButton
->set_visible(m_pCheckData
->canMarkObject());
27 m_xMarkButton
->connect_clicked(LINK(this, GenericCheckEntry
, MarkButtonClicked
));
28 m_xPropertiesButton
->set_visible(m_pCheckData
->hasProperties());
29 m_xPropertiesButton
->connect_clicked(LINK(this, GenericCheckEntry
, PropertiesButtonClicked
));
34 IMPL_LINK_NOARG(GenericCheckEntry
, MarkButtonClicked
, weld::Button
&, void)
36 m_pCheckData
->markObject();
39 IMPL_LINK_NOARG(GenericCheckEntry
, PropertiesButtonClicked
, weld::Button
&, void)
41 m_pCheckData
->runProperties();
44 GenericCheckDialog::GenericCheckDialog(weld::Window
* pParent
,
45 CheckDataCollection
& rCheckDataCollection
)
46 : GenericDialogController(pParent
, "svx/ui/genericcheckdialog.ui", "GenericCheckDialog")
47 , m_rCheckDataCollection(rCheckDataCollection
)
48 , m_xCheckBox(m_xBuilder
->weld_box("checkBox"))
50 set_title(m_rCheckDataCollection
.getTitle());
53 GenericCheckDialog::~GenericCheckDialog() {}
55 short GenericCheckDialog::run()
59 for (std::unique_ptr
<CheckData
>& pCheckData
: m_rCheckDataCollection
.getCollection())
61 auto xEntry
= std::make_unique
<GenericCheckEntry
>(m_xCheckBox
.get(), pCheckData
);
62 m_xCheckBox
->reorder_child(xEntry
->get_widget(), i
++);
63 m_aCheckEntries
.push_back(std::move(xEntry
));
65 return GenericDialogController::run();
68 } // end svx namespace
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */