LibreOffice Module sw (master) 1
mmaddressblockpage.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_SW_SOURCE_UI_DBUI_MMADDRESSBLOCKPAGE_HXX
20#define INCLUDED_SW_SOURCE_UI_DBUI_MMADDRESSBLOCKPAGE_HXX
21
22#include <svx/weldeditview.hxx>
23#include <vcl/wizardmachine.hxx>
24#include <mailmergehelper.hxx>
25#include <sfx2/basedlgs.hxx>
26#include <vcl/textfilter.hxx>
27#include <svl/lstner.hxx>
28#include <vcl/idle.hxx>
30
33
35{
36 OUString m_sDocument;
39
41
42 std::unique_ptr<weld::Button> m_xAddressListPB;
43 std::unique_ptr<weld::Label> m_xCurrentAddressFI;
44
45 std::unique_ptr<weld::Container> m_xStep2;
46 std::unique_ptr<weld::Container> m_xStep3;
47 std::unique_ptr<weld::Container> m_xStep4;
48
49 std::unique_ptr<weld::Label> m_xSettingsFI;
50 std::unique_ptr<weld::CheckButton> m_xAddressCB;
51 std::unique_ptr<weld::Button> m_xSettingsPB;
52 std::unique_ptr<weld::CheckButton> m_xHideEmptyParagraphsCB;
53
54 std::unique_ptr<weld::Button> m_xAssignPB;
55
56 std::unique_ptr<weld::Label> m_xDocumentIndexFI;
57 std::unique_ptr<weld::Button> m_xPrevSetIB;
58 std::unique_ptr<weld::Button> m_xNextSetIB;
59
60 std::unique_ptr<weld::Button> m_xDifferentlist;
61
62 std::unique_ptr<SwAddressPreview> m_xSettings;
63 std::unique_ptr<SwAddressPreview> m_xPreview;
64 std::unique_ptr<weld::CustomWeld> m_xSettingsWIN;
65 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
66
67 void InsertDataHdl(const weld::Button* pButton);
68
69 DECL_LINK(AddressListHdl_Impl, weld::Button&, void);
70 DECL_LINK(SettingsHdl_Impl, weld::Button&, void);
71 DECL_LINK(AssignHdl_Impl, weld::Button&, void);
72 DECL_LINK(AddressBlockHdl_Impl, weld::Toggleable&, void);
73 DECL_LINK(InsertDataHdl_Impl, weld::Button&, void);
74 DECL_LINK(AddressBlockSelectHdl_Impl, LinkParamNone*, void);
75 DECL_LINK(HideParagraphsHdl_Impl, weld::Toggleable&, void);
76
77 void EnableAddressBlock(bool bAll, bool bSelective);
78
79 virtual void Activate() override;
80 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
81 virtual bool canAdvance() const override;
82
83public:
85 virtual ~SwMailMergeAddressBlockPage() override;
87};
88
90{
91 css::uno::Sequence< OUString> m_aAddressBlocks;
93
94 std::unique_ptr<SwAddressPreview> m_xPreview;
95 std::unique_ptr<weld::Button> m_xNewPB;
96 std::unique_ptr<weld::Button> m_xCustomizePB;
97 std::unique_ptr<weld::Button> m_xDeletePB;
98 std::unique_ptr<weld::RadioButton> m_xNeverRB;
99 std::unique_ptr<weld::RadioButton> m_xAlwaysRB;
100 std::unique_ptr<weld::RadioButton> m_xDependentRB;
101 std::unique_ptr<weld::Entry> m_xCountryED;
102 std::unique_ptr<weld::CustomWeld> m_xPreviewWin;
103
104 DECL_LINK(NewCustomizeHdl_Impl, weld::Button&, void);
105 DECL_LINK(DeleteHdl_Impl, weld::Button&, void);
106 DECL_LINK(IncludeHdl_Impl, weld::Toggleable&, void);
107
108public:
110 virtual ~SwSelectAddressBlockDialog() override;
111
112 void SetAddressBlocks(const css::uno::Sequence< OUString>& rBlocks,
113 sal_uInt16 nSelected);
114 const css::uno::Sequence< OUString>& GetAddressBlocks();
115
116 void SetSettings(bool bIsCountry, const OUString& sCountry);
117 bool IsIncludeCountry() const {return !m_xNeverRB->get_active();}
118 OUString GetCountry() const;
119};
120
122
123enum class MoveItemFlags {
124 NONE = 0,
125 Left = 1,
126 Right = 2,
127 Up = 4,
128 Down = 8,
129};
130namespace o3tl {
131 template<> struct typed_flags<MoveItemFlags> : is_typed_flags<MoveItemFlags, 0x0f> {};
132}
133
135
137 , public SfxListener
138{
142
143 virtual void EditViewSelectionChange() override;
144 virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget() override;
145
146 virtual bool KeyInput(const KeyEvent& rKEvt) override;
147 virtual bool Command(const CommandEvent& rCEvt) override;
148 virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
149
150public:
152 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
153 void EndDropTarget();
154 bool SetCursorLogicPosition(const Point& rPosition);
155 void UpdateFields();
156 virtual ~AddressMultiLineEdit() override;
157
160
161 void SetText( const OUString& rStr );
162 OUString GetText() const;
163 OUString GetAddress() const;
164
165 void InsertNewEntry( const OUString& rStr );
166 void InsertNewEntryAtPosition( const OUString& rStr, sal_uLong nPara, sal_uInt16 nIndex );
167 void RemoveCurrentEntry();
168
169 void MoveCurrentItem(MoveItemFlags nMove);
171 bool HasCurrentItem() const;
172 OUString GetCurrentItem() const;
173 void SelectCurrentItem();
174};
175
177{
179public:
181 {
186 };
187private:
189
190 std::vector<OUString> m_aSalutations;
191 std::vector<OUString> m_aPunctuations;
192
196
199
201
202 std::unique_ptr<weld::Label> m_xAddressElementsFT;
203 std::unique_ptr<weld::TreeView> m_xAddressElementsLB;
204 std::unique_ptr<weld::Button> m_xInsertFieldIB;
205 std::unique_ptr<weld::Button> m_xRemoveFieldIB;
206 std::unique_ptr<weld::Label> m_xDragFT;
207 std::unique_ptr<weld::Button> m_xUpIB;
208 std::unique_ptr<weld::Button> m_xLeftIB;
209 std::unique_ptr<weld::Button> m_xRightIB;
210 std::unique_ptr<weld::Button> m_xDownIB;
211 std::unique_ptr<weld::Label> m_xFieldFT;
212 std::unique_ptr<weld::ComboBox> m_xFieldCB;
213 std::unique_ptr<weld::Button> m_xOK;
214 std::unique_ptr<SwAddressPreview> m_xPreview;
215 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
216 std::unique_ptr<AddressMultiLineEdit> m_xDragED;
217 std::unique_ptr<weld::CustomWeld> m_xDragWIN;
218
219 DECL_LINK(OKHdl_Impl, weld::Button&, void);
220 DECL_LINK(ListBoxSelectHdl_Impl, weld::TreeView&, void);
221 DECL_LINK(EditModifyHdl_Impl, AddressMultiLineEdit&, void);
222 DECL_LINK(ImageButtonHdl_Impl, weld::Button&, void);
223 DECL_LINK(SelectionChangedHdl_Impl, bool, void);
224 DECL_LINK(FieldChangeComboBoxHdl_Impl, weld::ComboBox&, void);
225 DECL_LINK(TextFilterHdl, OUString&, bool);
226 DECL_LINK(SelectionChangedIdleHdl, Timer*, void);
227
228 sal_Int32 GetSelectedItem_Impl() const;
230
231public:
233 virtual ~SwCustomizeAddressBlockDialog() override;
234
235 bool SetCursorLogicPosition(const Point& rPosition);
236 void UpdateFields();
237
238 // for dragging from the TreeViews, return the active source
239 weld::TreeView* get_drag_source() const { return m_xAddressElementsLB->get_drag_source(); }
240 bool HasItem(sal_Int32 nUserData);
241
242 void SetAddress(const OUString& rAddress);
243 OUString GetAddress() const;
244};
245
248{
249 OUString m_sNone;
251
253
254 std::unique_ptr<SwAddressPreview> m_xPreview;
255 std::unique_ptr<weld::Label> m_xMatchingFI;
256 std::unique_ptr<weld::Label> m_xAddressTitle;
257 std::unique_ptr<weld::Label> m_xMatchTitle;
258 std::unique_ptr<weld::Label> m_xPreviewTitle;
259 std::unique_ptr<weld::Label> m_xPreviewFI;
260 std::unique_ptr<weld::Button> m_xOK;
261 std::unique_ptr<weld::CustomWeld> m_xPreviewWin;
262 std::unique_ptr<SwAssignFieldsControl> m_xFieldsControl;
263
264 css::uno::Sequence< OUString > CreateAssignments();
265 DECL_LINK(OkHdl_Impl, weld::Button&, void);
266 DECL_LINK(AssignmentModifyHdl_Impl, LinkParamNone*, void);
267
268public:
270 SwMailMergeConfigItem& rConfigItem,
271 OUString aPreview,
272 bool bIsAddressBlock);
273
274 void ConnectSizeGroups(int nLabelWidth, int nComboBoxWidth, int nPreviewWidth);
275
276 virtual ~SwAssignFieldsDialog() override;
277};
278#endif
279
280/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void EditViewSelectionChange() override
Link< bool, void > m_aSelectionLink
AddressMultiLineEdit(SwCustomizeAddressBlockDialog *pParent)
bool SetCursorLogicPosition(const Point &rPosition)
MoveItemFlags IsCurrentItemMoveable() const
void SetSelectionChangedHdl(const Link< bool, void > &rLink)
void SetText(const OUString &rStr)
SwCustomizeAddressBlockDialog * m_pParentDialog
void InsertNewEntry(const OUString &rStr)
void MoveCurrentItem(MoveItemFlags nMove)
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Link< AddressMultiLineEdit &, void > m_aModifyLink
virtual bool Command(const CommandEvent &rCEvt) override
void SetModifyHdl(const Link< AddressMultiLineEdit &, void > &rLink)
void InsertNewEntryAtPosition(const OUString &rStr, sal_uLong nPara, sal_uInt16 nIndex)
OUString GetCurrentItem() const
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
virtual ~AddressMultiLineEdit() override
virtual css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget() override
virtual bool KeyInput(const KeyEvent &rKEvt) override
virtual ~SwAssignFieldsDialog() override
std::unique_ptr< weld::CustomWeld > m_xPreviewWin
css::uno::Sequence< OUString > CreateAssignments()
std::unique_ptr< weld::Label > m_xPreviewFI
std::unique_ptr< weld::Label > m_xMatchTitle
DECL_LINK(AssignmentModifyHdl_Impl, LinkParamNone *, void)
std::unique_ptr< weld::Label > m_xAddressTitle
SwAssignFieldsDialog(weld::Window *pParent, SwMailMergeConfigItem &rConfigItem, OUString aPreview, bool bIsAddressBlock)
void ConnectSizeGroups(int nLabelWidth, int nComboBoxWidth, int nPreviewWidth)
SwMailMergeConfigItem & m_rConfigItem
std::unique_ptr< weld::Label > m_xMatchingFI
DECL_LINK(OkHdl_Impl, weld::Button &, void)
std::unique_ptr< SwAddressPreview > m_xPreview
std::unique_ptr< weld::Label > m_xPreviewTitle
std::unique_ptr< SwAssignFieldsControl > m_xFieldsControl
std::unique_ptr< weld::Button > m_xOK
std::unique_ptr< weld::Button > m_xRightIB
std::unique_ptr< weld::CustomWeld > m_xDragWIN
bool HasItem(sal_Int32 nUserData)
std::vector< OUString > m_aSalutations
DECL_LINK(OKHdl_Impl, weld::Button &, void)
std::vector< OUString > m_aPunctuations
std::unique_ptr< weld::Label > m_xFieldFT
std::unique_ptr< weld::CustomWeld > m_xPreviewWIN
SwCustomizeAddressBlockDialog(weld::Widget *pParent, SwMailMergeConfigItem &rConfig, DialogType)
DECL_LINK(EditModifyHdl_Impl, AddressMultiLineEdit &, void)
DECL_LINK(TextFilterHdl, OUString &, bool)
std::unique_ptr< weld::Button > m_xRemoveFieldIB
void SetAddress(const OUString &rAddress)
DECL_LINK(ImageButtonHdl_Impl, weld::Button &, void)
std::unique_ptr< weld::TreeView > m_xAddressElementsLB
std::unique_ptr< weld::Label > m_xDragFT
std::unique_ptr< weld::Button > m_xOK
std::unique_ptr< weld::Button > m_xInsertFieldIB
DECL_LINK(FieldChangeComboBoxHdl_Impl, weld::ComboBox &, void)
DECL_LINK(SelectionChangedIdleHdl, Timer *, void)
std::unique_ptr< AddressMultiLineEdit > m_xDragED
virtual ~SwCustomizeAddressBlockDialog() override
DECL_LINK(SelectionChangedHdl_Impl, bool, void)
std::unique_ptr< weld::Label > m_xAddressElementsFT
std::unique_ptr< weld::Button > m_xUpIB
DECL_LINK(ListBoxSelectHdl_Impl, weld::TreeView &, void)
std::unique_ptr< weld::ComboBox > m_xFieldCB
std::unique_ptr< weld::Button > m_xLeftIB
std::unique_ptr< weld::Button > m_xDownIB
SwMailMergeConfigItem & m_rConfigItem
bool SetCursorLogicPosition(const Point &rPosition)
weld::TreeView * get_drag_source() const
std::unique_ptr< SwAddressPreview > m_xPreview
std::unique_ptr< weld::Button > m_xAssignPB
virtual ~SwMailMergeAddressBlockPage() override
SwMailMergeWizard * GetWizard()
std::unique_ptr< weld::CheckButton > m_xAddressCB
std::unique_ptr< SwAddressPreview > m_xSettings
virtual void Activate() override
std::unique_ptr< weld::Container > m_xStep4
DECL_LINK(InsertDataHdl_Impl, weld::Button &, void)
DECL_LINK(SettingsHdl_Impl, weld::Button &, void)
std::unique_ptr< weld::Label > m_xSettingsFI
std::unique_ptr< weld::Container > m_xStep3
std::unique_ptr< weld::Button > m_xAddressListPB
std::unique_ptr< SwAddressPreview > m_xPreview
DECL_LINK(AddressBlockHdl_Impl, weld::Toggleable &, void)
std::unique_ptr< weld::CustomWeld > m_xPreviewWIN
std::unique_ptr< weld::Button > m_xSettingsPB
std::unique_ptr< weld::Button > m_xPrevSetIB
std::unique_ptr< weld::Button > m_xDifferentlist
SwMailMergeAddressBlockPage(weld::Container *pPage, SwMailMergeWizard *pWizard)
DECL_LINK(HideParagraphsHdl_Impl, weld::Toggleable &, void)
std::unique_ptr< weld::CustomWeld > m_xSettingsWIN
virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason) override
std::unique_ptr< weld::CheckButton > m_xHideEmptyParagraphsCB
DECL_LINK(AddressListHdl_Impl, weld::Button &, void)
std::unique_ptr< weld::Button > m_xNextSetIB
DECL_LINK(AssignHdl_Impl, weld::Button &, void)
virtual bool canAdvance() const override
void EnableAddressBlock(bool bAll, bool bSelective)
std::unique_ptr< weld::Label > m_xCurrentAddressFI
DECL_LINK(AddressBlockSelectHdl_Impl, LinkParamNone *, void)
std::unique_ptr< weld::Label > m_xDocumentIndexFI
void InsertDataHdl(const weld::Button *pButton)
std::unique_ptr< weld::Container > m_xStep2
DECL_LINK(DeleteHdl_Impl, weld::Button &, void)
std::unique_ptr< weld::RadioButton > m_xDependentRB
void SetSettings(bool bIsCountry, const OUString &sCountry)
SwMailMergeConfigItem & m_rConfig
std::unique_ptr< weld::CustomWeld > m_xPreviewWin
virtual ~SwSelectAddressBlockDialog() override
DECL_LINK(NewCustomizeHdl_Impl, weld::Button &, void)
std::unique_ptr< weld::Entry > m_xCountryED
SwSelectAddressBlockDialog(weld::Window *pParent, SwMailMergeConfigItem &rConfig)
void SetAddressBlocks(const css::uno::Sequence< OUString > &rBlocks, sal_uInt16 nSelected)
std::unique_ptr< weld::Button > m_xNewPB
css::uno::Sequence< OUString > m_aAddressBlocks
DECL_LINK(IncludeHdl_Impl, weld::Toggleable &, void)
const css::uno::Sequence< OUString > & GetAddressBlocks()
std::unique_ptr< weld::Button > m_xDeletePB
std::unique_ptr< weld::Button > m_xCustomizePB
std::unique_ptr< weld::RadioButton > m_xAlwaysRB
std::unique_ptr< weld::RadioButton > m_xNeverRB
std::unique_ptr< SwAddressPreview > m_xPreview
NONE
sal_uIntPtr sal_uLong
Left
Right