Line data Source code
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 <tools/resary.hxx>
25 : #include <swdbdata.hxx>
26 : #include "swdllapi.h"
27 : #include "sharedconnection.hxx"
28 :
29 : namespace com{namespace sun{namespace star{
30 : namespace sdbc{
31 : class XDataSource;
32 : class XResultSet;
33 : }
34 : namespace sdbcx{
35 : class XColumnsSupplier;
36 : }
37 : }}}
38 :
39 : class SwMailMergeConfigItem_Impl;
40 : class SwView;
41 :
42 : struct SwDocMergeInfo
43 : {
44 : long nStartPageInTarget;
45 : long nEndPageInTarget;
46 : long nDBRow;
47 : };
48 :
49 : class SW_DLLPUBLIC SwMailMergeConfigItem
50 : {
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;
55 : bool m_bMergeDone;
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;
60 :
61 : sal_uInt16 m_nStartPrint;
62 : sal_uInt16 m_nEndPrint;
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 ResStringArray& GetDefaultAddressHeaders() const;
82 :
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);
88 :
89 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>
90 : GetSource();
91 :
92 : SharedConnection GetConnection();
93 :
94 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>
95 : GetColumnsSupplier();
96 :
97 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>
98 : GetResultSet() const;
99 :
100 : void DisposeResultSet();
101 :
102 : OUString& GetFilter() const;
103 : void SetFilter(OUString&);
104 :
105 : void SetSelection(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection);
106 :
107 : void SetCurrentDBData( const SwDBData& rDBData);
108 : const SwDBData& GetCurrentDBData() const;
109 :
110 : // move absolute, nTarget == -1 -> goto last record
111 : sal_Int32 MoveResultSet(sal_Int32 nTarget);
112 : sal_Int32 GetResultSetPosition()const;
113 : bool IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast);
114 :
115 : bool IsRecordExcluded(sal_Int32 nRecord);
116 : void ExcludeRecord(sal_Int32 nRecord, bool bExclude);
117 :
118 : const com::sun::star::uno::Sequence< OUString>&
119 : GetSavedDocuments() const;
120 : void AddSavedDocument(const OUString& rName);
121 :
122 : bool IsOutputToLetter()const;
123 : void SetOutputToLetter(bool bSet);
124 :
125 : bool IsAddressBlock()const;
126 : void SetAddressBlock(bool bSet);
127 :
128 : bool IsHideEmptyParagraphs() const;
129 : void SetHideEmptyParagraphs(bool bSet);
130 :
131 : const com::sun::star::uno::Sequence< OUString>
132 : GetAddressBlocks() const;
133 : void SetAddressBlocks(const com::sun::star::uno::Sequence< OUString>& rBlocks);
134 :
135 : void SetCurrentAddressBlockIndex( sal_Int32 nSet );
136 : sal_Int32 GetCurrentAddressBlockIndex() const;
137 :
138 : bool IsIncludeCountry() const;
139 : OUString& GetExcludeCountry() const;
140 : void SetCountrySettings(bool bSet, const OUString& sCountry);
141 :
142 : bool IsIndividualGreeting(bool bInEMail) const;
143 : void SetIndividualGreeting(bool bSet, bool bInEMail);
144 :
145 : bool IsGreetingLine(bool bInEMail) const;
146 : void SetGreetingLine(bool bSet, bool bInEMail);
147 :
148 : const com::sun::star::uno::Sequence< OUString>
149 : GetGreetings(Gender eType) const;
150 : void SetGreetings(Gender eType, const com::sun::star::uno::Sequence< OUString>& rBlocks);
151 :
152 : sal_Int32 GetCurrentGreeting(Gender eType) const;
153 : void SetCurrentGreeting(Gender eType, sal_Int32 nIndex);
154 :
155 : //the content of the gender column that marks it as female
156 : const OUString& GetFemaleGenderValue() const;
157 : void SetFemaleGenderValue(const OUString& rValue);
158 :
159 : //returns the assignment in the order of the default headers (GetDefaultAddressHeaders())
160 : com::sun::star::uno::Sequence< OUString >
161 : GetColumnAssignment( const SwDBData& rDBData ) const;
162 : void SetColumnAssignment(
163 : const SwDBData& rDBData,
164 : const com::sun::star::uno::Sequence< OUString>& );
165 :
166 : bool IsAddressFieldsAssigned() const;
167 : bool IsGreetingFieldsAssigned() const;
168 :
169 : //e-Mail settings:
170 : OUString GetMailDisplayName() const;
171 : void SetMailDisplayName(const OUString& rName);
172 :
173 : OUString GetMailAddress() const;
174 : void SetMailAddress(const OUString& rAddress);
175 :
176 : bool IsMailReplyTo() const;
177 : void SetMailReplyTo(bool bSet);
178 :
179 : OUString GetMailReplyTo() const;
180 : void SetMailReplyTo(const OUString& rReplyTo);
181 :
182 : OUString GetMailServer() const;
183 : void SetMailServer(const OUString& rAddress);
184 :
185 : sal_Int16 GetMailPort() const;
186 : void SetMailPort(sal_Int16 nSet);
187 :
188 : bool IsSecureConnection() const;
189 : void SetSecureConnection(bool bSet);
190 :
191 : bool IsAuthentication() const;
192 : void SetAuthentication(bool bSet);
193 :
194 : OUString GetMailUserName() const;
195 : void SetMailUserName(const OUString& rName);
196 :
197 : OUString GetMailPassword() const;
198 : void SetMailPassword(const OUString& rPassword);
199 :
200 : bool IsSMTPAfterPOP() const;
201 : void SetSMTPAfterPOP(bool bSet);
202 :
203 : OUString GetInServerName() const;
204 : void SetInServerName(const OUString& rServer);
205 :
206 : sal_Int16 GetInServerPort() const;
207 : void SetInServerPort(sal_Int16 nSet);
208 :
209 : bool IsInServerPOP() const;
210 : void SetInServerPOP(bool bSet);
211 :
212 : OUString GetInServerUserName() const;
213 : void SetInServerUserName(const OUString& rName);
214 :
215 : OUString GetInServerPassword() const;
216 : void SetInServerPassword(const OUString& rPassword);
217 :
218 : //session information
219 0 : bool IsAddressInserted() const { return m_bAddressInserted; }
220 0 : void SetAddressInserted(const OUString& rFrameName)
221 0 : { m_bAddressInserted = true;
222 0 : m_rAddressBlockFrame = rFrameName;
223 0 : }
224 :
225 0 : bool IsGreetingInserted() const { return m_bGreetingInserted; }
226 0 : void SetGreetingInserted()
227 0 : { m_bGreetingInserted = true; }
228 :
229 : // counts the moves in the layout page
230 0 : void MoveGreeting( sal_Int32 nMove) { m_nGreetingMoves += nMove;}
231 0 : sal_Int32 GetGreetingMoves() const { return m_nGreetingMoves;}
232 :
233 0 : bool IsMergeDone() const { return m_bMergeDone;}
234 0 : void SetMergeDone( ) { m_bMergeDone = true; }
235 :
236 : // new source document - reset some flags
237 : void DocumentReloaded();
238 :
239 : bool IsMailAvailable() const;
240 :
241 : // notify a completed merge, provid the appropriate e-Mail address if available
242 : void AddMergedDocument(SwDocMergeInfo& rInfo);
243 : //returns the page and database cursor information of each merged document
244 : SwDocMergeInfo& GetDocumentMergeInfo(sal_uInt32 nDocument);
245 : sal_uInt32 GetMergedDocumentCount() const;
246 :
247 0 : void SetPrintRange( sal_uInt16 nStartDocument, sal_uInt16 nEndDocument)
248 0 : {m_nStartPrint = nStartDocument; m_nEndPrint = nEndDocument;}
249 : sal_uInt16 GetPrintRangeStart() const {return m_nStartPrint;}
250 : sal_uInt16 GetPrintRangeEnd() const {return m_nEndPrint;}
251 :
252 0 : const OUString& GetSelectedPrinter() const {return m_sSelectedPrinter;}
253 0 : void SetSelectedPrinter(const OUString& rSet )
254 0 : {m_sSelectedPrinter = rSet;}
255 :
256 : SwView* GetTargetView();
257 : void SetTargetView(SwView* pView);
258 :
259 : SwView* GetSourceView();
260 : void SetSourceView(SwView* pView);
261 :
262 : //helper methods
263 : OUString GetAssignedColumn(sal_uInt32 nColumn)const;
264 : };
265 :
266 : #endif
267 :
268 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|