Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/weld/DialogController.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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
#include <vcl/svapp.hxx>
11
#include <vcl/weld/Builder.hxx>
12
#include <vcl/weld/DialogController.hxx>
13
#include <vcl/weld/Dialog.hxx>
14
#include <vcl/weld/MessageDialog.hxx>
15
16
namespace weld
17
{
18
0
short DialogController::run() { return getDialog()->run(); }
19
20
bool DialogController::runAsync(const std::shared_ptr<DialogController>& rController,
21
                                const std::function<void(sal_Int32)>& func)
22
0
{
23
0
    return rController->getDialog()->runAsync(rController, func);
24
0
}
25
26
0
void DialogController::set_title(const OUString& rTitle) { getDialog()->set_title(rTitle); }
27
28
0
OUString DialogController::get_title() const { return getConstDialog()->get_title(); }
29
30
0
void DialogController::set_help_id(const OUString& rHelpId) { getDialog()->set_help_id(rHelpId); }
31
32
0
OUString DialogController::get_help_id() const { return getConstDialog()->get_help_id(); }
33
34
0
void DialogController::response(int nResponse) { getDialog()->response(nResponse); }
35
36
0
DialogController::~DialogController() {}
37
38
0
Dialog* GenericDialogController::getDialog() { return m_xDialog.get(); }
39
40
GenericDialogController::GenericDialogController(weld::Widget* pParent, const OUString& rUIFile,
41
                                                 const OUString& rDialogId)
42
0
    : m_xBuilder(Application::CreateBuilder(pParent, rUIFile))
43
0
    , m_xDialog(m_xBuilder->weld_dialog(rDialogId))
44
0
{
45
0
}
46
47
0
GenericDialogController::~GenericDialogController() {}
48
49
0
Dialog* MessageDialogController::getDialog() { return m_xDialog.get(); }
50
51
MessageDialogController::MessageDialogController(weld::Widget* pParent, const OUString& rUIFile,
52
                                                 const OUString& rDialogId,
53
                                                 const OUString& rRelocateId)
54
0
    : m_xBuilder(Application::CreateBuilder(pParent, rUIFile))
55
0
    , m_xDialog(m_xBuilder->weld_message_dialog(rDialogId))
56
0
    , m_xContentArea(m_xDialog->weld_message_area())
57
0
{
58
0
    if (!rRelocateId.isEmpty())
59
0
    {
60
0
        m_xRelocate = m_xBuilder->weld_widget(rRelocateId);
61
0
        m_xOrigParent = m_xRelocate->weld_parent();
62
        //fdo#75121, a bit tricky because the widgets we want to align with
63
        //don't actually exist in the ui description, they're implied
64
0
        m_xOrigParent->move(m_xRelocate.get(), m_xContentArea.get());
65
0
    }
66
0
}
67
68
void MessageDialogController::set_primary_text(const OUString& rText)
69
0
{
70
0
    m_xDialog->set_primary_text(rText);
71
0
}
72
73
0
OUString MessageDialogController::get_primary_text() const { return m_xDialog->get_primary_text(); }
74
75
void MessageDialogController::set_secondary_text(const OUString& rText)
76
0
{
77
0
    m_xDialog->set_secondary_text(rText);
78
0
}
79
80
void MessageDialogController::set_default_response(int nResponse)
81
0
{
82
0
    m_xDialog->set_default_response(nResponse);
83
0
}
84
85
MessageDialogController::~MessageDialogController()
86
0
{
87
0
    if (m_xRelocate)
88
0
    {
89
0
        m_xContentArea->move(m_xRelocate.get(), m_xOrigParent.get());
90
0
    }
91
0
}
92
}
93
94
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */