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