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_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 <tools/long.hxx>
29 #include <swdbdata.hxx>
31 #include "sharedconnection.hxx"
33 namespace com::sun::star
{
39 class XColumnsSupplier
;
43 class SwMailMergeConfigItem_Impl
;
45 namespace sw::mark
{ class IMark
; }
49 sw::mark::IMark
* startPageInTarget
;
53 class SW_DLLPUBLIC SwMailMergeConfigItem
55 std::unique_ptr
<SwMailMergeConfigItem_Impl
> m_pImpl
;
56 //session information - not stored in configuration
57 bool m_bAddressInserted
;
58 bool m_bGreetingInserted
;
59 sal_Int32 m_nGreetingMoves
;
60 std::set
<sal_Int32
> m_aExcludedRecords
;
61 css::uno::Reference
<css::view::XSelectionChangeListener
> m_xDBChangedListener
;
63 OUString m_sSelectedPrinter
;
65 SwView
* m_pSourceView
;
66 SwView
* m_pTargetView
;
68 SwMailMergeConfigItem();
69 ~SwMailMergeConfigItem();
80 const std::vector
<std::pair
<OUString
, int>>& GetDefaultAddressHeaders() const;
82 void SetCurrentConnection(
83 css::uno::Reference
< css::sdbc::XDataSource
> const & xSource
,
84 const SharedConnection
& rConnection
,
85 css::uno::Reference
< css::sdbcx::XColumnsSupplier
> const & xColumnsSupplier
,
86 const SwDBData
& rDBData
);
88 css::uno::Reference
< css::sdbc::XDataSource
> const & GetSource() const;
90 SharedConnection
const & GetConnection() const;
92 css::uno::Reference
< css::sdbcx::XColumnsSupplier
> const & GetColumnsSupplier();
94 css::uno::Reference
< css::sdbc::XResultSet
> const & GetResultSet() const;
96 void DisposeResultSet();
98 OUString
& GetFilter() const;
99 void SetFilter(OUString
const &);
101 void SetCurrentDBData( const SwDBData
& rDBData
);
102 const SwDBData
& GetCurrentDBData() const;
104 // move absolute, nTarget == -1 -> goto last record
105 sal_Int32
MoveResultSet(sal_Int32 nTarget
);
106 sal_Int32
GetResultSetPosition()const;
107 bool IsResultSetFirstLast(bool& bIsFirst
, bool& bIsLast
);
109 bool IsRecordExcluded(sal_Int32 nRecord
) const;
110 void ExcludeRecord(sal_Int32 nRecord
, bool bExclude
);
111 css::uno::Sequence
< css::uno::Any
> GetSelection() const;
113 const css::uno::Sequence
<OUString
>& GetSavedDocuments() const;
115 bool IsOutputToLetter()const;
116 void SetOutputToLetter(bool bSet
);
118 bool IsAddressBlock()const;
119 void SetAddressBlock(bool bSet
);
121 bool IsHideEmptyParagraphs() const;
122 void SetHideEmptyParagraphs(bool bSet
);
124 css::uno::Sequence
<OUString
> GetAddressBlocks() const;
125 void SetAddressBlocks(const css::uno::Sequence
< OUString
>& rBlocks
);
127 void SetCurrentAddressBlockIndex( sal_Int32 nSet
);
128 sal_Int32
GetCurrentAddressBlockIndex() const;
130 bool IsIncludeCountry() const;
131 OUString
& GetExcludeCountry() const;
132 void SetCountrySettings(bool bSet
, const OUString
& sCountry
);
134 bool IsIndividualGreeting(bool bInEMail
) const;
135 void SetIndividualGreeting(bool bSet
, bool bInEMail
);
137 bool IsGreetingLine(bool bInEMail
) const;
138 void SetGreetingLine(bool bSet
, bool bInEMail
);
140 css::uno::Sequence
<OUString
> GetGreetings(Gender eType
) const;
141 void SetGreetings(Gender eType
, const css::uno::Sequence
< OUString
>& rBlocks
);
143 sal_Int32
GetCurrentGreeting(Gender eType
) const;
144 void SetCurrentGreeting(Gender eType
, sal_Int32 nIndex
);
146 //the content of the gender column that marks it as female
147 const OUString
& GetFemaleGenderValue() const;
148 void SetFemaleGenderValue(const OUString
& rValue
);
150 //returns the assignment in the order of the default headers (GetDefaultAddressHeaders())
151 css::uno::Sequence
<OUString
> GetColumnAssignment( const SwDBData
& rDBData
) const;
152 void SetColumnAssignment(
153 const SwDBData
& rDBData
,
154 const css::uno::Sequence
< OUString
>& );
156 bool IsAddressFieldsAssigned() const;
157 bool IsGreetingFieldsAssigned() const;
160 OUString
const & GetMailDisplayName() const;
161 void SetMailDisplayName(const OUString
& rName
);
163 OUString
const & GetMailAddress() const;
164 void SetMailAddress(const OUString
& rAddress
);
166 bool IsMailReplyTo() const;
167 void SetMailReplyTo(bool bSet
);
169 OUString
const & GetMailReplyTo() const;
170 void SetMailReplyTo(const OUString
& rReplyTo
);
172 OUString
const & GetMailServer() const;
173 void SetMailServer(const OUString
& rAddress
);
175 sal_Int16
GetMailPort() const;
176 void SetMailPort(sal_Int16 nSet
);
178 bool IsSecureConnection() const;
179 void SetSecureConnection(bool bSet
);
181 bool IsAuthentication() const;
182 void SetAuthentication(bool bSet
);
184 OUString
const & GetMailUserName() const;
185 void SetMailUserName(const OUString
& rName
);
187 OUString
const & GetMailPassword() const;
188 void SetMailPassword(const OUString
& rPassword
);
190 bool IsSMTPAfterPOP() const;
191 void SetSMTPAfterPOP(bool bSet
);
193 OUString
const & GetInServerName() const;
194 void SetInServerName(const OUString
& rServer
);
196 sal_Int16
GetInServerPort() const;
197 void SetInServerPort(sal_Int16 nSet
);
199 bool IsInServerPOP() const;
200 void SetInServerPOP(bool bSet
);
202 OUString
const & GetInServerUserName() const;
203 void SetInServerUserName(const OUString
& rName
);
205 OUString
const & GetInServerPassword() const;
206 void SetInServerPassword(const OUString
& rPassword
);
208 //session information
209 bool IsAddressInserted() const { return m_bAddressInserted
; }
210 void SetAddressInserted()
212 m_bAddressInserted
= true;
215 bool IsGreetingInserted() const
216 { return m_bGreetingInserted
; }
217 void SetGreetingInserted()
218 { m_bGreetingInserted
= true; }
220 // counts the moves in the layout page
221 void MoveGreeting( sal_Int32 nMove
) { m_nGreetingMoves
+= nMove
;}
222 sal_Int32
GetGreetingMoves() const { return m_nGreetingMoves
;}
224 // new source document - reset some flags
225 void DocumentReloaded();
227 bool IsMailAvailable() const;
229 // notify a completed merge, provide the appropriate e-Mail address if available
230 void AddMergedDocument(SwDocMergeInfo
const & rInfo
);
231 //returns the page and database cursor information of each merged document
232 SwDocMergeInfo
& GetDocumentMergeInfo(sal_uInt32 nDocument
);
233 sal_uInt32
GetMergedDocumentCount();
235 const OUString
& GetSelectedPrinter() const
236 { return m_sSelectedPrinter
; }
237 void SetSelectedPrinter(const OUString
& rSet
)
238 { m_sSelectedPrinter
= rSet
; }
240 SwView
* GetTargetView();
241 void SetTargetView(SwView
* pView
);
243 SwView
* GetSourceView();
244 void SetSourceView(SwView
* pView
);
247 OUString
GetAssignedColumn(sal_uInt32 nColumn
) const;
248 void stopDBChangeListening();
249 void updateCurrentDBDataFromDocument();
254 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */