Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/source/uibase/inc/mmconfigitem.hxx
Line
Count
Source
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_UIBASE_INC_MMCONFIGITEM_HXX
20
#define INCLUDED_SW_SOURCE_UIBASE_INC_MMCONFIGITEM_HXX
21
22
#include <com/sun/star/uno/Sequence.hxx>
23
#include <com/sun/star/uno/Reference.hxx>
24
#include <com/sun/star/view/XSelectionChangeListener.hpp>
25
#include <memory>
26
#include <set>
27
#include <vector>
28
#include <swdbdata.hxx>
29
#include <swdllapi.h>
30
#include "sharedconnection.hxx"
31
32
namespace com::sun::star{
33
    namespace sdbc{
34
        class XDataSource;
35
        class XResultSet;
36
    }
37
    namespace sdbcx{
38
        class XColumnsSupplier;
39
    }
40
}
41
42
class SwMailMergeConfigItem_Impl;
43
class SwView;
44
namespace sw::mark { class MarkBase; }
45
46
struct SwDocMergeInfo
47
{
48
    sw::mark::MarkBase* startPageInTarget;
49
    sal_Int32    nDBRow;
50
};
51
52
class SW_DLLPUBLIC SwMailMergeConfigItem
53
{
54
    std::unique_ptr<SwMailMergeConfigItem_Impl> m_pImpl;
55
    //session information - not stored in configuration
56
    bool m_bAddressInserted;
57
    bool m_bGreetingInserted;
58
    sal_Int32 m_nGreetingMoves;
59
    sal_uInt32 m_nBegin;
60
    sal_uInt32 m_nEnd;
61
    std::set<sal_Int32> m_aExcludedRecords;
62
    css::uno::Reference<css::view::XSelectionChangeListener> m_xDBChangedListener;
63
64
    OUString m_sSelectedPrinter;
65
66
    SwView* m_pSourceView;
67
    SwView* m_pTargetView;
68
public:
69
    SwMailMergeConfigItem();
70
    ~SwMailMergeConfigItem();
71
72
    enum Gender
73
    {
74
        FEMALE,
75
        MALE,
76
        NEUTRAL
77
    };
78
79
    void Commit();
80
81
    const std::vector<std::pair<OUString, int>>& GetDefaultAddressHeaders() const;
82
83
    void SetCurrentConnection(
84
        css::uno::Reference< css::sdbc::XDataSource> const & xSource,
85
        const SharedConnection& rConnection,
86
        css::uno::Reference< css::sdbcx::XColumnsSupplier> const & xColumnsSupplier,
87
        const SwDBData& rDBData);
88
89
    css::uno::Reference< css::sdbc::XDataSource> const & GetSource() const;
90
91
    SharedConnection const & GetConnection() const;
92
93
    css::uno::Reference< css::sdbcx::XColumnsSupplier> const & GetColumnsSupplier();
94
95
    css::uno::Reference< css::sdbc::XResultSet> const & GetResultSet() const;
96
97
    void DisposeResultSet();
98
99
    OUString& GetFilter() const;
100
    void SetFilter(OUString const &);
101
102
    void SetCurrentDBData( const SwDBData& rDBData);
103
    const SwDBData& GetCurrentDBData() const;
104
105
    // move absolute, nTarget == -1 -> goto last record
106
    sal_Int32 MoveResultSet(sal_Int32 nTarget);
107
    sal_Int32 GetResultSetPosition()const;
108
    bool IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast);
109
110
    bool IsRecordIncluded(sal_uInt32 nRecord) const;
111
    bool IsRecordExcluded(sal_uInt32 nRecord) const;
112
    void ExcludeRecord(sal_Int32 nRecord, bool bExclude);
113
    css::uno::Sequence< css::uno::Any> GetSelection() const;
114
115
    const css::uno::Sequence<OUString>& GetSavedDocuments() const;
116
117
    bool IsOutputToLetter()const;
118
    void SetOutputToLetter(bool bSet);
119
120
    bool IsAddressBlock()const;
121
    void SetAddressBlock(bool bSet);
122
123
    bool IsHideEmptyParagraphs() const;
124
    void SetHideEmptyParagraphs(bool bSet);
125
126
    css::uno::Sequence<OUString> GetAddressBlocks() const;
127
    void SetAddressBlocks(const css::uno::Sequence< OUString>& rBlocks);
128
129
    void SetCurrentAddressBlockIndex( sal_Int32 nSet );
130
    sal_Int32 GetCurrentAddressBlockIndex() const;
131
132
    bool IsIncludeCountry() const;
133
    OUString& GetExcludeCountry() const;
134
    void SetCountrySettings(bool bSet, const OUString& sCountry);
135
136
    bool IsIndividualGreeting(bool bInEMail) const;
137
    void SetIndividualGreeting(bool bSet, bool bInEMail);
