summaryrefslogtreecommitdiff
path: root/sw/source/ui/inc/mmconfigitem.hxx
blob: 5d70bb433ceaa21b768a2d124475f2bc42aa3bc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
#ifndef _MMCONFIGITEM_HXX
#define _MMCONFIGITEM_HXX

#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <tools/resary.hxx>
#include <swdbdata.hxx>
#include "swdllapi.h"
#include "sharedconnection.hxx"

namespace com{namespace sun{namespace star{
    namespace sdbc{
        class XDataSource;
        class XConnection;
        class XResultSet;
    }
    namespace sdbcx{
        class XColumnsSupplier;
    }
}}}
class SwMailMergeConfigItem_Impl;
class SwView;

/*-- 06.04.2004 10:43:35---------------------------------------------------

  -----------------------------------------------------------------------*/
struct SwDocMergeInfo
{
    long    nStartPageInTarget;
    long    nEndPageInTarget;
    long    nDBRow;
};
class SW_DLLPUBLIC SwMailMergeConfigItem
{
//    com::sun::star::uno::Sequence< ::rtl::OUString>     m_aSavedDocuments;
    SwMailMergeConfigItem_Impl*                                 m_pImpl;
    //session information - not stored in configuration
    bool                                                        m_bAddressInserted;
    bool                                                        m_bMergeDone;
    bool                                                        m_bGreetingInserted;
    sal_Int32                                                   m_nGreetingMoves;
    ::rtl::OUString                                             m_rAddressBlockFrame;
    ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> m_aSelection;

    USHORT                                                      m_nStartPrint;
    USHORT                                                      m_nEndPrint;

    ::rtl::OUString                                             m_sSelectedPrinter;

    SwView*                                                     m_pSourceView;
    SwView*                                                     m_pTargetView;
public:
    SwMailMergeConfigItem();
    ~SwMailMergeConfigItem();

    enum Gender
    {
        FEMALE,
        MALE,
        NEUTRAL
    };

    void                Commit();

    const ResStringArray&   GetDefaultAddressHeaders() const;

    void                SetCurrentConnection(
                            ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>          xSource,
                            SharedConnection                                                                xConnection,
                            ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>    xColumnsSupplier,
                            const SwDBData& rDBData);

    ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>
                        GetSource();

    SharedConnection    GetConnection();

    ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>
                        GetColumnsSupplier();
    
    ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>   
                        GetResultSet() const;

    void                DisposeResultSet();

    ::rtl::OUString&    GetFilter() const;
    void                SetFilter(::rtl::OUString&);

    ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>
                        GetSelection()const;
    void                SetSelection(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > rSelection);

    void                SetCurrentDBData( const SwDBData& rDBData);
    const SwDBData&     GetCurrentDBData() const;

    // move absolute, nTarget == -1 -> goto last record
    sal_Int32           MoveResultSet(sal_Int32 nTarget);
    sal_Int32           GetResultSetPosition()const;
    bool                IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast);

    bool                IsRecordExcluded(sal_Int32 nRecord);
    void                ExcludeRecord(sal_Int32 nRecord, bool bExclude);

    const com::sun::star::uno::Sequence< ::rtl::OUString>&
                        GetSavedDocuments() const;
    void                AddSavedDocument(::rtl::OUString rName);

    sal_Bool            IsOutputToLetter()const;
    void                SetOutputToLetter(sal_Bool bSet);

    sal_Bool            IsAddressBlock()const;
    void                SetAddressBlock(sal_Bool bSet);
    
    sal_Bool            IsHideEmptyParagraphs() const;
    void                SetHideEmptyParagraphs(sal_Bool bSet);

    const com::sun::star::uno::Sequence< ::rtl::OUString>   
                        GetAddressBlocks() const;
    void                SetAddressBlocks(const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks);
    
    void                SetCurrentAddressBlockIndex( sal_Int32 nSet );
    sal_Int32           GetCurrentAddressBlockIndex() const;

    sal_Bool            IsIncludeCountry() const;
    rtl::OUString&      GetExcludeCountry() const;
    void                SetCountrySettings(sal_Bool bSet, const rtl::OUString& sCountry);

    sal_Bool            IsIndividualGreeting(sal_Bool bInEMail) const;
    void                SetIndividualGreeting(sal_Bool bSet, sal_Bool bInEMail);

    sal_Bool            IsGreetingLine(sal_Bool bInEMail) const;
    void                SetGreetingLine(sal_Bool bSet, sal_Bool bInEMail);

    const com::sun::star::uno::Sequence< ::rtl::OUString>
                        GetGreetings(Gender eType) const;
    void                SetGreetings(Gender eType, const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks);

    sal_Int32           GetCurrentGreeting(Gender eType) const;
    void                SetCurrentGreeting(Gender eType, sal_Int32 nIndex);

    //the content of the gender column that marks it as female
    const ::rtl::OUString& GetFemaleGenderValue() const;
    void                   SetFemaleGenderValue(const ::rtl::OUString rValue);

    //returns the assignment in the order of the default headers (GetDefaultAddressHeaders())
    com::sun::star::uno::Sequence< ::rtl::OUString >
                        GetColumnAssignment( const SwDBData& rDBData ) const;
    void                SetColumnAssignment(
                            const SwDBData& rDBData,
                            const com::sun::star::uno::Sequence< ::rtl::OUString>& );

    bool                IsAddressFieldsAssigned() const;
    bool                IsGreetingFieldsAssigned() const;

    //e-Mail settings: 
    ::rtl::OUString     GetMailDisplayName() const;
    void                SetMailDisplayName(const ::rtl::OUString& rName);

    ::rtl::OUString     GetMailAddress() const;
    void                SetMailAddress(const ::rtl::OUString& rAddress);

    sal_Bool            IsMailReplyTo() const;
    void                SetMailReplyTo(sal_Bool bSet);

    ::rtl::OUString     GetMailReplyTo() const;
    void                SetMailReplyTo(const ::rtl::OUString& rReplyTo);

    ::rtl::OUString     GetMailServer() const;
    void                SetMailServer(const ::rtl::OUString& rAddress);

    sal_Int16           GetMailPort() const;
    void                SetMailPort(sal_Int16 nSet);

    sal_Bool            IsSecureConnection() const;
    void                SetSecureConnection(sal_Bool bSet);

    sal_Bool            IsAuthentication() const;
    void                SetAuthentication(sal_Bool bSet);

    ::rtl::OUString     GetMailUserName() const;
    void                SetMailUserName(const ::rtl::OUString& rName);

    ::rtl::OUString     GetMailPassword() const;
    void                SetMailPassword(const ::rtl::OUString& rPassword);

    sal_Bool            IsSMTPAfterPOP() const;
    void                SetSMTPAfterPOP(sal_Bool bSet);

    ::rtl::OUString     GetInServerName() const;
    void                SetInServerName(const ::rtl::OUString& rServer);

    sal_Int16           GetInServerPort() const;
    void                SetInServerPort(sal_Int16 nSet);

    sal_Bool            IsInServerPOP() const;
    void                SetInServerPOP(sal_Bool bSet);

    ::rtl::OUString     GetInServerUserName() const;
    void                SetInServerUserName(const ::rtl::OUString& rName);

    ::rtl::OUString     GetInServerPassword() const;
    void                SetInServerPassword(const ::rtl::OUString& rPassword);

    //session information
    bool                IsAddressInserted() const { return m_bAddressInserted; }
    void                SetAddressInserted(const ::rtl::OUString& rFrameName)
                            { m_bAddressInserted = true;
                              m_rAddressBlockFrame = rFrameName;
                            }

    bool                IsGreetingInserted() const { return m_bGreetingInserted; }
    void                SetGreetingInserted()
                            { m_bGreetingInserted = true; }

    // counts the moves in the layout page
    void                MoveGreeting( sal_Int32 nMove) { m_nGreetingMoves += nMove;}
    sal_Int32           GetGreetingMoves() const { return m_nGreetingMoves;}

    bool                IsMergeDone() const { return m_bMergeDone;}
    void                SetMergeDone(  ) { m_bMergeDone = true; }

    // new source document - reset some flags
    void                DocumentReloaded();

    bool                IsMailAvailable() const;

    // notify a completed merge, provid the appropriate e-Mail address if available
    void                AddMergedDocument(SwDocMergeInfo& rInfo);
    //returns the page and database cursor information of each merged document
    SwDocMergeInfo&     GetDocumentMergeInfo(sal_uInt32 nDocument);
    sal_uInt32          GetMergedDocumentCount() const;

    void                SetPrintRange( USHORT nStartDocument, USHORT nEndDocument)
                            {m_nStartPrint = nStartDocument; m_nEndPrint = nEndDocument;}
    USHORT              GetPrintRangeStart() const  {return m_nStartPrint;}
    USHORT              GetPrintRangeEnd() const {return m_nEndPrint;}

    const ::rtl::OUString&  GetSelectedPrinter() const {return m_sSelectedPrinter;}
    void                    SetSelectedPrinter(const ::rtl::OUString& rSet )
                                    {m_sSelectedPrinter = rSet;}


    SwView*             GetTargetView();
    void                SetTargetView(SwView* pView);

    SwView*             GetSourceView();
    void                SetSourceView(SwView* pView);

    //helper methods
    ::rtl::OUString     GetAssignedColumn(sal_uInt32 nColumn)const;
};
#endif