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_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>
31 namespace com::sun::star::uno
{ template <class interface_type
> class Reference
; }
33 namespace com::sun::star::frame
{ class XModel
; }
41 class DialogController
;
46 * Some things multiple-inherit from VclAbstractDialog and OutputDevice,
47 * so we need to use virtual inheritance to keep the referencing counting
50 class VCL_DLLPUBLIC VclAbstractDialog
: public virtual VclReferenceBase
53 virtual ~VclAbstractDialog() override
;
55 virtual short Execute() = 0;
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 bool StartExecuteAsync(const std::function
<void(sal_Int32
)> &rEndDialogFn
)
72 aCtx
.maEndDialogFn
= rEndDialogFn
;
73 return StartExecuteAsync(aCtx
);
76 /// Commence execution of a modal dialog.
77 virtual bool StartExecuteAsync(AsyncContext
&);
79 // Screenshot interface
80 virtual std::vector
<OUString
> getAllPageUIXMLDescriptions() const;
81 virtual bool selectPageByUIXMLDescription(const OUString
& rUIXMLDescription
);
82 virtual BitmapEx
createScreenshot() const;
83 virtual OUString
GetScreenshotId() const { return {}; };
86 class VCL_DLLPUBLIC VclAbstractTerminatedDialog
: public VclAbstractDialog
89 virtual ~VclAbstractTerminatedDialog() override
= default;
91 virtual void EndDialog(sal_Int32 nResult
) = 0;
94 class VCL_DLLPUBLIC AbstractPasswordToOpenModifyDialog
: public VclAbstractDialog
97 virtual ~AbstractPasswordToOpenModifyDialog() override
= default;
99 virtual OUString
GetPasswordToOpen() const = 0;
100 virtual OUString
GetPasswordToModify() const = 0;
101 virtual bool IsRecommendToOpenReadonly() const = 0;
102 virtual void Response(sal_Int32
) = 0;
103 virtual void AllowEmpty() = 0;
106 class VCL_DLLPUBLIC AbstractSecurityOptionsDialog
: public VclAbstractDialog
109 virtual ~AbstractSecurityOptionsDialog() override
= default;
111 virtual bool SetSecurityOptions() = 0;
114 class VCL_DLLPUBLIC AbstractScreenshotAnnotationDlg
: public VclAbstractDialog
117 virtual ~AbstractScreenshotAnnotationDlg() override
= default;
120 class VCL_DLLPUBLIC AbstractSignatureLineDialog
: public VclAbstractDialog
123 virtual ~AbstractSignatureLineDialog() override
= default;
126 class VCL_DLLPUBLIC AbstractSignSignatureLineDialog
: public VclAbstractDialog
129 virtual ~AbstractSignSignatureLineDialog() override
= default;
132 class VCL_DLLPUBLIC AbstractQrCodeGenDialog
: public VclAbstractDialog
135 virtual ~AbstractQrCodeGenDialog() override
= default;
138 class VCL_DLLPUBLIC AbstractAdditionsDialog
: public VclAbstractDialog
141 virtual ~AbstractAdditionsDialog() override
= default;
144 /** Edit Diagram dialog */
145 class VCL_DLLPUBLIC AbstractDiagramDialog
: public VclAbstractDialog
148 virtual ~AbstractDiagramDialog() override
= default;
151 class VCL_DLLPUBLIC VclAbstractDialogFactory
154 virtual ~VclAbstractDialogFactory(); // needed for export of vtable
155 static VclAbstractDialogFactory
* Create();
156 // The Id is an implementation detail of the factory
157 virtual VclPtr
<VclAbstractDialog
> CreateVclDialog(weld::Window
* pParent
, sal_uInt32 nId
) = 0;
159 // creates instance of PasswordToOpenModifyDialog from cui
160 virtual VclPtr
<AbstractPasswordToOpenModifyDialog
> CreatePasswordToOpenModifyDialog(weld::Window
* pParent
, sal_uInt16 nMaxPasswdLen
, bool bIsPasswordToModify
) = 0;
162 // creates instance of SignatureDialog from cui
163 virtual VclPtr
<AbstractSignatureLineDialog
>
164 CreateSignatureLineDialog(weld::Window
* pParent
,
165 const css::uno::Reference
<css::frame::XModel
> xModel
,
169 // creates instance of SignSignatureDialog from cui
170 virtual VclPtr
<AbstractSignSignatureLineDialog
>
171 CreateSignSignatureLineDialog(weld::Window
* pParent
,
172 const css::uno::Reference
<css::frame::XModel
> xModel
)
175 // creates instance of QrCodeDialog from cui
176 virtual VclPtr
<AbstractQrCodeGenDialog
>
177 CreateQrCodeGenDialog(weld::Window
* pParent
,
178 const css::uno::Reference
<css::frame::XModel
> xModel
,
182 // creates instance of ScreenshotAnnotationDlg from cui
183 virtual VclPtr
<AbstractScreenshotAnnotationDlg
> CreateScreenshotAnnotationDlg(
184 weld::Dialog
& rParentDialog
) = 0;
186 // create additions dialog
187 virtual VclPtr
<AbstractAdditionsDialog
>
188 CreateAdditionsDialog(weld::Window
* pParent
, const OUString
& sAdditionsTag
) = 0;
190 virtual VclPtr
<AbstractDiagramDialog
> CreateDiagramDialog(
191 weld::Window
* pParent
,
192 SdrObjGroup
& rDiagram
) = 0;
195 virtual VclPtr
<VclAbstractDialog
>
196 CreateFileExtCheckDialog(weld::Window
* _pParent
, const OUString
& sTitle
, const OUString
& sMsg
)
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */