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 .
22 #include <vcl/weld.hxx>
23 #include <vcl/print.hxx>
24 #include <sfx2/basedlgs.hxx>
25 #include <mailmergehelper.hxx>
27 class SwMailMergeWizard
;
29 class SwSendMailDialog
;
31 namespace com::sun::star::mail
{ class XMailMessage
; }
34 /// Dialog implementing the saving as of the result document.
35 class SwMMResultSaveDialog final
: public SfxDialogController
39 std::unique_ptr
<weld::RadioButton
> m_xSaveAsOneRB
;
40 std::unique_ptr
<weld::RadioButton
> m_xSaveIndividualRB
;
41 std::unique_ptr
<weld::CheckButton
> m_xFromRB
;
42 std::unique_ptr
<weld::SpinButton
> m_xFromNF
;
43 std::unique_ptr
<weld::Label
> m_xToFT
;
44 std::unique_ptr
<weld::SpinButton
> m_xToNF
;
45 std::unique_ptr
<weld::Button
> m_xOKButton
;
47 DECL_LINK(SaveOutputHdl_Impl
, weld::Button
& , void);
48 DECL_LINK(DocumentSelectionHdl_Impl
, weld::Toggleable
&, void);
51 SwMMResultSaveDialog(weld::Window
* pParent
);
52 virtual ~SwMMResultSaveDialog() override
;
55 /// Dialog implementing the printing of the result document.
56 class SwMMResultPrintDialog final
: public SfxDialogController
58 VclPtr
<Printer
> m_pTempPrinter
;
60 std::unique_ptr
<weld::ComboBox
> m_xPrinterLB
;
61 std::unique_ptr
<weld::Button
> m_xPrinterSettingsPB
;
62 std::unique_ptr
<weld::RadioButton
> m_xPrintAllRB
;
63 std::unique_ptr
<weld::RadioButton
> m_xFromRB
;
64 std::unique_ptr
<weld::SpinButton
> m_xFromNF
;
65 std::unique_ptr
<weld::Label
> m_xToFT
;
66 std::unique_ptr
<weld::SpinButton
> m_xToNF
;
67 std::unique_ptr
<weld::Button
> m_xOKButton
;
69 DECL_LINK(PrinterChangeHdl_Impl
, weld::ComboBox
&, void );
70 DECL_LINK(PrintHdl_Impl
, weld::Button
&, void);
71 DECL_LINK(PrinterSetupHdl_Impl
, weld::Button
&, void );
72 DECL_LINK(DocumentSelectionHdl_Impl
, weld::Toggleable
&, void);
74 void FillInPrinterSettings();
77 SwMMResultPrintDialog(weld::Window
* pParent
);
78 virtual ~SwMMResultPrintDialog() override
;
81 /// Dialog implementing the sending as email of the result document.
82 class SwMMResultEmailDialog final
: public SfxDialogController
84 OUString m_sConfigureMail
;
89 std::unique_ptr
<weld::ComboBox
> m_xMailToLB
;
90 std::unique_ptr
<weld::Button
> m_xCopyToPB
;
91 std::unique_ptr
<weld::Entry
> m_xSubjectED
;
92 std::unique_ptr
<weld::ComboBox
> m_xSendAsLB
;
93 std::unique_ptr
<weld::Button
> m_xSendAsPB
;
94 std::unique_ptr
<weld::Widget
> m_xAttachmentGroup
;
95 std::unique_ptr
<weld::Entry
> m_xAttachmentED
;
96 std::unique_ptr
<weld::Label
> m_xPasswordFT
;
97 std::unique_ptr
<weld::ComboBox
> m_xPasswordLB
;
98 std::unique_ptr
<weld::CheckButton
> m_xPasswordCB
;
99 std::unique_ptr
<weld::RadioButton
> m_xSendAllRB
;
100 std::unique_ptr
<weld::RadioButton
> m_xFromRB
;
101 std::unique_ptr
<weld::SpinButton
> m_xFromNF
;
102 std::unique_ptr
<weld::Label
> m_xToFT
;
103 std::unique_ptr
<weld::SpinButton
> m_xToNF
;
104 std::unique_ptr
<weld::Button
> m_xOKButton
;
106 DECL_LINK(CopyToHdl_Impl
, weld::Button
&, void);
107 DECL_LINK(SendTypeHdl_Impl
, weld::ComboBox
&, void);
108 DECL_LINK(SendAsHdl_Impl
, weld::Button
&, void);
109 DECL_LINK(SendDocumentsHdl_Impl
, weld::Button
&, void);
110 DECL_LINK(DocumentSelectionHdl_Impl
, weld::Toggleable
&, void);
111 DECL_LINK(CheckHdl
, weld::Toggleable
&, void );
113 void FillInEmailSettings();
116 SwMMResultEmailDialog(weld::Window
*pParent
);
117 virtual ~SwMMResultEmailDialog() override
;
120 struct SwMailDescriptor
123 OUString sAttachmentURL
;
124 OUString sAttachmentName
;
127 OUString sBodyMimeType
;
128 OUString sBodyContent
;
133 struct SwSendMailDialog_Impl
;
134 class SwMailMergeConfigItem
;
135 class SwSendMailDialog final
: public weld::GenericDialogController
137 OUString m_sContinue
;
140 OUString m_sTransferStatus
;
141 OUString m_sErrorStatus
;
142 OUString m_sSendingTo
;
143 OUString m_sCompleted
;
145 OUString m_sAddressInvalid
;
148 bool m_bDestructionEnabled
;
150 std::unique_ptr
<SwSendMailDialog_Impl
> m_pImpl
;
151 SwMailMergeConfigItem
* m_pConfigItem
;
152 sal_Int32 m_nExpectedCount
;
153 sal_Int32 m_nProcessedCount
;
154 sal_Int32 m_nErrorCount
;
156 std::unique_ptr
<weld::Label
> m_xTransferStatus
;
157 std::unique_ptr
<weld::Label
> m_xPaused
;
158 std::unique_ptr
<weld::ProgressBar
> m_xProgressBar
;
159 std::unique_ptr
<weld::Label
> m_xErrorStatus
;
160 std::unique_ptr
<weld::TreeView
> m_xStatus
;
161 std::unique_ptr
<weld::Button
> m_xStop
;
162 std::unique_ptr
<weld::Button
> m_xCancel
;
164 DECL_LINK( StopHdl_Impl
, weld::Button
&, void );
165 DECL_LINK( CancelHdl_Impl
, weld::Button
& , void);
166 DECL_STATIC_LINK( SwSendMailDialog
, StartSendMails
, void*, void );
167 DECL_STATIC_LINK( SwSendMailDialog
, StopSendMails
, void*, void );
168 DECL_LINK( RemoveThis
, Timer
*, void );
172 void UpdateTransferStatus();
175 SwSendMailDialog( weld::Window
* pParent
, SwMailMergeConfigItem
& );
176 virtual ~SwSendMailDialog() override
;
178 void AddDocument( SwMailDescriptor
const & rDesc
);
179 void EnableDestruction() {m_bDestructionEnabled
= true;}
180 void StartSend(sal_Int32 nExpectedCount
);
182 void DocumentSent( css::uno::Reference
< css::mail::XMailMessage
> const & xMessage
,
184 const OUString
* pError
);
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */