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