Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _MMCONFIGITEM_HXX
29 : : #define _MMCONFIGITEM_HXX
30 : :
31 : : #include <com/sun/star/uno/Sequence.hxx>
32 : : #include <com/sun/star/uno/Reference.hxx>
33 : : #include <tools/resary.hxx>
34 : : #include <swdbdata.hxx>
35 : : #include "swdllapi.h"
36 : : #include "sharedconnection.hxx"
37 : :
38 : : namespace com{namespace sun{namespace star{
39 : : namespace sdbc{
40 : : class XDataSource;
41 : : class XResultSet;
42 : : }
43 : : namespace sdbcx{
44 : : class XColumnsSupplier;
45 : : }
46 : : }}}
47 : :
48 : : class SwMailMergeConfigItem_Impl;
49 : : class SwView;
50 : :
51 : : struct SwDocMergeInfo
52 : : {
53 : : long nStartPageInTarget;
54 : : long nEndPageInTarget;
55 : : long nDBRow;
56 : : };
57 : :
58 : : class SW_DLLPUBLIC SwMailMergeConfigItem
59 : : {
60 : : // com::sun::star::uno::Sequence< ::rtl::OUString> m_aSavedDocuments;
61 : : SwMailMergeConfigItem_Impl* m_pImpl;
62 : : //session information - not stored in configuration
63 : : bool m_bAddressInserted;
64 : : bool m_bMergeDone;
65 : : bool m_bGreetingInserted;
66 : : sal_Int32 m_nGreetingMoves;
67 : : ::rtl::OUString m_rAddressBlockFrame;
68 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> m_aSelection;
69 : :
70 : : sal_uInt16 m_nStartPrint;
71 : : sal_uInt16 m_nEndPrint;
72 : :
73 : : ::rtl::OUString m_sSelectedPrinter;
74 : :
75 : : SwView* m_pSourceView;
76 : : SwView* m_pTargetView;
77 : : public:
78 : : SwMailMergeConfigItem();
79 : : ~SwMailMergeConfigItem();
80 : :
81 : : enum Gender
82 : : {
83 : : FEMALE,
84 : : MALE,
85 : : NEUTRAL
86 : : };
87 : :
88 : : void Commit();
89 : :
90 : : const ResStringArray& GetDefaultAddressHeaders() const;
91 : :
92 : : void SetCurrentConnection(
93 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> xSource,
94 : : SharedConnection xConnection,
95 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xColumnsSupplier,
96 : : const SwDBData& rDBData);
97 : :
98 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>
99 : : GetSource();
100 : :
101 : : SharedConnection GetConnection();
102 : :
103 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>
104 : : GetColumnsSupplier();
105 : :
106 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>
107 : : GetResultSet() const;
108 : :
109 : : void DisposeResultSet();
110 : :
111 : : ::rtl::OUString& GetFilter() const;
112 : : void SetFilter(::rtl::OUString&);
113 : :
114 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>
115 : : GetSelection()const;
116 : : void SetSelection(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > rSelection);
117 : :
118 : : void SetCurrentDBData( const SwDBData& rDBData);
119 : : const SwDBData& GetCurrentDBData() const;
120 : :
121 : : // move absolute, nTarget == -1 -> goto last record
122 : : sal_Int32 MoveResultSet(sal_Int32 nTarget);
123 : : sal_Int32 GetResultSetPosition()const;
124 : : bool IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast);
125 : :
126 : : bool IsRecordExcluded(sal_Int32 nRecord);
127 : : void ExcludeRecord(sal_Int32 nRecord, bool bExclude);
128 : :
129 : : const com::sun::star::uno::Sequence< ::rtl::OUString>&
130 : : GetSavedDocuments() const;
131 : : void AddSavedDocument(::rtl::OUString rName);
132 : :
133 : : sal_Bool IsOutputToLetter()const;
134 : : void SetOutputToLetter(sal_Bool bSet);
135 : :
136 : : sal_Bool IsAddressBlock()const;
137 : : void SetAddressBlock(sal_Bool bSet);
138 : :
139 : : sal_Bool IsHideEmptyParagraphs() const;
140 : : void SetHideEmptyParagraphs(sal_Bool bSet);
141 : :
142 : : const com::sun::star::uno::Sequence< ::rtl::OUString>
143 : : GetAddressBlocks() const;
144 : : void SetAddressBlocks(const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks);
145 : :
146 : : void SetCurrentAddressBlockIndex( sal_Int32 nSet );
147 : : sal_Int32 GetCurrentAddressBlockIndex() const;
148 : :
149 : : sal_Bool IsIncludeCountry() const;
150 : : rtl::OUString& GetExcludeCountry() const;
151 : : void SetCountrySettings(sal_Bool bSet, const rtl::OUString& sCountry);
152 : :
153 : : sal_Bool IsIndividualGreeting(sal_Bool bInEMail) const;
154 : : void SetIndividualGreeting(sal_Bool bSet, sal_Bool bInEMail);
155 : :
156 : : sal_Bool IsGreetingLine(sal_Bool bInEMail) const;
157 : : void SetGreetingLine(sal_Bool bSet, sal_Bool bInEMail);
158 : :
159 : : const com::sun::star::uno::Sequence< ::rtl::OUString>
160 : : GetGreetings(Gender eType) const;
161 : : void SetGreetings(Gender eType, const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks);
162 : :
163 : : sal_Int32 GetCurrentGreeting(Gender eType) const;
164 : : void SetCurrentGreeting(Gender eType, sal_Int32 nIndex);
165 : :
166 : : //the content of the gender column that marks it as female
167 : : const ::rtl::OUString& GetFemaleGenderValue() const;
168 : : void SetFemaleGenderValue(const ::rtl::OUString rValue);
169 : :
170 : : //returns the assignment in the order of the default headers (GetDefaultAddressHeaders())
171 : : com::sun::star::uno::Sequence< ::rtl::OUString >
172 : : GetColumnAssignment( const SwDBData& rDBData ) const;
173 : : void SetColumnAssignment(
174 : : const SwDBData& rDBData,
175 : : const com::sun::star::uno::Sequence< ::rtl::OUString>& );
176 : :
177 : : bool IsAddressFieldsAssigned() const;
178 : : bool IsGreetingFieldsAssigned() const;
179 : :
180 : : //e-Mail settings:
181 : : ::rtl::OUString GetMailDisplayName() const;
182 : : void SetMailDisplayName(const ::rtl::OUString& rName);
183 : :
184 : : ::rtl::OUString GetMailAddress() const;
185 : : void SetMailAddress(const ::rtl::OUString& rAddress);
186 : :
187 : : sal_Bool IsMailReplyTo() const;
188 : : void SetMailReplyTo(sal_Bool bSet);
189 : :
190 : : ::rtl::OUString GetMailReplyTo() const;
191 : : void SetMailReplyTo(const ::rtl::OUString& rReplyTo);
192 : :
193 : : ::rtl::OUString GetMailServer() const;
194 : : void SetMailServer(const ::rtl::OUString& rAddress);
195 : :
196 : : sal_Int16 GetMailPort() const;
197 : : void SetMailPort(sal_Int16 nSet);
198 : :
199 : : sal_Bool IsSecureConnection() const;
200 : : void SetSecureConnection(sal_Bool bSet);
201 : :
202 : : sal_Bool IsAuthentication() const;
203 : : void SetAuthentication(sal_Bool bSet);
204 : :
205 : : ::rtl::OUString GetMailUserName() const;
206 : : void SetMailUserName(const ::rtl::OUString& rName);
207 : :
208 : : ::rtl::OUString GetMailPassword() const;
209 : : void SetMailPassword(const ::rtl::OUString& rPassword);
210 : :
211 : : sal_Bool IsSMTPAfterPOP() const;
212 : : void SetSMTPAfterPOP(sal_Bool bSet);
213 : :
214 : : ::rtl::OUString GetInServerName() const;
215 : : void SetInServerName(const ::rtl::OUString& rServer);
216 : :
217 : : sal_Int16 GetInServerPort() const;
218 : : void SetInServerPort(sal_Int16 nSet);
219 : :
220 : : sal_Bool IsInServerPOP() const;
221 : : void SetInServerPOP(sal_Bool bSet);
222 : :
223 : : ::rtl::OUString GetInServerUserName() const;
224 : : void SetInServerUserName(const ::rtl::OUString& rName);
225 : :
226 : : ::rtl::OUString GetInServerPassword() const;
227 : : void SetInServerPassword(const ::rtl::OUString& rPassword);
228 : :
229 : : //session information
230 : 0 : bool IsAddressInserted() const { return m_bAddressInserted; }
231 : 0 : void SetAddressInserted(const ::rtl::OUString& rFrameName)
232 : 0 : { m_bAddressInserted = true;
233 : 0 : m_rAddressBlockFrame = rFrameName;
234 : 0 : }
235 : :
236 : 0 : bool IsGreetingInserted() const { return m_bGreetingInserted; }
237 : 0 : void SetGreetingInserted()
238 : 0 : { m_bGreetingInserted = true; }
239 : :
240 : : // counts the moves in the layout page
241 : 0 : void MoveGreeting( sal_Int32 nMove) { m_nGreetingMoves += nMove;}
242 : 0 : sal_Int32 GetGreetingMoves() const { return m_nGreetingMoves;}
243 : :
244 : 0 : bool IsMergeDone() const { return m_bMergeDone;}
245 : 0 : void SetMergeDone( ) { m_bMergeDone = true; }
246 : :
247 : : // new source document - reset some flags
248 : : void DocumentReloaded();
249 : :
250 : : bool IsMailAvailable() const;
251 : :
252 : : // notify a completed merge, provid the appropriate e-Mail address if available
253 : : void AddMergedDocument(SwDocMergeInfo& rInfo);
254 : : //returns the page and database cursor information of each merged document
255 : : SwDocMergeInfo& GetDocumentMergeInfo(sal_uInt32 nDocument);
256 : : sal_uInt32 GetMergedDocumentCount() const;
257 : :
258 : 0 : void SetPrintRange( sal_uInt16 nStartDocument, sal_uInt16 nEndDocument)
259 : 0 : {m_nStartPrint = nStartDocument; m_nEndPrint = nEndDocument;}
260 : : sal_uInt16 GetPrintRangeStart() const {return m_nStartPrint;}
261 : : sal_uInt16 GetPrintRangeEnd() const {return m_nEndPrint;}
262 : :
263 : 0 : const ::rtl::OUString& GetSelectedPrinter() const {return m_sSelectedPrinter;}
264 : 0 : void SetSelectedPrinter(const ::rtl::OUString& rSet )
265 : 0 : {m_sSelectedPrinter = rSet;}
266 : :
267 : :
268 : : SwView* GetTargetView();
269 : : void SetTargetView(SwView* pView);
270 : :
271 : : SwView* GetSourceView();
272 : : void SetSourceView(SwView* pView);
273 : :
274 : : //helper methods
275 : : ::rtl::OUString GetAssignedColumn(sal_uInt32 nColumn)const;
276 : : };
277 : :
278 : : #endif
279 : :
280 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|