Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / inc / mmconfigitem.hxx
blobd1296dfe46ea578e88c7fe90c6dfbf06c80e40eb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_MMCONFIGITEM_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_MMCONFIGITEM_HXX
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"
32 namespace com::sun::star{
33 namespace sdbc{
34 class XDataSource;
35 class XResultSet;
37 namespace sdbcx{
38 class XColumnsSupplier;
42 class SwMailMergeConfigItem_Impl;
43 class SwView;
44 namespace sw::mark { class IMark; }
46 struct SwDocMergeInfo
48 sw::mark::IMark* startPageInTarget;
49 sal_Int32 nDBRow;
52 class SW_DLLPUBLIC SwMailMergeConfigItem
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;
64 OUString m_sSelectedPrinter;
66 SwView* m_pSourceView;
67 SwView* m_pTargetView;
68 public:
69 SwMailMergeConfigItem();
70 ~SwMailMergeConfigItem();
72 enum Gender
74 FEMALE,
75 MALE,
76 NEUTRAL
79 void Commit();
81 const std::vector<std::pair<OUString, int>>& GetDefaultAddressHeaders() const;
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);
89 css::uno::Reference< css::sdbc::XDataSource> const & GetSource() const;
91 SharedConnection const & GetConnection() const;
93 css::uno::Reference< css::sdbcx::XColumnsSupplier> const & GetColumnsSupplier();
95 css::uno::Reference< css::sdbc::XResultSet> const & GetResultSet() const;
97 void DisposeResultSet();
99 OUString& GetFilter() const;
100 void SetFilter(OUString const &);
102 void SetCurrentDBData( const SwDBData& rDBData);
103 const SwDBData& GetCurrentDBData() const;
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);
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;
115 const css::uno::Sequence<OUString>& GetSavedDocuments() const;
117 bool IsOutputToLetter()const;
118 void SetOutputToLetter(bool bSet);
120 bool IsAddressBlock()const;
121 void SetAddressBlock(bool bSet);
123 bool IsHideEmptyParagraphs() const;
124 void SetHideEmptyParagraphs(bool bSet);
126 css::uno::Sequence<OUString> GetAddressBlocks() const;
127 void SetAddressBlocks(const css::uno::Sequence< OUString>& rBlocks);
129 void SetCurrentAddressBlockIndex( sal_Int32 nSet );
130 sal_Int32 GetCurrentAddressBlockIndex() const;
132 bool IsIncludeCountry() const;
133 OUString& GetExcludeCountry() const;
134 void SetCountrySettings(bool bSet, const OUString& sCountry);
136 bool IsIndividualGreeting(bool bInEMail) const;
137 void SetIndividualGreeting(bool bSet, bool bInEMail);
139 bool IsGreetingLine(bool bInEMail) const;
140 void SetGreetingLine(bool bSet, bool bInEMail);
142 css::uno::Sequence<OUString> GetGreetings(Gender eType) const;
143 void SetGreetings(Gender eType, const css::uno::Sequence< OUString>& rBlocks);
145 sal_Int32 GetCurrentGreeting(Gender eType) const;
146 void SetCurrentGreeting(Gender eType, sal_Int32 nIndex);
148 //the content of the gender column that marks it as female
149 const OUString& GetFemaleGenderValue() const;
150 void SetFemaleGenderValue(const OUString& rValue);
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>& );
158 bool IsAddressFieldsAssigned() const;
159 bool IsGreetingFieldsAssigned() const;
161 //e-Mail settings:
162 OUString const & GetMailDisplayName() const;
163 void SetMailDisplayName(const OUString& rName);
165 OUString const & GetMailAddress() const;
166 void SetMailAddress(const OUString& rAddress);
168 bool IsMailReplyTo() const;
169 void SetMailReplyTo(bool bSet);
171 OUString const & GetMailReplyTo() const;
172 void SetMailReplyTo(const OUString& rReplyTo);
174 OUString const & GetMailServer() const;
175 void SetMailServer(const OUString& rAddress);
177 sal_Int16 GetMailPort() const;
178 void SetMailPort(sal_Int16 nSet);
180 bool IsSecureConnection() const;
181 void SetSecureConnection(bool bSet);
183 bool IsAuthentication() const;
184 void SetAuthentication(bool bSet);
186 OUString const & GetMailUserName() const;
187 void SetMailUserName(const OUString& rName);
189 OUString const & GetMailPassword() const;
190 void SetMailPassword(const OUString& rPassword);
192 bool IsSMTPAfterPOP() const;
193 void SetSMTPAfterPOP(bool bSet);
195 OUString const & GetInServerName() const;
196 void SetInServerName(const OUString& rServer);
198 sal_Int16 GetInServerPort() const;
199 void SetInServerPort(sal_Int16 nSet);
201 bool IsInServerPOP() const;
202 void SetInServerPOP(bool bSet);
204 OUString const & GetInServerUserName() const;
205 void SetInServerUserName(const OUString& rName);
207 OUString const & GetInServerPassword() const;
208 void SetInServerPassword(const OUString& rPassword);
210 //session information
211 bool IsAddressInserted() const { return m_bAddressInserted; }
212 void SetAddressInserted()
214 m_bAddressInserted = true;
217 bool IsGreetingInserted() const
218 { return m_bGreetingInserted; }
219 void SetGreetingInserted()
220 { m_bGreetingInserted = true; }
222 void SetBeginEnd(sal_uInt32 nBegin, sal_uInt32 nEnd)
223 { m_nBegin = nBegin; m_nEnd = nEnd; }
225 // counts the moves in the layout page
226 void MoveGreeting( sal_Int32 nMove) { m_nGreetingMoves += nMove;}
227 sal_Int32 GetGreetingMoves() const { return m_nGreetingMoves;}
229 // new source document - reset some flags
230 void DocumentReloaded();
232 bool IsMailAvailable() const;
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();
240 const OUString& GetSelectedPrinter() const
241 { return m_sSelectedPrinter; }
242 void SetSelectedPrinter(const OUString& rSet)
243 { m_sSelectedPrinter = rSet; }
245 SwView* GetTargetView();
246 void SetTargetView(SwView* pView);
248 SwView* GetSourceView();
249 void SetSourceView(SwView* pView);
251 //helper methods
252 OUString GetAssignedColumn(sal_uInt32 nColumn) const;
253 void stopDBChangeListening();
254 void updateCurrentDBDataFromDocument();
257 #endif
259 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */