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 MouseButtonDown(const MouseEvent& rMEvt) override;
148
149public:
151 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
152 void EndDropTarget();
153 bool SetCursorLogicPosition(const Point& rPosition);
154 void UpdateFields();
155 virtual ~AddressMultiLineEdit() override;
156
159
160 void SetText( const OUString& rStr );
161 OUString GetText() const;
162 OUString GetAddress() const;
163
164 void InsertNewEntry( const OUString& rStr );
165 void InsertNewEntryAtPosition( const OUString& rStr, sal_uLong nPara, sal_uInt16 nIndex );
166 void RemoveCurrentEntry();
167
168 void MoveCurrentItem(MoveItemFlags nMove);
170 bool HasCurrentItem() const;
171 OUString GetCurrentItem() const;
172 void SelectCurrentItem();
173};
174
176{
178public:
180 {
185 };
186private:
188
189 std::vector<OUString> m_aSalutations;
190 std::vector<OUString> m_aPunctuations;
191
195
198
200
201 std::unique_ptr<weld::Label> m_xAddressElementsFT;
202 std::unique_ptr<weld::TreeView> m_xAddressElementsLB;
203 std::unique_ptr<weld::Button> m_xInsertFieldIB;
204 std::unique_ptr<weld::Button> m_xRemoveFieldIB;
205 std::unique_ptr<weld::Label> m_xDragFT;
206 std::unique_ptr<weld::Button> m_xUpIB;
207 std::unique_ptr<weld::Button> m_xLeftIB;
208 std::unique_ptr<weld::Button> m_xRightIB;
209 std::unique_ptr<weld::Button> m_xDownIB;
210 std::unique_ptr<weld::Label> m_xFieldFT;
211 std::unique_ptr<weld::ComboBox> m_xFieldCB;
212 std::unique_ptr<weld::Button> m_xOK;
213 std::unique_ptr<SwAddressPreview> m_xPreview;
214 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
215 std::unique_ptr<AddressMultiLineEdit> m_xDragED;
216 std::unique_ptr<weld::CustomWeld> m_xDragWIN;
217
218 DECL_LINK(OKHdl_Impl, weld::Button&, void);
219 DECL_LINK(ListBoxSelectHdl_Impl, weld::TreeView&, void);
220 DECL_LINK(EditModifyHdl_Impl, AddressMultiLineEdit&, void);
221 DECL_LINK(ImageButtonHdl_Impl, weld::Button&, void);
222 DECL_LINK(SelectionChangedHdl_Impl, bool, void);
223 DECL_LINK(FieldChangeComboBoxHdl_Impl, weld::ComboBox&, void);
224 DECL_LINK(TextFilterHdl, OUString&, bool);
225 DECL_LINK(SelectionChangedIdleHdl, Timer*, void);
226
227 sal_Int32 GetSelectedItem_Impl() const;
229
230public:
232 virtual ~SwCustomizeAddressBlockDialog() override;
233
234 bool SetCursorLogicPosition(const Point& rPosition);
235 void UpdateFields();
236
237 // for dragging from the TreeViews, return the active source
238 weld::TreeView* get_drag_source() const { return m_xAddressElementsLB->get_drag_source(); }
239 bool HasItem(sal_Int32 nUserData);
240
241 void SetAddress(const OUString& rAddress);
242 OUString GetAddress() const;
243};
244
247{
248 OUString m_sNone;
250
252
253 std::unique_ptr<SwAddressPreview> m_xPreview;
254 std::unique_ptr<weld::Label> m_xMatchingFI;
255 std::unique_ptr<weld::Label> m_xAddressTitle;
256 std::unique_ptr<weld::Label> m_xMatchTitle;
257 std::unique_ptr<weld::Label> m_xPreviewTitle;
258 std::unique_ptr<weld::Label> m_xPreviewFI;
259 std::unique_ptr<weld::Button> m_xOK;
260 std::unique_ptr<weld::CustomWeld> m_xPreviewWin;
261 std::unique_ptr<SwAssignFieldsControl> m_xFieldsControl;
262
263 std::unique_ptr<weld::SizeGroup> m_xLabelGroup;
264 std::unique_ptr<weld::SizeGroup> m_xComboGroup;
265 std::unique_ptr<weld::SizeGroup> m_xPreviewGroup;
266
267 css::uno::Sequence< OUString > CreateAssignments();
268 DECL_LINK(OkHdl_Impl, weld::Button&, void);
269 DECL_LINK(AssignmentModifyHdl_Impl, LinkParamNone*, void);
270
271public:
273 SwMailMergeConfigItem& rConfigItem,
274 OUString aPreview,
275 bool bIsAddressBlock);
276
277 void ConnectSizeGroups(int nLabelWidth, int nComboBoxWidth, int nPreviewWidth);
278
279 virtual ~SwAssignFieldsDialog() override;
280};
281#endif
282
283/* 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
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::SizeGroup > m_xComboGroup
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::SizeGroup > m_xPreviewGroup
std::unique_ptr< weld::Label > m_xPreviewTitle
std::unique_ptr< SwAssignFieldsControl > m_xFieldsControl
std::unique_ptr< weld::Button > m_xOK
std::unique_ptr< weld::SizeGroup > m_xLabelGroup
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