workaround segfault in compiler on macos-clang-intel
[LibreOffice.git] / include / vcl / abstdlg.hxx
blob50c12b6cd7c9959a3825188b5ed0f1742661c611
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_VCL_ABSTDLG_HXX
20 #define INCLUDED_VCL_ABSTDLG_HXX
22 #include <sal/types.h>
23 #include <rtl/ustring.hxx>
24 #include <vcl/dllapi.h>
25 #include <vcl/vclptr.hxx>
26 #include <vcl/vclreferencebase.hxx>
27 #include <vector>
28 #include <functional>
29 #include <memory>
31 namespace com::sun::star::uno { template <class interface_type> class Reference; }
33 namespace com::sun::star::frame { class XModel; }
35 class Dialog;
36 class BitmapEx;
37 class SdrObjGroup;
38 namespace weld
40 class Dialog;
41 class DialogController;
42 class Window;
45 /**
46 * Some things multiple-inherit from VclAbstractDialog and OutputDevice,
47 * so we need to use virtual inheritance to keep the referencing counting
48 * OK.
50 class VCL_DLLPUBLIC VclAbstractDialog : public virtual VclReferenceBase
52 protected:
53 virtual ~VclAbstractDialog() override;
54 public:
55 virtual short Execute() = 0;
57 struct AsyncContext {
58 // for the case where the owner is the dialog itself, and the dialog is an unwelded VclPtr based dialog
59 VclPtr<VclReferenceBase> mxOwner;
60 // for the case where the dialog is welded, and owned by a DialogController
61 std::shared_ptr<weld::DialogController> mxOwnerDialogController;
62 // for the case where the dialog is welded, and is running async without a DialogController
63 std::shared_ptr<weld::Dialog> mxOwnerSelf;
64 std::function<void(sal_Int32)> maEndDialogFn;
65 bool isSet() const { return !!maEndDialogFn; }
68 /**
69 * Usual codepath for modal dialogs. Some uno command decides to open a dialog,
70 we call StartExecuteAsync() with a callback to handle the dialog result
71 and that handler will be executed at some stage in the future,
72 instead of right now.
74 bool StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn)
76 AsyncContext aCtx;
77 aCtx.mxOwner = this;
78 aCtx.maEndDialogFn = rEndDialogFn;
79 return StartExecuteAsync(aCtx);
82 /// Commence execution of a modal dialog.
83 virtual bool StartExecuteAsync(AsyncContext &);
85 // Screenshot interface
86 virtual std::vector<OUString> getAllPageUIXMLDescriptions() const;
87 virtual bool selectPageByUIXMLDescription(const OUString& rUIXMLDescription);
88 virtual BitmapEx createScreenshot() const;
89 virtual OUString GetScreenshotId() const { return {}; };
92 class VCL_DLLPUBLIC VclAbstractTerminatedDialog : public VclAbstractDialog
94 protected:
95 virtual ~VclAbstractTerminatedDialog() override = default;
96 public:
97 virtual void EndDialog(sal_Int32 nResult) = 0;
100 class VCL_DLLPUBLIC AbstractPasswordToOpenModifyDialog : public VclAbstractDialog
102 protected:
103 virtual ~AbstractPasswordToOpenModifyDialog() override = default;
104 public:
105 virtual OUString GetPasswordToOpen() const = 0;
106 virtual OUString GetPasswordToModify() const = 0;
107 virtual bool IsRecommendToOpenReadonly() const = 0;
108 virtual void Response(sal_Int32) = 0;
109 virtual void AllowEmpty() = 0;
112 class VCL_DLLPUBLIC AbstractSecurityOptionsDialog : public VclAbstractDialog
114 protected:
115 virtual ~AbstractSecurityOptionsDialog() override = default;
116 public:
117 virtual bool SetSecurityOptions() = 0;
120 class VCL_DLLPUBLIC AbstractScreenshotAnnotationDlg : public VclAbstractDialog
122 protected:
123 virtual ~AbstractScreenshotAnnotationDlg() override = default;
126 class VCL_DLLPUBLIC AbstractSignatureLineDialog : public VclAbstractDialog
128 protected:
129 virtual ~AbstractSignatureLineDialog() override = default;
130 public:
131 virtual void Apply() = 0;
134 class VCL_DLLPUBLIC AbstractSignSignatureLineDialog : public VclAbstractDialog
136 protected:
137 virtual ~AbstractSignSignatureLineDialog() override = default;
138 public:
139 virtual void Apply() = 0;
142 class VCL_DLLPUBLIC AbstractQrCodeGenDialog : public VclAbstractDialog
144 protected:
145 virtual ~AbstractQrCodeGenDialog() override = default;
148 class VCL_DLLPUBLIC AbstractAdditionsDialog : public VclAbstractDialog
150 protected:
151 virtual ~AbstractAdditionsDialog() override = default;
154 /** Edit Diagram dialog */
155 class VCL_DLLPUBLIC AbstractDiagramDialog : public VclAbstractDialog
157 protected:
158 virtual ~AbstractDiagramDialog() override = default;
161 class VCL_DLLPUBLIC VclAbstractDialogFactory
163 public:
164 virtual ~VclAbstractDialogFactory(); // needed for export of vtable
165 static VclAbstractDialogFactory* Create();
166 // The Id is an implementation detail of the factory
167 virtual VclPtr<VclAbstractDialog> CreateVclDialog(weld::Window* pParent, sal_uInt32 nId) = 0;
169 // creates instance of PasswordToOpenModifyDialog from cui
170 virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) = 0;
172 // creates instance of SignatureDialog from cui
173 virtual VclPtr<AbstractSignatureLineDialog>
174 CreateSignatureLineDialog(weld::Window* pParent,
175 const css::uno::Reference<css::frame::XModel> xModel,
176 bool bEditExisting)
177 = 0;
179 // creates instance of SignSignatureDialog from cui
180 virtual VclPtr<AbstractSignSignatureLineDialog>
181 CreateSignSignatureLineDialog(weld::Window* pParent,
182 const css::uno::Reference<css::frame::XModel> xModel)
183 = 0;
185 // creates instance of QrCodeDialog from cui
186 virtual VclPtr<AbstractQrCodeGenDialog>
187 CreateQrCodeGenDialog(weld::Window* pParent,
188 const css::uno::Reference<css::frame::XModel> xModel,
189 bool bEditExisting)
190 = 0;
192 // creates instance of ScreenshotAnnotationDlg from cui
193 virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(
194 weld::Dialog& rParentDialog) = 0;
196 // create additions dialog
197 virtual VclPtr<AbstractAdditionsDialog>
198 CreateAdditionsDialog(weld::Window* pParent, const OUString& sAdditionsTag) = 0;
200 virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog(
201 weld::Window* pParent,
202 SdrObjGroup& rDiagram) = 0;
204 #ifdef _WIN32
205 virtual VclPtr<VclAbstractDialog>
206 CreateFileExtCheckDialog(weld::Window* _pParent, const OUString& sTitle, const OUString& sMsg)
207 = 0;
208 #endif
211 #endif
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */