Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/sfx2/basedlgs.hxx
Line
Count
Source
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
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
#ifndef INCLUDED_SFX2_BASEDLGS_HXX
20
#define INCLUDED_SFX2_BASEDLGS_HXX
21
22
#include <memory>
23
#include <sal/config.h>
24
#include <sfx2/dllapi.h>
25
#include <tools/link.hxx>
26
#include <vcl/weld/DialogController.hxx>
27
28
class SfxTabPage;
29
class SfxBindings;
30
class SfxChildWindow;
31
struct SfxChildWinInfo;
32
class SfxItemSet;
33
class WhichRangesContainer;
34
namespace vcl { class ILibreOfficeKitNotifier; }
35
namespace weld { class Button; }
36
namespace weld { class Window; }
37
38
class SFX2_DLLPUBLIC SfxDialogController : public weld::GenericDialogController
39
{
40
private:
41
    DECL_DLLPRIVATE_STATIC_LINK(SfxDialogController, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*);
42
43
    DECL_DLLPRIVATE_LINK(FocusChangeHdl, weld::Container&, void);
44
45
public:
46
    SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, const OUString& rDialogId);
47
    // dialog gets focus
48
0
    virtual void Activate() {}
49
    // dialog loses focus
50
0
    virtual void Deactivate() {}
51
52
    // when the dialog has an associated SfxChildWin, typically for Modeless interaction
53
0
    virtual void ChildWinDispose() {} // called from the associated SfxChildWin dtor
54
    virtual void Close(); // called by the SfxChildWin when the dialog is closed
55
    virtual void EndDialog(int nResponse); // called by the SfxChildWin to close the dialog
56
0
    virtual bool CloseOnHide() const { return true; } // called from ScValidationDlg
57
};
58
59
class SfxModelessDialog_Impl;
60
61
class SFX2_DLLPUBLIC SfxModelessDialogController : public SfxDialogController
62
{
63
    SfxBindings* m_pBindings;
64
    std::unique_ptr<SfxModelessDialog_Impl> m_xImpl;
65
66
    SfxModelessDialogController(SfxModelessDialogController&) = delete;
67
    void operator =(SfxModelessDialogController&) = delete;
68
69
protected:
70
    SfxModelessDialogController(SfxBindings*, SfxChildWindow* pChildWin,
71
        weld::Window* pParent, const OUString& rUIXMLDescription, const OUString& rID);
72
73
public:
74
    virtual ~SfxModelessDialogController() override;
75
76
    void Initialize(const SfxChildWinInfo& rInfo);
77
    bool                    IsClosing() const;
78
    virtual void            Close() override;
79
    virtual void            EndDialog(int nResponse) override;
80
    virtual void            Activate() override;
81
    virtual void            Deactivate() override;
82
    virtual void            ChildWinDispose() override;
83
    virtual void            FillInfo(SfxChildWinInfo&) const;
84
0
    SfxBindings&            GetBindings() const { return *m_pBindings; }
85
};
86
87
typedef const WhichRangesContainer & (*GetTabPageRanges)(); // provides international Which values
88
89
class SFX2_DLLPUBLIC SfxOkDialogController : public SfxDialogController
90
{
91
public:
92
    SfxOkDialogController(weld::Widget* pParent, const OUString& rUIXMLDescription,
93
                          const OUString& rID)
94
0
        : SfxDialogController(pParent, rUIXMLDescription, rID)
95
0
    {
96
0
    }
97
98
    virtual weld::Button&       GetOKButton() const = 0;
99
    virtual const SfxItemSet* GetExampleSet() const = 0;
100
};
101
102
class SFX2_DLLPUBLIC SfxSingleTabDialogController : public SfxOkDialogController
103
{
104
private:
105
    std::unique_ptr<SfxItemSet> m_xOutputSet;
106
    const SfxItemSet* m_pInputSet;
107
108
public:
109
    SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet,
110
        const OUString& rUIXMLDescription = u"sfx/ui/singletabdialog.ui"_ustr,
111
        const OUString& rID = u"SingleTabDialog"_ustr);
112
113
    SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet,
114
        const OUString& rContainerId, const OUString& rUIXMLDescription,
115
        const OUString& rID);
116
117
0
    weld::Container* get_content_area() { return m_xContainer.get(); }
118
119
    virtual             ~SfxSingleTabDialogController() override;
120
121
    void                SetTabPage(std::unique_ptr<SfxTabPage> xTabPage);
122
0
    SfxTabPage*         GetTabPage() const { return m_xSfxPage.get(); }
123
124
0
    virtual weld::Button& GetOKButton() const override { return *m_xOKBtn; }
125
0
    virtual const SfxItemSet* GetExampleSet() const override { return nullptr; }
126
127
0
    const SfxItemSet*   GetOutputItemSet() const { return m_xOutputSet.get(); }
128
0
    const SfxItemSet*   GetInputItemSet() const { return m_pInputSet; }
129
130
protected:
131
    std::unique_ptr<SfxTabPage> m_xSfxPage;
132
    std::unique_ptr<weld::Container> m_xContainer;
133
    std::unique_ptr<weld::Button> m_xOKBtn;
134
135
    void                CreateOutputItemSet(const SfxItemSet& rInput);
136
0
    void                SetInputSet(const SfxItemSet* pInSet) { m_pInputSet = pInSet; }
137
    DECL_DLLPRIVATE_LINK(OKHdl_Impl, weld::Button&, void);
138
};
139
140
#endif
141
142
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */