LibreOffice Module sfx2 (master) 1
basedlgs.hxx
Go to the documentation of this file.
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
27class SfxTabPage;
28class SfxBindings;
29class SfxChildWindow;
30struct SfxChildWinInfo;
31class SfxItemSet;
33
35{
36private:
38
39 DECL_DLLPRIVATE_LINK(FocusChangeHdl, weld::Container&, void);
40
41public:
42 SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, const OUString& rDialogId);
43 // dialog gets focus
44 virtual void Activate() {}
45 // dialog loses focus
46 virtual void Deactivate() {}
47
48 // when the dialog has an associated SfxChildWin, typically for Modeless interaction
49 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 virtual bool CloseOnHide() const { return true; } // called from ScValidationDlg
53};
54
56
58{
60 std::unique_ptr<SfxModelessDialog_Impl> m_xImpl;
61
63 void operator =(SfxModelessDialogController&) = delete;
64
65 void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
66
67protected:
69 weld::Window* pParent, const OUString& rUIXMLDescription, const OUString& rID);
70
71public:
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 SfxBindings& GetBindings() const { return *m_pBindings; }
83};
84
85typedef WhichRangesContainer (*GetTabPageRanges)(); // provides international Which values
86
88{
89public:
90 SfxOkDialogController(weld::Widget* pParent, const OUString& rUIXMLDescription,
91 const OUString& rID)
92 : SfxDialogController(pParent, rUIXMLDescription, rID)
93 {
94 }
95
96 virtual weld::Button& GetOKButton() const = 0;
97 virtual const SfxItemSet* GetExampleSet() const = 0;
98};
99
101{
102private:
103 std::unique_ptr<SfxItemSet> m_xOutputSet;
105
106public:
107 SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet,
108 const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"),
109 const OUString& rID = OUString("SingleTabDialog"));
110
111 SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet,
112 const OUString& rContainerId, const OUString& rUIXMLDescription,
113 const OUString& rID);
114
116
117 virtual ~SfxSingleTabDialogController() override;
118
119 void SetTabPage(std::unique_ptr<SfxTabPage> xTabPage);
120 SfxTabPage* GetTabPage() const { return m_xSfxPage.get(); }
121
122 virtual weld::Button& GetOKButton() const override { return *m_xOKBtn; }
123 virtual const SfxItemSet* GetExampleSet() const override { return nullptr; }
124
125 const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); }
126 const SfxItemSet* GetInputItemSet() const { return m_pInputSet; }
127
128protected:
129 std::unique_ptr<SfxTabPage> m_xSfxPage;
130 std::unique_ptr<weld::Container> m_xContainer;
131 std::unique_ptr<weld::Button> m_xOKBtn;
132 std::unique_ptr<weld::Button> m_xHelpBtn;
133
134 void CreateOutputItemSet(const SfxItemSet& rInput);
135 void SetInputSet(const SfxItemSet* pInSet) { m_pInputSet = pInSet; }
137};
138
139#endif
140
141/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
WhichRangesContainer(* GetTabPageRanges)()
Definition: basedlgs.hxx:85
DECL_DLLPRIVATE_LINK(FocusChangeHdl, weld::Container &, void)
virtual void Activate()
Definition: basedlgs.hxx:44
virtual void ChildWinDispose()
Definition: basedlgs.hxx:49
DECL_DLLPRIVATE_STATIC_LINK(SfxDialogController, InstallLOKNotifierHdl, void *, vcl::ILibreOfficeKitNotifier *)
virtual bool CloseOnHide() const
Definition: basedlgs.hxx:52
virtual void Deactivate()
Definition: basedlgs.hxx:46
SfxBindings * m_pBindings
Definition: basedlgs.hxx:59
SfxBindings & GetBindings() const
Definition: basedlgs.hxx:82
SfxModelessDialogController(SfxModelessDialogController &)=delete
std::unique_ptr< SfxModelessDialog_Impl > m_xImpl
Definition: basedlgs.hxx:60
virtual weld::Button & GetOKButton() const =0
virtual const SfxItemSet * GetExampleSet() const =0
SfxOkDialogController(weld::Widget *pParent, const OUString &rUIXMLDescription, const OUString &rID)
Definition: basedlgs.hxx:90
DECL_DLLPRIVATE_LINK(OKHdl_Impl, weld::Button &, void)
const SfxItemSet * GetOutputItemSet() const
Definition: basedlgs.hxx:125
void SetInputSet(const SfxItemSet *pInSet)
Definition: basedlgs.hxx:135
std::unique_ptr< weld::Button > m_xHelpBtn
Definition: basedlgs.hxx:132
virtual weld::Button & GetOKButton() const override
Definition: basedlgs.hxx:122
weld::Container * get_content_area()
Definition: basedlgs.hxx:115
SfxTabPage * GetTabPage() const
Definition: basedlgs.hxx:120
virtual const SfxItemSet * GetExampleSet() const override
Definition: basedlgs.hxx:123
const SfxItemSet * m_pInputSet
Definition: basedlgs.hxx:104
std::unique_ptr< SfxTabPage > m_xSfxPage
Definition: basedlgs.hxx:129
std::unique_ptr< weld::Button > m_xOKBtn
Definition: basedlgs.hxx:131
std::unique_ptr< SfxItemSet > m_xOutputSet
Definition: basedlgs.hxx:103
const SfxItemSet * GetInputItemSet() const
Definition: basedlgs.hxx:126
std::unique_ptr< weld::Container > m_xContainer
Definition: basedlgs.hxx:130
void Init()
virtual void EndDialog(sal_Int32 nResult) override
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
Close
Reference< XNameAccess > m_xContainer