cid#1636693 COPY_INSTEAD_OF_MOVE
[LibreOffice.git] / include / sfx2 / basedlgs.hxx
blobb962ce611612d4ffd8138719d24a2d062421fffb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
22 #include <memory>
23 #include <sal/config.h>
24 #include <sfx2/dllapi.h>
25 #include <vcl/weld.hxx>
27 class SfxTabPage;
28 class SfxBindings;
29 class SfxChildWindow;
30 struct SfxChildWinInfo;
31 class SfxItemSet;
32 class WhichRangesContainer;
34 class SFX2_DLLPUBLIC SfxDialogController : public weld::GenericDialogController
36 private:
37 DECL_DLLPRIVATE_STATIC_LINK(SfxDialogController, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*);
39 DECL_DLLPRIVATE_LINK(FocusChangeHdl, weld::Container&, void);
41 public:
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() {}
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
55 class SfxModelessDialog_Impl;
57 class SFX2_DLLPUBLIC SfxModelessDialogController : public SfxDialogController
59 SfxBindings* m_pBindings;
60 std::unique_ptr<SfxModelessDialog_Impl> m_xImpl;
62 SfxModelessDialogController(SfxModelessDialogController&) = delete;
63 void operator =(SfxModelessDialogController&) = delete;
65 void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
67 protected:
68 SfxModelessDialogController(SfxBindings*, SfxChildWindow* pChildWin,
69 weld::Window* pParent, const OUString& rUIXMLDescription, const OUString& rID);
71 public:
72 virtual ~SfxModelessDialogController() override;
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; }
85 typedef const WhichRangesContainer & (*GetTabPageRanges)(); // provides international Which values
87 class SFX2_DLLPUBLIC SfxOkDialogController : public SfxDialogController
89 public:
90 SfxOkDialogController(weld::Widget* pParent, const OUString& rUIXMLDescription,
91 const OUString& rID)
92 : SfxDialogController(pParent, rUIXMLDescription, rID)
96 virtual weld::Button& GetOKButton() const = 0;
97 virtual const SfxItemSet* GetExampleSet() const = 0;
100 class SFX2_DLLPUBLIC SfxSingleTabDialogController : public SfxOkDialogController
102 private:
103 std::unique_ptr<SfxItemSet> m_xOutputSet;
104 const SfxItemSet* m_pInputSet;
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);
111 SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet,
112 const OUString& rContainerId, const OUString& rUIXMLDescription,
113 const OUString& rID);
115 weld::Container* get_content_area() { return m_xContainer.get(); }
117 virtual ~SfxSingleTabDialogController() override;
119 void SetTabPage(std::unique_ptr<SfxTabPage> xTabPage);
120 SfxTabPage* GetTabPage() const { return m_xSfxPage.get(); }
122 virtual weld::Button& GetOKButton() const override { return *m_xOKBtn; }
123 virtual const SfxItemSet* GetExampleSet() const override { return nullptr; }
125 const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); }
126 const SfxItemSet* GetInputItemSet() const { return m_pInputSet; }
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;
133 void CreateOutputItemSet(const SfxItemSet& rInput);
134 void SetInputSet(const SfxItemSet* pInSet) { m_pInputSet = pInSet; }
135 DECL_DLLPRIVATE_LINK(OKHdl_Impl, weld::Button&, void);
138 #endif
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */