1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SFX2_BASEDLGS_HXX
20 #define INCLUDED_SFX2_BASEDLGS_HXX
23 #include <sal/config.h>
24 #include <sfx2/dllapi.h>
25 #include <sal/types.h>
26 #include <vcl/floatwin.hxx>
27 #include <vcl/weld.hxx>
32 struct SfxChildWinInfo
;
36 class SFX2_DLLPUBLIC SfxDialogController
: public weld::GenericDialogController
39 DECL_DLLPRIVATE_STATIC_LINK(SfxDialogController
, InstallLOKNotifierHdl
, void*, vcl::ILibreOfficeKitNotifier
*);
41 DECL_DLLPRIVATE_LINK(FocusChangeHdl
, weld::Widget
&, void);
44 SfxDialogController(weld::Widget
* pParent
, const OUString
& rUIFile
, const OString
& rDialogId
);
46 virtual void Activate() {}
48 virtual void Deactivate() {}
50 // when the dialog has an associated SfxChildWin, typically for Modeless interaction
51 virtual void ChildWinDispose() {} // called from the associated SfxChildWin dtor
52 virtual void Close() {} // called by the SfxChildWin when the dialog is closed
53 virtual void EndDialog(); // called by the SfxChildWin to close the dialog
56 class SfxModelessDialog_Impl
;
58 class SFX2_DLLPUBLIC SfxModelessDialogController
: public SfxDialogController
60 SfxBindings
* m_pBindings
;
61 std::unique_ptr
<SfxModelessDialog_Impl
> m_xImpl
;
63 SfxModelessDialogController(SfxModelessDialogController
&) = delete;
64 void operator =(SfxModelessDialogController
&) = delete;
66 void Init(SfxBindings
*pBindinx
, SfxChildWindow
*pCW
);
69 SfxModelessDialogController(SfxBindings
*, SfxChildWindow
* pChildWin
,
70 weld::Window
* pParent
, const OUString
& rUIXMLDescription
, const OString
& rID
);
73 virtual ~SfxModelessDialogController() override
;
75 void Initialize (SfxChildWinInfo
const * pInfo
);
76 bool IsClosing() const;
77 virtual void Close() override
;
78 virtual void EndDialog() override
;
79 virtual void Activate() override
;
80 virtual void Deactivate() override
;
81 virtual void ChildWinDispose() override
;
82 virtual void FillInfo(SfxChildWinInfo
&) const;
83 SfxBindings
& GetBindings() const { return *m_pBindings
; }
86 // class SfxFloatingWindow --------------------------------------------------
87 class SfxFloatingWindow_Impl
;
88 class SFX2_DLLPUBLIC SfxFloatingWindow
: public FloatingWindow
90 SfxBindings
* pBindings
;
92 std::unique_ptr
< SfxFloatingWindow_Impl
> pImpl
;
94 SfxFloatingWindow(SfxFloatingWindow
const &) = delete;
95 SfxFloatingWindow
& operator =(SfxFloatingWindow
const &) = delete;
98 SfxFloatingWindow( SfxBindings
*pBindings
,
100 vcl::Window
* pParent
,
102 virtual ~SfxFloatingWindow() override
;
103 virtual void dispose() override
;
105 virtual void StateChanged( StateChangedType nStateChange
) override
;
106 virtual bool Close() override
;
107 virtual void Resize() override
;
108 virtual void Move() override
;
109 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
110 SfxBindings
& GetBindings()
111 { return *pBindings
; }
114 virtual void FillInfo(SfxChildWinInfo
&) const;
115 void Initialize (SfxChildWinInfo
const * pInfo
);
117 DECL_LINK(TimerHdl
, Timer
*, void);
121 // class SfxNoLayoutSingleTabDialog --------------------------------------------------
123 typedef const sal_uInt16
* (*GetTabPageRanges
)(); // provides international Which values
125 class SFX2_DLLPUBLIC SfxOkDialogController
: public SfxDialogController
128 SfxOkDialogController(weld::Widget
* pParent
, const OUString
& rUIXMLDescription
,
130 : SfxDialogController(pParent
, rUIXMLDescription
, rID
)
134 virtual weld::Button
& GetOKButton() const = 0;
135 virtual const SfxItemSet
* GetExampleSet() const = 0;
138 class SFX2_DLLPUBLIC SfxSingleTabDialogController
: public SfxOkDialogController
141 std::unique_ptr
<SfxItemSet
> m_xOutputSet
;
142 const SfxItemSet
* m_pInputSet
;
145 SfxSingleTabDialogController(weld::Widget
* pParent
, const SfxItemSet
* pOptionsSet
,
146 const OUString
& rUIXMLDescription
= OUString("sfx/ui/singletabdialog.ui"),
147 const OString
& rID
= OString("SingleTabDialog"));
149 weld::Container
* get_content_area() { return m_xContainer
.get(); }
151 virtual ~SfxSingleTabDialogController() override
;
153 void SetTabPage(std::unique_ptr
<SfxTabPage
> xTabPage
);
154 SfxTabPage
* GetTabPage() const { return m_xSfxPage
.get(); }
156 virtual weld::Button
& GetOKButton() const override
{ return *m_xOKBtn
; }
157 virtual const SfxItemSet
* GetExampleSet() const override
{ return nullptr; }
159 const SfxItemSet
* GetOutputItemSet() const { return m_xOutputSet
.get(); }
160 const SfxItemSet
* GetInputItemSet() const { return m_pInputSet
; }
163 std::unique_ptr
<SfxTabPage
> m_xSfxPage
;
164 std::unique_ptr
<weld::Container
> m_xContainer
;
165 std::unique_ptr
<weld::Button
> m_xOKBtn
;
166 std::unique_ptr
<weld::Button
> m_xHelpBtn
;
168 void CreateOutputItemSet(const SfxItemSet
& rInput
);
169 void SetInputSet(const SfxItemSet
* pInSet
) { m_pInputSet
= pInSet
; }
170 DECL_DLLPRIVATE_LINK(OKHdl_Impl
, weld::Button
&, void);
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */