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 _MMCONFIGITEM_HXX
20 #define _MMCONFIGITEM_HXX
22 #include <com/sun/star/uno/Sequence.hxx>
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <tools/resary.hxx>
25 #include <swdbdata.hxx>
27 #include "sharedconnection.hxx"
29 namespace com
{namespace sun
{namespace star
{
35 class XColumnsSupplier
;
39 class SwMailMergeConfigItem_Impl
;
44 long nStartPageInTarget
;
45 long nEndPageInTarget
;
49 class SW_DLLPUBLIC SwMailMergeConfigItem
51 // com::sun::star::uno::Sequence< OUString> m_aSavedDocuments;
52 SwMailMergeConfigItem_Impl
* m_pImpl
;
53 //session information - not stored in configuration
54 bool m_bAddressInserted
;
56 bool m_bGreetingInserted
;
57 sal_Int32 m_nGreetingMoves
;
58 OUString m_rAddressBlockFrame
;
59 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> m_aSelection
;
61 sal_uInt16 m_nStartPrint
;
62 sal_uInt16 m_nEndPrint
;
64 OUString m_sSelectedPrinter
;
66 SwView
* m_pSourceView
;
67 SwView
* m_pTargetView
;
69 SwMailMergeConfigItem();
70 ~SwMailMergeConfigItem();
81 const ResStringArray
& GetDefaultAddressHeaders() const;
83 void SetCurrentConnection(
84 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
> xSource
,
85 SharedConnection xConnection
,
86 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XColumnsSupplier
> xColumnsSupplier
,
87 const SwDBData
& rDBData
);
89 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
>
92 SharedConnection
GetConnection();
94 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XColumnsSupplier
>
97 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XResultSet
>
100 void DisposeResultSet();
102 OUString
& GetFilter() const;
103 void SetFilter(OUString
&);
105 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>
107 void SetSelection(::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> rSelection
);
109 void SetCurrentDBData( const SwDBData
& rDBData
);
110 const SwDBData
& GetCurrentDBData() const;
112 // move absolute, nTarget == -1 -> goto last record
113 sal_Int32
MoveResultSet(sal_Int32 nTarget
);
114 sal_Int32
GetResultSetPosition()const;
115 bool IsResultSetFirstLast(bool& bIsFirst
, bool& bIsLast
);
117 bool IsRecordExcluded(sal_Int32 nRecord
);
118 void ExcludeRecord(sal_Int32 nRecord
, bool bExclude
);
120 const com::sun::star::uno::Sequence
< OUString
>&
121 GetSavedDocuments() const;
122 void AddSavedDocument(OUString rName
);
124 sal_Bool
IsOutputToLetter()const;
125 void SetOutputToLetter(sal_Bool bSet
);
127 sal_Bool
IsAddressBlock()const;
128 void SetAddressBlock(sal_Bool bSet
);
130 sal_Bool
IsHideEmptyParagraphs() const;
131 void SetHideEmptyParagraphs(sal_Bool bSet
);
133 const com::sun::star::uno::Sequence
< OUString
>
134 GetAddressBlocks() const;
135 void SetAddressBlocks(const com::sun::star::uno::Sequence
< OUString
>& rBlocks
);
137 void SetCurrentAddressBlockIndex( sal_Int32 nSet
);
138 sal_Int32
GetCurrentAddressBlockIndex() const;
140 sal_Bool
IsIncludeCountry() const;
141 OUString
& GetExcludeCountry() const;
142 void SetCountrySettings(sal_Bool bSet
, const OUString
& sCountry
);
144 sal_Bool
IsIndividualGreeting(sal_Bool bInEMail
) const;
145 void SetIndividualGreeting(sal_Bool bSet
, sal_Bool bInEMail
);
147 sal_Bool
IsGreetingLine(sal_Bool bInEMail
) const;
148 void SetGreetingLine(sal_Bool bSet
, sal_Bool bInEMail
);
150 const com::sun::star::uno::Sequence
< OUString
>
151 GetGreetings(Gender eType
) const;
152 void SetGreetings(Gender eType
, const com::sun::star::uno::Sequence
< OUString
>& rBlocks
);
154 sal_Int32
GetCurrentGreeting(Gender eType
) const;
155 void SetCurrentGreeting(Gender eType
, sal_Int32 nIndex
);
157 //the content of the gender column that marks it as female
158 const OUString
& GetFemaleGenderValue() const;
159 void SetFemaleGenderValue(const OUString rValue
);
161 //returns the assignment in the order of the default headers (GetDefaultAddressHeaders())
162 com::sun::star::uno::Sequence
< OUString
>
163 GetColumnAssignment( const SwDBData
& rDBData
) const;
164 void SetColumnAssignment(
165 const SwDBData
& rDBData
,
166 const com::sun::star::uno::Sequence
< OUString
>& );
168 bool IsAddressFieldsAssigned() const;
169 bool IsGreetingFieldsAssigned() const;
172 OUString
GetMailDisplayName() const;
173 void SetMailDisplayName(const OUString
& rName
);
175 OUString
GetMailAddress() const;
176 void SetMailAddress(const OUString
& rAddress
);
178 sal_Bool
IsMailReplyTo() const;
179 void SetMailReplyTo(sal_Bool bSet
);
181 OUString
GetMailReplyTo() const;
182 void SetMailReplyTo(const OUString
& rReplyTo
);
184 OUString
GetMailServer() const;
185 void SetMailServer(const OUString
& rAddress
);
187 sal_Int16
GetMailPort() const;
188 void SetMailPort(sal_Int16 nSet
);
190 sal_Bool
IsSecureConnection() const;
191 void SetSecureConnection(sal_Bool bSet
);
193 sal_Bool
IsAuthentication() const;
194 void SetAuthentication(sal_Bool bSet
);
196 OUString
GetMailUserName() const;
197 void SetMailUserName(const OUString
& rName
);
199 OUString
GetMailPassword() const;
200 void SetMailPassword(const OUString
& rPassword
);
202 sal_Bool
IsSMTPAfterPOP() const;
203 void SetSMTPAfterPOP(sal_Bool bSet
);
205 OUString
GetInServerName() const;
206 void SetInServerName(const OUString
& rServer
);
208 sal_Int16
GetInServerPort() const;
209 void SetInServerPort(sal_Int16 nSet
);
211 sal_Bool
IsInServerPOP() const;
212 void SetInServerPOP(sal_Bool bSet
);
214 OUString
GetInServerUserName() const;
215 void SetInServerUserName(const OUString
& rName
);
217 OUString
GetInServerPassword() const;
218 void SetInServerPassword(const OUString
& rPassword
);
220 //session information
221 bool IsAddressInserted() const { return m_bAddressInserted
; }
222 void SetAddressInserted(const OUString
& rFrameName
)
223 { m_bAddressInserted
= true;
224 m_rAddressBlockFrame
= rFrameName
;
227 bool IsGreetingInserted() const { return m_bGreetingInserted
; }
228 void SetGreetingInserted()
229 { m_bGreetingInserted
= true; }
231 // counts the moves in the layout page
232 void MoveGreeting( sal_Int32 nMove
) { m_nGreetingMoves
+= nMove
;}
233 sal_Int32
GetGreetingMoves() const { return m_nGreetingMoves
;}
235 bool IsMergeDone() const { return m_bMergeDone
;}
236 void SetMergeDone( ) { m_bMergeDone
= true; }
238 // new source document - reset some flags
239 void DocumentReloaded();
241 bool IsMailAvailable() const;
243 // notify a completed merge, provid the appropriate e-Mail address if available
244 void AddMergedDocument(SwDocMergeInfo
& rInfo
);
245 //returns the page and database cursor information of each merged document
246 SwDocMergeInfo
& GetDocumentMergeInfo(sal_uInt32 nDocument
);
247 sal_uInt32
GetMergedDocumentCount() const;
249 void SetPrintRange( sal_uInt16 nStartDocument
, sal_uInt16 nEndDocument
)
250 {m_nStartPrint
= nStartDocument
; m_nEndPrint
= nEndDocument
;}
251 sal_uInt16
GetPrintRangeStart() const {return m_nStartPrint
;}
252 sal_uInt16
GetPrintRangeEnd() const {return m_nEndPrint
;}
254 const OUString
& GetSelectedPrinter() const {return m_sSelectedPrinter
;}
255 void SetSelectedPrinter(const OUString
& rSet
)
256 {m_sSelectedPrinter
= rSet
;}
259 SwView
* GetTargetView();
260 void SetTargetView(SwView
* pView
);
262 SwView
* GetSourceView();
263 void SetSourceView(SwView
* pView
);
266 OUString
GetAssignedColumn(sal_uInt32 nColumn
)const;
271 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */