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_UI_DBUI_MMGREETINGSPAGE_HXX
20 #define INCLUDED_SW_SOURCE_UI_DBUI_MMGREETINGSPAGE_HXX
22 #include <vcl/wizardmachine.hxx>
23 #include <sfx2/basedlgs.hxx>
24 #include <mailmergehelper.hxx>
25 #include <vcl/weld.hxx>
27 #include <mailmergewizard.hxx>
29 class SwMailMergeWizard
;
31 class SwGreetingsHandler
34 SwMailMergeWizard
* m_pWizard
;
35 /// The mail merge state, available even when m_pWizard is nullptr.
36 SwMailMergeConfigItem
& m_rConfigItem
;
39 std::unique_ptr
<weld::CheckButton
> m_xGreetingLineCB
;
40 std::unique_ptr
<weld::CheckButton
> m_xPersonalizedCB
;
41 std::unique_ptr
<weld::Label
> m_xFemaleFT
;
42 std::unique_ptr
<weld::ComboBox
> m_xFemaleLB
;
43 std::unique_ptr
<weld::Button
> m_xFemalePB
;
44 std::unique_ptr
<weld::Label
> m_xMaleFT
;
45 std::unique_ptr
<weld::ComboBox
> m_xMaleLB
;
46 std::unique_ptr
<weld::Button
> m_xMalePB
;
47 std::unique_ptr
<weld::Label
> m_xFemaleFI
;
48 std::unique_ptr
<weld::Label
> m_xFemaleColumnFT
;
49 std::unique_ptr
<weld::ComboBox
> m_xFemaleColumnLB
;
50 std::unique_ptr
<weld::Label
> m_xFemaleFieldFT
;
51 std::unique_ptr
<weld::ComboBox
> m_xFemaleFieldCB
;
52 std::unique_ptr
<weld::Label
> m_xNeutralFT
;
53 std::unique_ptr
<weld::ComboBox
> m_xNeutralCB
;
55 SwGreetingsHandler(SwMailMergeConfigItem
& rConfigItem
, weld::Builder
& rBuilder
)
57 , m_rConfigItem(rConfigItem
)
59 , m_xGreetingLineCB(rBuilder
.weld_check_button("greeting"))
60 , m_xPersonalizedCB(rBuilder
.weld_check_button("personalized"))
61 , m_xFemaleFT(rBuilder
.weld_label("femaleft"))
62 , m_xFemaleLB(rBuilder
.weld_combo_box("female"))
63 , m_xFemalePB(rBuilder
.weld_button("newfemale"))
64 , m_xMaleFT(rBuilder
.weld_label("maleft"))
65 , m_xMaleLB(rBuilder
.weld_combo_box("male"))
66 , m_xMalePB(rBuilder
.weld_button("newmale"))
67 , m_xFemaleFI(rBuilder
.weld_label("femalefi"))
68 , m_xFemaleColumnFT(rBuilder
.weld_label("femalecolft"))
69 , m_xFemaleColumnLB(rBuilder
.weld_combo_box("femalecol"))
70 , m_xFemaleFieldFT(rBuilder
.weld_label("femalefieldft"))
71 , m_xFemaleFieldCB(rBuilder
.weld_combo_box("femalefield"))
72 , m_xNeutralFT(rBuilder
.weld_label("generalft"))
73 , m_xNeutralCB(rBuilder
.weld_combo_box("general"))
77 ~SwGreetingsHandler() {}
79 DECL_LINK(IndividualHdl_Impl
, weld::Toggleable
&, void);
80 DECL_LINK(GreetingHdl_Impl
, weld::Button
&, void);
82 void Contains(bool bContainsGreeting
);
83 virtual void UpdatePreview();
86 class SwMailMergeGreetingsPage
: public vcl::OWizardPage
, public SwGreetingsHandler
88 std::unique_ptr
<SwAddressPreview
> m_xPreview
;
89 std::unique_ptr
<weld::Label
> m_xPreviewFI
;
90 std::unique_ptr
<weld::Button
> m_xAssignPB
;
91 std::unique_ptr
<weld::Label
> m_xDocumentIndexFI
;
92 std::unique_ptr
<weld::Button
> m_xPrevSetIB
;
93 std::unique_ptr
<weld::Button
> m_xNextSetIB
;
94 std::unique_ptr
<weld::CustomWeld
> m_xPreviewWIN
;
98 DECL_LINK(ContainsHdl_Impl
, weld::Toggleable
&, void);
99 DECL_LINK(InsertDataHdl_Impl
, weld::Button
&, void);
100 DECL_LINK(GreetingSelectComboBoxHdl_Impl
, weld::ComboBox
&, void);
101 DECL_LINK(GreetingSelectListBoxHdl_Impl
, weld::ComboBox
&, void);
102 DECL_LINK(AssignHdl_Impl
, weld::Button
&, void);
104 virtual void UpdatePreview() override
;
105 virtual void Activate() override
;
106 virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason
) override
;
109 SwMailMergeGreetingsPage(weld::Container
* pPage
, SwMailMergeWizard
* pWizard
);
110 virtual ~SwMailMergeGreetingsPage() override
;
113 class SwMailBodyDialog
: public SfxDialogController
, public SwGreetingsHandler
115 std::unique_ptr
<weld::TextView
> m_xBodyMLE
;
116 std::unique_ptr
<weld::Button
> m_xOK
;
118 DECL_LINK(ContainsHdl_Impl
, weld::Toggleable
&, void);
119 DECL_LINK(OKHdl
, weld::Button
&, void);
122 SwMailBodyDialog(weld::Window
* pParent
);
123 virtual ~SwMailBodyDialog() override
;
125 void SetBody(const OUString
& rBody
) { m_xBodyMLE
->set_text(rBody
); }
126 OUString
GetBody() const { return m_xBodyMLE
->get_text(); }
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */