1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mmconfigitem.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _MMCONFIGITEM_HXX
31 #define _MMCONFIGITEM_HXX
33 #include <com/sun/star/uno/Sequence.hxx>
34 #include <com/sun/star/uno/Reference.hxx>
35 #include <tools/resary.hxx>
36 #include <swdbdata.hxx>
38 #include "sharedconnection.hxx"
40 namespace com
{namespace sun
{namespace star
{
47 class XColumnsSupplier
;
50 class SwMailMergeConfigItem_Impl
;
53 /*-- 06.04.2004 10:43:35---------------------------------------------------
55 -----------------------------------------------------------------------*/
58 long nStartPageInTarget
;
59 long nEndPageInTarget
;
62 class SW_DLLPUBLIC SwMailMergeConfigItem
64 // com::sun::star::uno::Sequence< ::rtl::OUString> m_aSavedDocuments;
65 SwMailMergeConfigItem_Impl
* m_pImpl
;
66 //session information - not stored in configuration
67 bool m_bAddressInserted
;
69 bool m_bGreetingInserted
;
70 sal_Int32 m_nGreetingMoves
;
71 ::rtl::OUString m_rAddressBlockFrame
;
72 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> m_aSelection
;
77 ::rtl::OUString m_sSelectedPrinter
;
79 SwView
* m_pSourceView
;
80 SwView
* m_pTargetView
;
82 SwMailMergeConfigItem();
83 ~SwMailMergeConfigItem();
94 const ResStringArray
& GetDefaultAddressHeaders() const;
96 void SetCurrentConnection(
97 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
> xSource
,
98 SharedConnection xConnection
,
99 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XColumnsSupplier
> xColumnsSupplier
,
100 const SwDBData
& rDBData
);
102 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
>
105 SharedConnection
GetConnection();
107 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XColumnsSupplier
>
108 GetColumnsSupplier();
110 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XResultSet
>
111 GetResultSet() const;
113 void DisposeResultSet();
115 ::rtl::OUString
& GetFilter() const;
116 void SetFilter(::rtl::OUString
&);
118 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>
120 void SetSelection(::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> rSelection
);
122 void SetCurrentDBData( const SwDBData
& rDBData
);
123 const SwDBData
& GetCurrentDBData() const;
125 // move absolute, nTarget == -1 -> goto last record
126 sal_Int32
MoveResultSet(sal_Int32 nTarget
);
127 sal_Int32
GetResultSetPosition()const;
128 bool IsResultSetFirstLast(bool& bIsFirst
, bool& bIsLast
);
130 bool IsRecordExcluded(sal_Int32 nRecord
);
131 void ExcludeRecord(sal_Int32 nRecord
, bool bExclude
);
133 const com::sun::star::uno::Sequence
< ::rtl::OUString
>&
134 GetSavedDocuments() const;
135 void AddSavedDocument(::rtl::OUString rName
);
137 sal_Bool
IsOutputToLetter()const;
138 void SetOutputToLetter(sal_Bool bSet
);
140 sal_Bool
IsAddressBlock()const;
141 void SetAddressBlock(sal_Bool bSet
);
143 sal_Bool
IsHideEmptyParagraphs() const;
144 void SetHideEmptyParagraphs(sal_Bool bSet
);
146 const com::sun::star::uno::Sequence
< ::rtl::OUString
>
147 GetAddressBlocks() const;
148 void SetAddressBlocks(const com::sun::star::uno::Sequence
< ::rtl::OUString
>& rBlocks
);
150 void SetCurrentAddressBlockIndex( sal_Int32 nSet
);
151 sal_Int32
GetCurrentAddressBlockIndex() const;
153 sal_Bool
IsIncludeCountry() const;
154 rtl::OUString
& GetExcludeCountry() const;
155 void SetCountrySettings(sal_Bool bSet
, const rtl::OUString
& sCountry
);
157 sal_Bool
IsIndividualGreeting(sal_Bool bInEMail
) const;
158 void SetIndividualGreeting(sal_Bool bSet
, sal_Bool bInEMail
);
160 sal_Bool
IsGreetingLine(sal_Bool bInEMail
) const;
161 void SetGreetingLine(sal_Bool bSet
, sal_Bool bInEMail
);
163 const com::sun::star::uno::Sequence
< ::rtl::OUString
>
164 GetGreetings(Gender eType
) const;
165 void SetGreetings(Gender eType
, const com::sun::star::uno::Sequence
< ::rtl::OUString
>& rBlocks
);
167 sal_Int32
GetCurrentGreeting(Gender eType
) const;
168 void SetCurrentGreeting(Gender eType
, sal_Int32 nIndex
);
170 //the content of the gender column that marks it as female
171 const ::rtl::OUString
& GetFemaleGenderValue() const;
172 void SetFemaleGenderValue(const ::rtl::OUString rValue
);
174 //returns the assignment in the order of the default headers (GetDefaultAddressHeaders())
175 com::sun::star::uno::Sequence
< ::rtl::OUString
>
176 GetColumnAssignment( const SwDBData
& rDBData
) const;
177 void SetColumnAssignment(
178 const SwDBData
& rDBData
,
179 const com::sun::star::uno::Sequence
< ::rtl::OUString
>& );
181 bool IsAddressFieldsAssigned() const;
182 bool IsGreetingFieldsAssigned() const;
185 ::rtl::OUString
GetMailDisplayName() const;
186 void SetMailDisplayName(const ::rtl::OUString
& rName
);
188 ::rtl::OUString
GetMailAddress() const;
189 void SetMailAddress(const ::rtl::OUString
& rAddress
);
191 sal_Bool
IsMailReplyTo() const;
192 void SetMailReplyTo(sal_Bool bSet
);
194 ::rtl::OUString
GetMailReplyTo() const;
195 void SetMailReplyTo(const ::rtl::OUString
& rReplyTo
);
197 ::rtl::OUString
GetMailServer() const;
198 void SetMailServer(const ::rtl::OUString
& rAddress
);
200 sal_Int16
GetMailPort() const;
201 void SetMailPort(sal_Int16 nSet
);
203 sal_Bool
IsSecureConnection() const;
204 void SetSecureConnection(sal_Bool bSet
);
206 sal_Bool
IsAuthentication() const;
207 void SetAuthentication(sal_Bool bSet
);
209 ::rtl::OUString
GetMailUserName() const;
210 void SetMailUserName(const ::rtl::OUString
& rName
);
212 ::rtl::OUString
GetMailPassword() const;
213 void SetMailPassword(const ::rtl::OUString
& rPassword
);
215 sal_Bool
IsSMTPAfterPOP() const;
216 void SetSMTPAfterPOP(sal_Bool bSet
);
218 ::rtl::OUString
GetInServerName() const;
219 void SetInServerName(const ::rtl::OUString
& rServer
);
221 sal_Int16
GetInServerPort() const;
222 void SetInServerPort(sal_Int16 nSet
);
224 sal_Bool
IsInServerPOP() const;
225 void SetInServerPOP(sal_Bool bSet
);
227 ::rtl::OUString
GetInServerUserName() const;
228 void SetInServerUserName(const ::rtl::OUString
& rName
);
230 ::rtl::OUString
GetInServerPassword() const;
231 void SetInServerPassword(const ::rtl::OUString
& rPassword
);
233 //session information
234 bool IsAddressInserted() const { return m_bAddressInserted
; }
235 void SetAddressInserted(const ::rtl::OUString
& rFrameName
)
236 { m_bAddressInserted
= true;
237 m_rAddressBlockFrame
= rFrameName
;
240 bool IsGreetingInserted() const { return m_bGreetingInserted
; }
241 void SetGreetingInserted()
242 { m_bGreetingInserted
= true; }
244 // counts the moves in the layout page
245 void MoveGreeting( sal_Int32 nMove
) { m_nGreetingMoves
+= nMove
;}
246 sal_Int32
GetGreetingMoves() const { return m_nGreetingMoves
;}
248 bool IsMergeDone() const { return m_bMergeDone
;}
249 void SetMergeDone( ) { m_bMergeDone
= true; }
251 // new source document - reset some flags
252 void DocumentReloaded();
254 bool IsMailAvailable() const;
256 // notify a completed merge, provid the appropriate e-Mail address if available
257 void AddMergedDocument(SwDocMergeInfo
& rInfo
);
258 //returns the page and database cursor information of each merged document
259 SwDocMergeInfo
& GetDocumentMergeInfo(sal_uInt32 nDocument
);
260 sal_uInt32
GetMergedDocumentCount() const;
262 void SetPrintRange( USHORT nStartDocument
, USHORT nEndDocument
)
263 {m_nStartPrint
= nStartDocument
; m_nEndPrint
= nEndDocument
;}
264 USHORT
GetPrintRangeStart() const {return m_nStartPrint
;}
265 USHORT
GetPrintRangeEnd() const {return m_nEndPrint
;}
267 const ::rtl::OUString
& GetSelectedPrinter() const {return m_sSelectedPrinter
;}
268 void SetSelectedPrinter(const ::rtl::OUString
& rSet
)
269 {m_sSelectedPrinter
= rSet
;}
272 SwView
* GetTargetView();
273 void SetTargetView(SwView
* pView
);
275 SwView
* GetSourceView();
276 void SetSourceView(SwView
* pView
);
279 ::rtl::OUString
GetAssignedColumn(sal_uInt32 nColumn
)const;