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 _MMCONFIGITEM_HXX
20 : #define _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< ::rtl::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 : ::rtl::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 : ::rtl::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 : ::rtl::OUString& GetFilter() const;
103 : void SetFilter(::rtl::OUString&);
104 :
105 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>
106 : GetSelection()const;
107 : void SetSelection(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > rSelection);
108 :
109 : void SetCurrentDBData( const SwDBData& rDBData);
110 : const SwDBData& GetCurrentDBData() const;
111 :
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);
116 :
117 : bool IsRecordExcluded(sal_Int32 nRecord);
118 : void ExcludeRecord(sal_Int32 nRecord, bool bExclude);
119 :
120 : const com::sun::star::uno::Sequence< ::rtl::OUString>&
121 : GetSavedDocuments() const;
122 : void AddSavedDocument(::rtl::OUString rName);
123 :
124 : sal_Bool IsOutputToLetter()const;
125 : void SetOutputToLetter(sal_Bool bSet);
126 :
127 : sal_Bool IsAddressBlock()const;
128 : void SetAddressBlock(sal_Bool bSet);
129 :
130 : sal_Bool IsHideEmptyParagraphs() const;
131 : void SetHideEmptyParagraphs(sal_Bool bSet);
132 :
133 : const com::sun::star::uno::Sequence< ::rtl::OUString>
134 : GetAddressBlocks() const;
135 : void SetAddressBlocks(const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks);
136 :
137 : void SetCurrentAddressBlockIndex( sal_Int32 nSet );
138 : sal_Int32 GetCurrentAddressBlockIndex() const;
139 :
140 : sal_Bool IsIncludeCountry() const;
141 : rtl::OUString& GetExcludeCountry() const;
142 : void SetCountrySettings(sal_Bool bSet, const rtl::OUString& sCountry);
143 :
144 : sal_Bool IsIndividualGreeting(sal_Bool bInEMail) const;
145 : void SetIndividualGreeting(sal_Bool bSet, sal_Bool bInEMail);
146 :
147 : sal_Bool IsGreetingLine(sal_Bool bInEMail) const;
148 : void SetGreetingLine(sal_Bool bSet, sal_Bool bInEMail);
149 :
150 : const com::sun::star::uno::Sequence< ::rtl::OUString>
151 : GetGreetings(Gender eType) const;
152 : void SetGreetings(Gender eType, const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks);
153 :
154 : sal_Int32 GetCurrentGreeting(Gender eType) const;
155 : void SetCurrentGreeting(Gender eType, sal_Int32 nIndex);
156 :
157 : //the content of the gender column that marks it as female
158 : const ::rtl::OUString& GetFemaleGenderValue() const;
159 : void SetFemaleGenderValue(const ::rtl::OUString rValue);
160 :
161 : //returns the assignment in the order of the default headers (GetDefaultAddressHeaders())
162 : com::sun::star::uno::Sequence< ::rtl::OUString >
163 : GetColumnAssignment( const SwDBData& rDBData ) const;
164 : void SetColumnAssignment(
165 : const SwDBData& rDBData,
166 : const com::sun::star::uno::Sequence< ::rtl::OUString>& );
167 :
168 : bool IsAddressFieldsAssigned() const;
169 : bool IsGreetingFieldsAssigned() const;
170 :
171 : //e-Mail settings:
172 : ::rtl::OUString GetMailDisplayName() const;
173 : void SetMailDisplayName(const ::rtl::OUString& rName);
174 :
175 : ::rtl::OUString GetMailAddress() const;
176 : void SetMailAddress(const ::rtl::OUString& rAddress);
177 :
178 : sal_Bool IsMailReplyTo() const;
179 : void SetMailReplyTo(sal_Bool bSet);
180 :
181 : ::rtl::OUString GetMailReplyTo() const;
182 : void SetMailReplyTo(const ::rtl::OUString& rReplyTo);
183 :
184 : ::rtl::OUString GetMailServer() const;
185 : void SetMailServer(const ::rtl::OUString& rAddress);
186 :
187 : sal_Int16 GetMailPort() const;
188 : void SetMailPort(sal_Int16 nSet);
189 :
190 : sal_Bool IsSecureConnection() const;
191 : void SetSecureConnection(sal_Bool bSet);
192 :
193 : sal_Bool IsAuthentication() const;
194 : void SetAuthentication(sal_Bool bSet);
195 :
196 : ::rtl::OUString GetMailUserName() const;
197 : void SetMailUserName(const ::rtl::OUString& rName);
198 :
199 : ::rtl::OUString GetMailPassword() const;
200 : void SetMailPassword(const ::rtl::OUString& rPassword);
201 :
202 : sal_Bool IsSMTPAfterPOP() const;
203 : void SetSMTPAfterPOP(sal_Bool bSet);
204 :
205 : ::rtl::OUString GetInServerName() const;
206 : void SetInServerName(const ::rtl::OUString& rServer);
207 :
208 : sal_Int16 GetInServerPort() const;
209 : void SetInServerPort(sal_Int16 nSet);
210 :
211 : sal_Bool IsInServerPOP() const;
212 : void SetInServerPOP(sal_Bool bSet);
213 :
214 : ::rtl::OUString GetInServerUserName() const;
215 : void SetInServerUserName(const ::rtl::OUString& rName);
216 :
217 : ::rtl::OUString GetInServerPassword() const;
218 : void SetInServerPassword(const ::rtl::OUString& rPassword);
219 :
220 : //session information
221 0 : bool IsAddressInserted() const { return m_bAddressInserted; }
222 0 : void SetAddressInserted(const ::rtl::OUString& rFrameName)
223 0 : { m_bAddressInserted = true;
224 0 : m_rAddressBlockFrame = rFrameName;
225 0 : }
226 :
227 0 : bool IsGreetingInserted() const { return m_bGreetingInserted; }
228 0 : void SetGreetingInserted()
229 0 : { m_bGreetingInserted = true; }
230 :
231 : // counts the moves in the layout page
232 0 : void MoveGreeting( sal_Int32 nMove) { m_nGreetingMoves += nMove;}
233 0 : sal_Int32 GetGreetingMoves() const { return m_nGreetingMoves;}
234 :
235 0 : bool IsMergeDone() const { return m_bMergeDone;}
236 0 : void SetMergeDone( ) { m_bMergeDone = true; }
237 :
238 : // new source document - reset some flags
239 : void DocumentReloaded();
240 :
241 : bool IsMailAvailable() const;
242 :
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;
248 :
249 0 : void SetPrintRange( sal_uInt16 nStartDocument, sal_uInt16 nEndDocument)
250 0 : {m_nStartPrint = nStartDocument; m_nEndPrint = nEndDocument;}
251 : sal_uInt16 GetPrintRangeStart() const {return m_nStartPrint;}
252 : sal_uInt16 GetPrintRangeEnd() const {return m_nEndPrint;}
253 :
254 0 : const ::rtl::OUString& GetSelectedPrinter() const {return m_sSelectedPrinter;}
255 0 : void SetSelectedPrinter(const ::rtl::OUString& rSet )
256 0 : {m_sSelectedPrinter = rSet;}
257 :
258 :
259 : SwView* GetTargetView();
260 : void SetTargetView(SwView* pView);
261 :
262 : SwView* GetSourceView();
263 : void SetSourceView(SwView* pView);
264 :
265 : //helper methods
266 : ::rtl::OUString GetAssignedColumn(sal_uInt32 nColumn)const;
267 : };
268 :
269 : #endif
270 :
271 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|