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