138
139
    bool IsGreetingLine(bool bInEMail) const;
140
    void SetGreetingLine(bool bSet, bool bInEMail);
141
142
    css::uno::Sequence<OUString> GetGreetings(Gender eType) const;
143
    void SetGreetings(Gender eType, const css::uno::Sequence< OUString>& rBlocks);
144
145
    sal_Int32 GetCurrentGreeting(Gender eType) const;
146
    void SetCurrentGreeting(Gender eType, sal_Int32 nIndex);
147
148
    //the content of the gender column that marks it as female
149
    const OUString& GetFemaleGenderValue() const;
150
    void SetFemaleGenderValue(const OUString& rValue);
151
152
    //returns the assignment in the order of the default headers (GetDefaultAddressHeaders())
153
    css::uno::Sequence<OUString> GetColumnAssignment( const SwDBData& rDBData ) const;
154
    void SetColumnAssignment(
155
        const SwDBData& rDBData,
156
        const css::uno::Sequence< OUString>& );
157
158
    bool IsAddressFieldsAssigned() const;
159
    bool IsGreetingFieldsAssigned() const;
160
161
    //e-Mail settings:
162
    OUString const & GetMailDisplayName() const;
163
    void SetMailDisplayName(const OUString& rName);
164
165
    OUString const & GetMailAddress() const;
166
    void SetMailAddress(const OUString& rAddress);
167
168
    bool IsMailReplyTo() const;
169
    void SetMailReplyTo(bool bSet);
170
171
    OUString const & GetMailReplyTo() const;
172
    void SetMailReplyTo(const OUString& rReplyTo);
173
174
    OUString const & GetMailServer() const;
175
    void SetMailServer(const OUString& rAddress);
176
177
    sal_Int16 GetMailPort() const;
178
    void SetMailPort(sal_Int16 nSet);
179
180
    bool IsSecureConnection() const;
181
    void SetSecureConnection(bool bSet);
182
183
    bool IsAuthentication() const;
184
    void SetAuthentication(bool bSet);
185
186
    OUString const & GetMailUserName() const;
187
    void SetMailUserName(const OUString& rName);
188
189
    OUString const & GetMailPassword() const;
190
    void SetMailPassword(const OUString& rPassword);
191
192
    bool IsSMTPAfterPOP() const;
193
    void SetSMTPAfterPOP(bool bSet);
194
195
    OUString const & GetInServerName() const;
196
    void SetInServerName(const OUString& rServer);
197
198
    sal_Int16 GetInServerPort() const;
199
    void SetInServerPort(sal_Int16 nSet);
200
201
    bool IsInServerPOP() const;
202
    void SetInServerPOP(bool bSet);
203
204
    OUString const & GetInServerUserName() const;
205
    void SetInServerUserName(const OUString& rName);
206
207
    OUString const & GetInServerPassword() const;
208
    void SetInServerPassword(const OUString& rPassword);
209
210
    //session information
211
0
    bool IsAddressInserted() const { return m_bAddressInserted; }
212
    void SetAddressInserted()
213
0
    {
214
0
        m_bAddressInserted = true;
215
0
    }
216
217
    bool IsGreetingInserted() const
218
0
        { return m_bGreetingInserted; }
219
    void SetGreetingInserted()
220
0
        { m_bGreetingInserted = true; }
221
222
    void SetBeginEnd(sal_uInt32 nBegin, sal_uInt32 nEnd)
223
0
        { m_nBegin = nBegin; m_nEnd = nEnd; }
224
225
    // counts the moves in the layout page
226
0
    void MoveGreeting( sal_Int32 nMove) { m_nGreetingMoves += nMove;}
227
0
    sal_Int32 GetGreetingMoves() const { return m_nGreetingMoves;}
228
229
    // new source document - reset some flags
230
    void DocumentReloaded();
231
232
    bool IsMailAvailable() const;
233
234
    // notify a completed merge, provide the appropriate e-Mail address if available
235
    void AddMergedDocument(SwDocMergeInfo const & rInfo);
236
    //returns the page and database cursor information of each merged document
237
    SwDocMergeInfo& GetDocumentMergeInfo(sal_uInt32 nDocument);
238
    sal_uInt32 GetMergedDocumentCount();
239
240
    const OUString&  GetSelectedPrinter() const
241
0
        { return m_sSelectedPrinter; }
242
    void SetSelectedPrinter(const OUString& rSet)
243
0
        { m_sSelectedPrinter = rSet; }
244
245
    SwView* GetTargetView();
246
    void SetTargetView(SwView* pView);
247
248
    SwView* GetSourceView();
249
    void SetSourceView(SwView* pView);
250
251
    //helper methods
252
    OUString GetAssignedColumn(sal_uInt32 nColumn) const;
253
    void stopDBChangeListening();
254
    void updateCurrentDBDataFromDocument();
255
};
256
257
#endif
258
259
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */