Coverage Report

Created: 2026-04-09 11:41

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
//#include <vcl/weld/weld.hxx>
28
29
class SfxTabPage;
30
class SfxBindings;
31
class SfxChildWindow;
32
struct SfxChildWinInfo;
33
class SfxItemSet;
34
class WhichRangesContainer;
35
namespace vcl { class ILibreOfficeKitNotifier; }
36
namespace weld { class Button; }
37
namespace weld { class Window; }
38
39
class SFX2_DLLPUBLIC SfxDialogController : public weld::GenericDialogController
40
{
41
private:
42
    DECL_DLLPRIVATE_STATIC_LINK(SfxDialogController, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*);
43
44
    DECL_DLLPRIVATE_LINK(FocusChangeHdl, weld::Container&, void);
45
46
public:
47
    SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, const OUString& rDialogId);
48
    // dialog gets focus
49
0
    virtual void Activate() {}
50
    // dialog loses focus
51
0
    virtual void Deactivate() {}
52
53
    // when the dialog has an associated SfxChildWin, typically for Modeless interaction
54
0
    virtual void ChildWinDispose() {} // called from the associated SfxChildWin dtor
55
    virtual void Close(); // called by the SfxChildWin when the dialog is closed
56
    virtual void EndDialog(int nResponse); // called by the SfxChildWin to close the dialog
57
0
    virtual bool CloseOnHide() const { return true; } // called from ScValidationDlg
58
};
59
60
class SfxModelessDialog_Impl;
61
62
class SFX2_DLLPUBLIC SfxModelessDialogController : public SfxDialogController
63
{
64
    SfxBindings* m_pBindings;
65
    std::unique_ptr<SfxModelessDialog_Impl> m_xImpl;
66
67
    SfxModelessDialogController(SfxModelessDialogController&) = delete;
68
    void operator =(SfxModelessDialogController&) = delete;
69
70
    void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
71
72
protected:
73
    SfxModelessDialogController(SfxBindings*, SfxChildWindow* pChildWin,
74
        weld::Window* pParent, const OUString& rUIXMLDescription, const OUString& rID);
75
76
public:
77
    virtual ~SfxModelessDialogController() override;
78
79
    void                    Initialize (SfxChildWinInfo const * pInfo);
80
    bool                    IsClosing() const;
81
    virtual void            Close() override;
82
    virtual void            EndDialog(int nResponse) override;
83
    virtual void            Activate() override;
84
    virtual void            Deactivate() override;
85
    virtual void            ChildWinDispose() override;
86
    virtual void            FillInfo(SfxChildWinInfo&) const;
87
0
    SfxBindings&            GetBindings() const { return *m_pBindings; }
88
};
89
90
typedef const WhichRangesContainer & (*GetTabPageRanges)(); // provides international Which values
91
92
class SFX2_DLLPUBLIC SfxOkDialogController : public SfxDialogController
93
{
94
public:
95
    SfxOkDialogController(weld::Widget* pParent, const OUString& rUIXMLDescription,
96
                          const OUString& rID)
97
0
        : SfxDialogController(pParent, rUIXMLDescription, rID)
98
0
    {
99
0
    }
100
101
    virtual weld::Button&       GetOKButton() const = 0;
102
    virtual const SfxItemSet* GetExampleSet() const = 0;
103
};
104
105
class SFX2_DLLPUBLIC SfxSingleTabDialogController : public SfxOkDialogController
106
{
107
private:
108
    std::unique_ptr<SfxItemSet> m_xOutputSet;
109
    const SfxItemSet* m_pInputSet;
110
111
public:
112
    SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet,
113
        const OUString& rUIXMLDescription = u"sfx/ui/singletabdialog.ui"_ustr,
114
        const OUString& rID = u"SingleTabDialog"_ustr);
115
116
    SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet,
117
        const OUString& rContainerId, const OUString& rUIXMLDescription,
118
        const OUString& rID);
119
120
0
    weld::Container* get_content_area() { return m_xContainer.get(); }
121
122
    virtual             ~SfxSingleTabDialogController() override;
123
124
    void                SetTabPage(std::unique_ptr<SfxTabPage> xTabPage);
125
0
    SfxTabPage*         GetTabPage() const { return m_xSfxPage.get(); }
126
127
0
    virtual weld::Button& GetOKButton() const override { return *m_xOKBtn; }
128
0
    virtual const SfxItemSet* GetExampleSet() const override { return nullptr; }
129
130
0
    const SfxItemSet*   GetOutputItemSet() const { return m_xOutputSet.get(); }
131
0
    const SfxItemSet*   GetInputItemSet() const { return m_pInputSet; }
132
133
protected:
134
    std::unique_ptr<SfxTabPage> m_xSfxPage;
135
    std::unique_ptr<weld::Container> m_xContainer;
136
    std::unique_ptr<weld::Button> m_xOKBtn;
137
138
    void                CreateOutputItemSet(const SfxItemSet& rInput);
139
0
    void                SetInputSet(const SfxItemSet* pInSet) { m_pInputSet = pInSet; }
140
    DECL_DLLPRIVATE_LINK(OKHdl_Impl, weld::Button&, void);
141
};
142
143
#endif
144
145
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */