LibreOffice Module vcl (master)  1
abstdlg.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_VCL_ABSTDLG_HXX
20 #define INCLUDED_VCL_ABSTDLG_HXX
21 
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>
30 
31 namespace com::sun::star::uno { template <class interface_type> class Reference; }
32 
33 namespace com::sun::star::frame { class XModel; }
34 
35 class Dialog;
36 class BitmapEx;
38 namespace weld
39 {
40  class Dialog;
41  class DialogController;
42  class Window;
43 }
44 
51 {
52 protected:
53  virtual ~VclAbstractDialog() override;
54 public:
55  virtual short Execute() = 0;
56 
57  struct AsyncContext {
58  // for the case where the owner is the dialog itself, and the dialog is an unwelded VclPtr based dialog
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; }
66  };
67 
68  bool StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn)
69  {
70  AsyncContext aCtx;
71  aCtx.mxOwner = this;
72  aCtx.maEndDialogFn = rEndDialogFn;
73  return StartExecuteAsync(aCtx);
74  }
75 
77  virtual bool StartExecuteAsync(AsyncContext &);
78 
79  // Screenshot interface
80  virtual std::vector<OString> getAllPageUIXMLDescriptions() const;
81  virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription);
82  virtual BitmapEx createScreenshot() const;
83  virtual OString GetScreenshotId() const { return OString(); };
84 };
85 
87 {
88 protected:
89  virtual ~VclAbstractTerminatedDialog() override = default;
90 public:
91  virtual void EndDialog(sal_Int32 nResult) = 0;
92 };
93 
95 {
96 protected:
97  virtual ~AbstractPasswordToOpenModifyDialog() override = default;
98 public:
99  virtual OUString GetPasswordToOpen() const = 0;
100  virtual OUString GetPasswordToModify() const = 0;
101  virtual bool IsRecommendToOpenReadonly() const = 0;
102 };
103 
105 {
106 protected:
107  virtual ~AbstractScreenshotAnnotationDlg() override = default;
108 };
109 
111 {
112 protected:
113  virtual ~AbstractSignatureLineDialog() override = default;
114 };
115 
117 {
118 protected:
119  virtual ~AbstractSignSignatureLineDialog() override = default;
120 };
121 
123 {
124 protected:
125  virtual ~AbstractQrCodeGenDialog() override = default;
126 };
127 
129 {
130 protected:
131  virtual ~AbstractAboutDialog() override = default;
132 };
133 
135 {
136 protected:
137  virtual ~AbstractTipOfTheDayDialog() override = default;
138 };
139 
142 {
143 protected:
144  virtual ~AbstractDiagramDialog() override = default;
145 };
146 
148 {
149 public:
150  virtual ~VclAbstractDialogFactory(); // needed for export of vtable
152  // The Id is an implementation detail of the factory
153  virtual VclPtr<VclAbstractDialog> CreateVclDialog(weld::Window* pParent, sal_uInt32 nId) = 0;
154 
155  // creates instance of PasswordToOpenModifyDialog from cui
156  virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) = 0;
157 
158  // creates instance of SignatureDialog from cui
160  CreateSignatureLineDialog(weld::Window* pParent,
161  const css::uno::Reference<css::frame::XModel> xModel,
162  bool bEditExisting)
163  = 0;
164 
165  // creates instance of SignSignatureDialog from cui
167  CreateSignSignatureLineDialog(weld::Window* pParent,
168  const css::uno::Reference<css::frame::XModel> xModel)
169  = 0;
170 
171  // creates instance of QrCodeDialog from cui
173  CreateQrCodeGenDialog(weld::Window* pParent,
174  const css::uno::Reference<css::frame::XModel> xModel,
175  bool bEditExisting)
176  = 0;
177 
178  // creates instance of ScreenshotAnnotationDlg from cui
179  virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(
180  weld::Dialog& rParentDialog) = 0;
181 
182  // create about dialog
184  CreateAboutDialog(weld::Window* pParent) = 0;
185 
186  // create info dialog to show tip-of-the-day
188  CreateTipOfTheDayDialog(weld::Window* pParent) = 0;
189 
190  virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog(
191  weld::Window* pParent,
192  std::shared_ptr<DiagramDataInterface> pDiagramData) = 0;
193 };
194 
195 #endif
196 
197 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: abstdlg.hxx:50
virtual OString GetScreenshotId() const
Definition: abstdlg.hxx:83
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
Reference
sal_Int16 nId
std::shared_ptr< weld::DialogController > mxOwnerDialogController
Definition: abstdlg.hxx:61
std::shared_ptr< weld::Dialog > mxOwnerSelf
Definition: abstdlg.hxx:63
bool StartExecuteAsync(const std::function< void(sal_Int32)> &rEndDialogFn)
Definition: abstdlg.hxx:68
std::function< void(sal_Int32)> maEndDialogFn
Definition: abstdlg.hxx:64
Edit Diagram dialog.
Definition: abstdlg.hxx:141
VclPtr< VclReferenceBase > mxOwner
Definition: abstdlg.hxx:59
Reference< XModel > xModel