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_SW_SOURCE_UIBASE_INC_MAILMRGE_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_MAILMRGE_HXX
23 #include <sfx2/basedlgs.hxx>
25 #include <com/sun/star/uno/Sequence.h>
26 #include <com/sun/star/uno/Reference.h>
31 class SwModuleOptions
;
32 class SwXSelChgLstnr_Impl
;
33 struct SwMailMergeDlg_Impl
;
34 namespace com::sun::star
{
44 class SwMailMergeDlg
: public SfxDialogController
46 friend class SwXSelChgLstnr_Impl
;
48 std::unique_ptr
<SwMailMergeDlg_Impl
> pImpl
;
51 SwModuleOptions
* pModOpt
;
53 DBManagerOptions nMergeType
;
54 css::uno::Sequence
< css::uno::Any
> m_aSelection
;
55 css::uno::Reference
< css::frame::XFrame2
> m_xFrame
;
57 OUString m_sSaveFilter
;
60 std::unique_ptr
<weld::Container
> m_xBeamerWin
;
62 std::unique_ptr
<weld::RadioButton
> m_xAllRB
;
63 std::unique_ptr
<weld::RadioButton
> m_xMarkedRB
;
64 std::unique_ptr
<weld::RadioButton
> m_xFromRB
;
65 std::unique_ptr
<weld::SpinButton
> m_xFromNF
;
66 std::unique_ptr
<weld::SpinButton
> m_xToNF
;
68 std::unique_ptr
<weld::RadioButton
> m_xPrinterRB
;
69 std::unique_ptr
<weld::RadioButton
> m_xMailingRB
;
70 std::unique_ptr
<weld::RadioButton
> m_xFileRB
;
72 std::unique_ptr
<weld::CheckButton
> m_xSingleJobsCB
;
73 std::unique_ptr
<weld::CheckButton
> m_xPasswordCB
;
75 std::unique_ptr
<weld::Label
> m_xSaveMergedDocumentFT
;
76 std::unique_ptr
<weld::RadioButton
> m_xSaveSingleDocRB
;
77 std::unique_ptr
<weld::RadioButton
> m_xSaveIndividualRB
;
79 std::unique_ptr
<weld::CheckButton
> m_xGenerateFromDataBaseCB
;
81 std::unique_ptr
<weld::Label
> m_xColumnFT
;
82 std::unique_ptr
<weld::ComboBox
> m_xColumnLB
;
83 std::unique_ptr
<weld::Label
> m_xPasswordFT
;
84 std::unique_ptr
<weld::ComboBox
> m_xPasswordLB
;
85 std::unique_ptr
<weld::Label
> m_xPathFT
;
86 std::unique_ptr
<weld::Entry
> m_xPathED
;
87 std::unique_ptr
<weld::Button
> m_xPathPB
;
88 std::unique_ptr
<weld::Label
> m_xFilterFT
;
89 std::unique_ptr
<weld::ComboBox
> m_xFilterLB
;
91 std::unique_ptr
<weld::ComboBox
> m_xAddressFieldLB
;
92 std::unique_ptr
<weld::Label
> m_xSubjectFT
;
93 std::unique_ptr
<weld::Entry
> m_xSubjectED
;
94 std::unique_ptr
<weld::Label
> m_xFormatFT
;
95 std::unique_ptr
<weld::Label
> m_xAttachFT
;
96 std::unique_ptr
<weld::Entry
> m_xAttachED
;
97 std::unique_ptr
<weld::Button
> m_xAttachPB
;
98 std::unique_ptr
<weld::CheckButton
> m_xFormatHtmlCB
;
99 std::unique_ptr
<weld::CheckButton
> m_xFormatRtfCB
;
100 std::unique_ptr
<weld::CheckButton
> m_xFormatSwCB
;
102 std::unique_ptr
<weld::Button
> m_xOkBTN
;
104 DECL_LINK( ButtonHdl
, weld::Button
&, void );
105 DECL_LINK( InsertPathHdl
, weld::Button
&, void );
106 DECL_LINK( OutputTypeHdl
, weld::ToggleButton
&, void );
107 DECL_LINK( FilenameHdl
, weld::ToggleButton
&, void );
108 DECL_LINK( ModifyHdl
, weld::SpinButton
&, void );
109 DECL_LINK( SaveTypeHdl
, weld::ToggleButton
&, void );
110 DECL_LINK( FileFormatHdl
, weld::ComboBox
&, void );
113 bool AskUserFilename() const;
114 OUString
GetURLfromPath() const;
117 SwMailMergeDlg(weld::Window
* pParent
, SwWrtShell
& rSh
,
118 const OUString
& rSourceName
,
119 const OUString
& rTableName
,
120 sal_Int32 nCommandType
,
121 const css::uno::Reference
< css::sdbc::XConnection
>& xConnection
,
122 css::uno::Sequence
< css::uno::Any
> const * pSelection
);
123 virtual ~SwMailMergeDlg() override
;
125 DBManagerOptions
GetMergeType() const { return nMergeType
; }
127 bool IsSaveSingleDoc() const { return m_xSaveSingleDocRB
->get_active(); }
128 bool IsGenerateFromDataBase() const { return m_xGenerateFromDataBaseCB
->get_active(); }
129 bool IsFileEncryptedFromDataBase() const { return m_xPasswordCB
->get_active(); }
130 OUString
GetColumnName() const { return m_xColumnLB
->get_active_text(); }
131 OUString
GetPasswordColumnName() const { return m_xPasswordLB
->get_active_text(); }
132 OUString
GetTargetURL() const;
134 const OUString
& GetSaveFilter() const {return m_sSaveFilter
;}
135 const css::uno::Sequence
< css::uno::Any
>& GetSelection() const { return m_aSelection
; }
136 css::uno::Reference
< css::sdbc::XResultSet
> GetResultSet() const;
140 class SwMailMergeCreateFromDlg
: public weld::GenericDialogController
142 std::unique_ptr
<weld::RadioButton
> m_xThisDocRB
;
144 SwMailMergeCreateFromDlg(weld::Window
* pParent
);
145 virtual ~SwMailMergeCreateFromDlg() override
;
146 bool IsThisDocument() const
148 return m_xThisDocRB
->get_active();
152 class SwMailMergeFieldConnectionsDlg
: public weld::GenericDialogController
154 std::unique_ptr
<weld::RadioButton
> m_xUseExistingRB
;
156 SwMailMergeFieldConnectionsDlg(weld::Window
* pParent
);
157 virtual ~SwMailMergeFieldConnectionsDlg() override
;
159 bool IsUseExistingConnections() const
161 return m_xUseExistingRB
->get_active();
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */