xref: /AOO41X/main/sw/source/ui/dbui/mailmergehelper.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sw.hxx"
30*cdf0e10cSrcweir #include <swtypes.hxx>
31*cdf0e10cSrcweir #include <mailmergehelper.hxx>
32*cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
33*cdf0e10cSrcweir #include <mmconfigitem.hxx>
34*cdf0e10cSrcweir #ifndef _DOCSH_HXX
35*cdf0e10cSrcweir #include <docsh.hxx>
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx>
38*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
39*cdf0e10cSrcweir #include <sfx2/app.hxx>
40*cdf0e10cSrcweir #include <sfx2/fcontnr.hxx>
41*cdf0e10cSrcweir #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/sdb/XColumn.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
44*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
45*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
46*cdf0e10cSrcweir #include "com/sun/star/mail/MailServiceProvider.hpp"
47*cdf0e10cSrcweir #include "com/sun/star/mail/XSmtpService.hpp"
48*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
49*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
50*cdf0e10cSrcweir #ifndef _PASSWD_HXX
51*cdf0e10cSrcweir #include <sfx2/passwd.hxx>
52*cdf0e10cSrcweir #endif
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir #include <dbui.hrc>
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir using namespace ::com::sun::star;
57*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
58*cdf0e10cSrcweir using namespace ::com::sun::star::container;
59*cdf0e10cSrcweir using namespace ::com::sun::star::sdb;
60*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
61*cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx;
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir using rtl::OUString;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir //using ::rtl::OUString;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir namespace SwMailMergeHelper
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir /*-- 14.06.2004 12:29:19---------------------------------------------------
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
73*cdf0e10cSrcweir String  CallSaveAsDialog(String& rFilter)
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir     ErrCode nRet;
76*cdf0e10cSrcweir     String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName()));
77*cdf0e10cSrcweir     ::sfx2::FileDialogHelper aDialog( ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
78*cdf0e10cSrcweir                 0,
79*cdf0e10cSrcweir                 sFactory );
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir     String sRet;
82*cdf0e10cSrcweir     nRet = aDialog.Execute();
83*cdf0e10cSrcweir     if(ERRCODE_NONE == nRet)
84*cdf0e10cSrcweir     {
85*cdf0e10cSrcweir         uno::Reference < ui::dialogs::XFilePicker > xFP = aDialog.GetFilePicker();
86*cdf0e10cSrcweir         sRet = xFP->getFiles().getConstArray()[0];
87*cdf0e10cSrcweir         rFilter = aDialog.GetRealFilter();
88*cdf0e10cSrcweir     }
89*cdf0e10cSrcweir     return sRet;
90*cdf0e10cSrcweir }
91*cdf0e10cSrcweir /*-- 20.08.2004 09:39:18---------------------------------------------------
92*cdf0e10cSrcweir     simple address check: check for '@'
93*cdf0e10cSrcweir                             for at least one '.' after the '@'
94*cdf0e10cSrcweir                             and for at least to characters before and after the dot
95*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
96*cdf0e10cSrcweir bool CheckMailAddress( const ::rtl::OUString& rMailAddress )
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir     String sAddress(rMailAddress);
99*cdf0e10cSrcweir     if(!(sAddress.GetTokenCount('@') == 2))
100*cdf0e10cSrcweir         return false;
101*cdf0e10cSrcweir     sAddress = sAddress.GetToken(1, '@');
102*cdf0e10cSrcweir     if(sAddress.GetTokenCount('.') < 2)
103*cdf0e10cSrcweir         return false;
104*cdf0e10cSrcweir     if(sAddress.GetToken( 0, '.').Len() < 2 || sAddress.GetToken( 1, '.').Len() < 2)
105*cdf0e10cSrcweir         return false;
106*cdf0e10cSrcweir     return true;
107*cdf0e10cSrcweir }
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir /*-- 28.12.2004 10:16:02---------------------------------------------------
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
112*cdf0e10cSrcweir uno::Reference< mail::XSmtpService > ConnectToSmtpServer(
113*cdf0e10cSrcweir         SwMailMergeConfigItem& rConfigItem,
114*cdf0e10cSrcweir         uno::Reference< mail::XMailService >&  rxInMailService,
115*cdf0e10cSrcweir         const String& rInMailServerPassword,
116*cdf0e10cSrcweir         const String& rOutMailServerPassword,
117*cdf0e10cSrcweir         Window* pDialogParentWindow )
118*cdf0e10cSrcweir {
119*cdf0e10cSrcweir     uno::Reference< mail::XSmtpService > xSmtpServer;
120*cdf0e10cSrcweir     uno::Reference< lang::XMultiServiceFactory> rMgr = ::comphelper::getProcessServiceFactory();
121*cdf0e10cSrcweir     if (rMgr.is())
122*cdf0e10cSrcweir         try
123*cdf0e10cSrcweir         {
124*cdf0e10cSrcweir             uno::Reference< mail::XMailServiceProvider > xMailServiceProvider =
125*cdf0e10cSrcweir                     mail::MailServiceProvider::create(getCurrentCmpCtx(rMgr));
126*cdf0e10cSrcweir             xSmtpServer = uno::Reference< mail::XSmtpService > (
127*cdf0e10cSrcweir                             xMailServiceProvider->create(
128*cdf0e10cSrcweir                             mail::MailServiceType_SMTP
129*cdf0e10cSrcweir                             ), uno::UNO_QUERY);
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir             uno::Reference< mail::XConnectionListener> xConnectionListener(new SwConnectionListener());
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir             if(rConfigItem.IsAuthentication() && rConfigItem.IsSMTPAfterPOP())
134*cdf0e10cSrcweir             {
135*cdf0e10cSrcweir                 uno::Reference< mail::XMailService > xInMailService =
136*cdf0e10cSrcweir                         xMailServiceProvider->create(
137*cdf0e10cSrcweir                         rConfigItem.IsInServerPOP() ?
138*cdf0e10cSrcweir                             mail::MailServiceType_POP3 : mail::MailServiceType_IMAP);
139*cdf0e10cSrcweir                 //authenticate at the POP or IMAP server first
140*cdf0e10cSrcweir                 String sPasswd = rConfigItem.GetInServerPassword();
141*cdf0e10cSrcweir 		if(rInMailServerPassword.Len())
142*cdf0e10cSrcweir 			sPasswd = rInMailServerPassword;
143*cdf0e10cSrcweir 		uno::Reference<mail::XAuthenticator> xAuthenticator =
144*cdf0e10cSrcweir                     new SwAuthenticator(
145*cdf0e10cSrcweir                         rConfigItem.GetInServerUserName(),
146*cdf0e10cSrcweir                         sPasswd,
147*cdf0e10cSrcweir                         pDialogParentWindow);
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir                 xInMailService->addConnectionListener(xConnectionListener);
150*cdf0e10cSrcweir                 //check connection
151*cdf0e10cSrcweir                 uno::Reference< uno::XCurrentContext> xConnectionContext =
152*cdf0e10cSrcweir                         new SwConnectionContext(
153*cdf0e10cSrcweir                             rConfigItem.GetInServerName(),
154*cdf0e10cSrcweir                             rConfigItem.GetInServerPort(),
155*cdf0e10cSrcweir                             ::rtl::OUString::createFromAscii( "Insecure" ));
156*cdf0e10cSrcweir                 xInMailService->connect(xConnectionContext, xAuthenticator);
157*cdf0e10cSrcweir                 rxInMailService = xInMailService;
158*cdf0e10cSrcweir             }
159*cdf0e10cSrcweir             uno::Reference< mail::XAuthenticator> xAuthenticator;
160*cdf0e10cSrcweir             if(rConfigItem.IsAuthentication() &&
161*cdf0e10cSrcweir                     !rConfigItem.IsSMTPAfterPOP() &&
162*cdf0e10cSrcweir                     rConfigItem.GetMailUserName().getLength())
163*cdf0e10cSrcweir             {
164*cdf0e10cSrcweir                 String sPasswd = rConfigItem.GetMailPassword();
165*cdf0e10cSrcweir                 if(rOutMailServerPassword.Len())
166*cdf0e10cSrcweir                     sPasswd = rOutMailServerPassword;
167*cdf0e10cSrcweir                 xAuthenticator =
168*cdf0e10cSrcweir                     new SwAuthenticator(rConfigItem.GetMailUserName(),
169*cdf0e10cSrcweir                             sPasswd,
170*cdf0e10cSrcweir                             pDialogParentWindow);
171*cdf0e10cSrcweir             }
172*cdf0e10cSrcweir             else
173*cdf0e10cSrcweir                 xAuthenticator =  new SwAuthenticator();
174*cdf0e10cSrcweir             //just to check if the server exists
175*cdf0e10cSrcweir             xSmtpServer->getSupportedConnectionTypes();
176*cdf0e10cSrcweir             //check connection
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir             uno::Reference< uno::XCurrentContext> xConnectionContext =
179*cdf0e10cSrcweir                     new SwConnectionContext(
180*cdf0e10cSrcweir                         rConfigItem.GetMailServer(),
181*cdf0e10cSrcweir                         rConfigItem.GetMailPort(),
182*cdf0e10cSrcweir                         ::rtl::OUString::createFromAscii( rConfigItem.IsSecureConnection() ? "Ssl" : "Insecure"));
183*cdf0e10cSrcweir             xSmtpServer->connect(xConnectionContext, xAuthenticator);
184*cdf0e10cSrcweir             rxInMailService = uno::Reference< mail::XMailService >( xSmtpServer, uno::UNO_QUERY );
185*cdf0e10cSrcweir         }
186*cdf0e10cSrcweir         catch(uno::Exception& )
187*cdf0e10cSrcweir         {
188*cdf0e10cSrcweir             DBG_ERROR("exception caught");
189*cdf0e10cSrcweir         }
190*cdf0e10cSrcweir     return xSmtpServer;
191*cdf0e10cSrcweir }
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir } //namespace
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir /*-- 06.04.2004 10:31:27---------------------------------------------------
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
199*cdf0e10cSrcweir SwBoldFixedInfo::SwBoldFixedInfo(Window* pParent, const ResId& rResId) :
200*cdf0e10cSrcweir     FixedInfo(pParent, rResId)
201*cdf0e10cSrcweir {
202*cdf0e10cSrcweir     Font aFont = GetFont();
203*cdf0e10cSrcweir     aFont.SetWeight( WEIGHT_BOLD );
204*cdf0e10cSrcweir     SetFont( aFont );
205*cdf0e10cSrcweir }
206*cdf0e10cSrcweir /*-- 06.04.2004 10:31:27---------------------------------------------------
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
209*cdf0e10cSrcweir SwBoldFixedInfo::~SwBoldFixedInfo()
210*cdf0e10cSrcweir {
211*cdf0e10cSrcweir }
212*cdf0e10cSrcweir struct  SwAddressPreview_Impl
213*cdf0e10cSrcweir {
214*cdf0e10cSrcweir     ::std::vector< ::rtl::OUString >    aAdresses;
215*cdf0e10cSrcweir     sal_uInt16                          nRows;
216*cdf0e10cSrcweir     sal_uInt16                          nColumns;
217*cdf0e10cSrcweir     sal_uInt16                          nSelectedAddress;
218*cdf0e10cSrcweir     bool                                bEnableScrollBar;
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir     SwAddressPreview_Impl() :
221*cdf0e10cSrcweir         nRows(1),
222*cdf0e10cSrcweir         nColumns(1),
223*cdf0e10cSrcweir         nSelectedAddress(0),
224*cdf0e10cSrcweir         bEnableScrollBar(false)
225*cdf0e10cSrcweir     {
226*cdf0e10cSrcweir     }
227*cdf0e10cSrcweir };
228*cdf0e10cSrcweir /*-- 27.04.2004 14:01:22---------------------------------------------------
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
231*cdf0e10cSrcweir SwAddressPreview::SwAddressPreview(Window* pParent, const ResId rResId) :
232*cdf0e10cSrcweir     Window( pParent, rResId ),
233*cdf0e10cSrcweir     aVScrollBar(this, WB_VSCROLL),
234*cdf0e10cSrcweir     pImpl(new SwAddressPreview_Impl())
235*cdf0e10cSrcweir {
236*cdf0e10cSrcweir     aVScrollBar.SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl));
237*cdf0e10cSrcweir     Size aSize(GetOutputSizePixel());
238*cdf0e10cSrcweir     Size aScrollSize(aVScrollBar.GetSizePixel());
239*cdf0e10cSrcweir     aScrollSize.Height() = aSize.Height();
240*cdf0e10cSrcweir     aVScrollBar.SetSizePixel(aScrollSize);
241*cdf0e10cSrcweir     Point aSrollPos(aSize.Width() - aScrollSize.Width(), 0);
242*cdf0e10cSrcweir     aVScrollBar.SetPosPixel(aSrollPos);
243*cdf0e10cSrcweir     Show();
244*cdf0e10cSrcweir }
245*cdf0e10cSrcweir /*-- 27.04.2004 14:01:22---------------------------------------------------
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
248*cdf0e10cSrcweir SwAddressPreview::~SwAddressPreview()
249*cdf0e10cSrcweir {
250*cdf0e10cSrcweir }
251*cdf0e10cSrcweir /*-- 25.06.2004 11:50:55---------------------------------------------------
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
254*cdf0e10cSrcweir IMPL_LINK(SwAddressPreview, ScrollHdl, ScrollBar*, EMPTYARG)
255*cdf0e10cSrcweir {
256*cdf0e10cSrcweir     Invalidate();
257*cdf0e10cSrcweir     return 0;
258*cdf0e10cSrcweir }
259*cdf0e10cSrcweir /*-- 27.04.2004 14:01:22---------------------------------------------------
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
262*cdf0e10cSrcweir void SwAddressPreview::AddAddress(const ::rtl::OUString& rAddress)
263*cdf0e10cSrcweir {
264*cdf0e10cSrcweir     pImpl->aAdresses.push_back(rAddress);
265*cdf0e10cSrcweir     UpdateScrollBar();
266*cdf0e10cSrcweir }
267*cdf0e10cSrcweir /*-- 27.04.2004 14:01:23---------------------------------------------------
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
270*cdf0e10cSrcweir void SwAddressPreview::SetAddress(const ::rtl::OUString& rAddress)
271*cdf0e10cSrcweir {
272*cdf0e10cSrcweir     pImpl->aAdresses.clear();
273*cdf0e10cSrcweir     pImpl->aAdresses.push_back(rAddress);
274*cdf0e10cSrcweir     aVScrollBar.Show(sal_False);
275*cdf0e10cSrcweir     Invalidate();
276*cdf0e10cSrcweir }
277*cdf0e10cSrcweir /*-- 27.04.2004 14:01:23---------------------------------------------------
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
280*cdf0e10cSrcweir sal_uInt16   SwAddressPreview::GetSelectedAddress()const
281*cdf0e10cSrcweir {
282*cdf0e10cSrcweir     DBG_ASSERT(pImpl->nSelectedAddress < pImpl->aAdresses.size(), "selection invalid");
283*cdf0e10cSrcweir     return pImpl->nSelectedAddress;
284*cdf0e10cSrcweir }
285*cdf0e10cSrcweir /*-- 25.06.2004 10:32:48---------------------------------------------------
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
288*cdf0e10cSrcweir void SwAddressPreview::SelectAddress(sal_uInt16 nSelect)
289*cdf0e10cSrcweir {
290*cdf0e10cSrcweir     DBG_ASSERT(pImpl->nSelectedAddress < pImpl->aAdresses.size(), "selection invalid");
291*cdf0e10cSrcweir     pImpl->nSelectedAddress = nSelect;
292*cdf0e10cSrcweir     // now make it visible..
293*cdf0e10cSrcweir     sal_uInt16 nSelectRow = nSelect / pImpl->nColumns;
294*cdf0e10cSrcweir     sal_uInt16 nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos();
295*cdf0e10cSrcweir     if( (nSelectRow < nStartRow) || (nSelectRow >= (nStartRow + pImpl->nRows) ))
296*cdf0e10cSrcweir         aVScrollBar.SetThumbPos( nSelectRow );
297*cdf0e10cSrcweir }
298*cdf0e10cSrcweir /*-- 25.06.2004 11:00:40---------------------------------------------------
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
301*cdf0e10cSrcweir void SwAddressPreview::Clear()
302*cdf0e10cSrcweir {
303*cdf0e10cSrcweir     pImpl->aAdresses.clear();
304*cdf0e10cSrcweir     pImpl->nSelectedAddress = 0;
305*cdf0e10cSrcweir     UpdateScrollBar();
306*cdf0e10cSrcweir }
307*cdf0e10cSrcweir /*-- 28.04.2004 12:05:50---------------------------------------------------
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
310*cdf0e10cSrcweir void SwAddressPreview::ReplaceSelectedAddress(const ::rtl::OUString& rNew)
311*cdf0e10cSrcweir {
312*cdf0e10cSrcweir     pImpl->aAdresses[pImpl->nSelectedAddress] = rNew;
313*cdf0e10cSrcweir     Invalidate();
314*cdf0e10cSrcweir }
315*cdf0e10cSrcweir /*-- 25.06.2004 11:30:41---------------------------------------------------
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
318*cdf0e10cSrcweir void SwAddressPreview::RemoveSelectedAddress()
319*cdf0e10cSrcweir {
320*cdf0e10cSrcweir     pImpl->aAdresses.erase(pImpl->aAdresses.begin() + pImpl->nSelectedAddress);
321*cdf0e10cSrcweir     if(pImpl->nSelectedAddress)
322*cdf0e10cSrcweir         --pImpl->nSelectedAddress;
323*cdf0e10cSrcweir     UpdateScrollBar();
324*cdf0e10cSrcweir     Invalidate();
325*cdf0e10cSrcweir }
326*cdf0e10cSrcweir /*-- 27.04.2004 14:01:23---------------------------------------------------
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
329*cdf0e10cSrcweir void SwAddressPreview::SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns)
330*cdf0e10cSrcweir {
331*cdf0e10cSrcweir     pImpl->nRows = nRows;
332*cdf0e10cSrcweir     pImpl->nColumns = nColumns;
333*cdf0e10cSrcweir     UpdateScrollBar();
334*cdf0e10cSrcweir }
335*cdf0e10cSrcweir /*-- 25.06.2004 13:54:03---------------------------------------------------
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
338*cdf0e10cSrcweir void SwAddressPreview::EnableScrollBar(bool bEnable)
339*cdf0e10cSrcweir {
340*cdf0e10cSrcweir     pImpl->bEnableScrollBar = bEnable;
341*cdf0e10cSrcweir }
342*cdf0e10cSrcweir /*-- 25.06.2004 11:55:52---------------------------------------------------
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
345*cdf0e10cSrcweir void SwAddressPreview::UpdateScrollBar()
346*cdf0e10cSrcweir {
347*cdf0e10cSrcweir     if(pImpl->nColumns)
348*cdf0e10cSrcweir     {
349*cdf0e10cSrcweir         aVScrollBar.SetVisibleSize(pImpl->nRows);
350*cdf0e10cSrcweir         sal_uInt16 nResultingRows = (sal_uInt16)(pImpl->aAdresses.size() + pImpl->nColumns - 1) / pImpl->nColumns;
351*cdf0e10cSrcweir         ++nResultingRows;
352*cdf0e10cSrcweir         aVScrollBar.Show(pImpl->bEnableScrollBar && nResultingRows > pImpl->nRows);
353*cdf0e10cSrcweir         aVScrollBar.SetRange(Range(0, nResultingRows));
354*cdf0e10cSrcweir         if(aVScrollBar.GetThumbPos() > nResultingRows)
355*cdf0e10cSrcweir             aVScrollBar.SetThumbPos(nResultingRows);
356*cdf0e10cSrcweir     }
357*cdf0e10cSrcweir }
358*cdf0e10cSrcweir /*-- 27.04.2004 14:01:23---------------------------------------------------
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
361*cdf0e10cSrcweir void SwAddressPreview::Paint(const Rectangle&)
362*cdf0e10cSrcweir {
363*cdf0e10cSrcweir     const StyleSettings& rSettings = GetSettings().GetStyleSettings();
364*cdf0e10cSrcweir     SetFillColor(rSettings.GetWindowColor());
365*cdf0e10cSrcweir     SetLineColor( Color(COL_TRANSPARENT) );
366*cdf0e10cSrcweir     DrawRect( Rectangle(Point(0, 0), GetOutputSizePixel()) );
367*cdf0e10cSrcweir     Color aPaintColor(IsEnabled() ? rSettings.GetWindowTextColor() : rSettings.GetDisableColor());
368*cdf0e10cSrcweir     SetLineColor(aPaintColor);
369*cdf0e10cSrcweir     Font aFont(GetFont());
370*cdf0e10cSrcweir     aFont.SetColor(aPaintColor);
371*cdf0e10cSrcweir     SetFont(aFont);
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir     Size aSize = GetOutputSizePixel();
374*cdf0e10cSrcweir     sal_uInt16 nStartRow = 0;
375*cdf0e10cSrcweir     if(aVScrollBar.IsVisible())
376*cdf0e10cSrcweir     {
377*cdf0e10cSrcweir         aSize.Width() -= aVScrollBar.GetSizePixel().Width();
378*cdf0e10cSrcweir         nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos();
379*cdf0e10cSrcweir     }
380*cdf0e10cSrcweir     Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows );
381*cdf0e10cSrcweir 	aPartSize.Width() -= 2;
382*cdf0e10cSrcweir 	aPartSize.Height() -= 2;
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir     sal_uInt16 nAddress = nStartRow * pImpl->nColumns;
385*cdf0e10cSrcweir     const sal_uInt16 nNumAddresses = static_cast< sal_uInt16 >(pImpl->aAdresses.size());
386*cdf0e10cSrcweir     for(sal_uInt16 nRow = 0; nRow < pImpl->nRows ; ++nRow)
387*cdf0e10cSrcweir     {
388*cdf0e10cSrcweir         for(sal_uInt16 nCol = 0; nCol < pImpl->nColumns; ++nCol)
389*cdf0e10cSrcweir         {
390*cdf0e10cSrcweir             if(nAddress >= nNumAddresses)
391*cdf0e10cSrcweir                 break;
392*cdf0e10cSrcweir             Point aPos(nCol * aPartSize.Width(), (nRow) * aPartSize.Height());
393*cdf0e10cSrcweir 			aPos.Move(1,1);
394*cdf0e10cSrcweir 			bool bIsSelected = nAddress == pImpl->nSelectedAddress;
395*cdf0e10cSrcweir 			if((pImpl->nColumns * pImpl->nRows) == 1)
396*cdf0e10cSrcweir 				bIsSelected = false;
397*cdf0e10cSrcweir 			::rtl::OUString adr(pImpl->aAdresses[nAddress]);
398*cdf0e10cSrcweir             DrawText_Impl(adr,aPos,aPartSize,bIsSelected);
399*cdf0e10cSrcweir             ++nAddress;
400*cdf0e10cSrcweir         }
401*cdf0e10cSrcweir     }
402*cdf0e10cSrcweir     SetClipRegion();
403*cdf0e10cSrcweir }
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir /*-- 07.06.2004 15:44:15---------------------------------------------------
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
408*cdf0e10cSrcweir void  SwAddressPreview::MouseButtonDown( const MouseEvent& rMEvt )
409*cdf0e10cSrcweir {
410*cdf0e10cSrcweir     Window::MouseButtonDown(rMEvt);
411*cdf0e10cSrcweir     if(rMEvt.IsLeft() && ( pImpl->nRows || pImpl->nColumns))
412*cdf0e10cSrcweir     {
413*cdf0e10cSrcweir         //determine the selected address
414*cdf0e10cSrcweir         const Point& rMousePos = rMEvt.GetPosPixel();
415*cdf0e10cSrcweir         Size aSize(GetOutputSizePixel());
416*cdf0e10cSrcweir         Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows );
417*cdf0e10cSrcweir         sal_uInt32 nRow = rMousePos.Y() / aPartSize.Height() ;
418*cdf0e10cSrcweir         if(aVScrollBar.IsVisible())
419*cdf0e10cSrcweir         {
420*cdf0e10cSrcweir             nRow += (sal_uInt16)aVScrollBar.GetThumbPos();
421*cdf0e10cSrcweir         }
422*cdf0e10cSrcweir         sal_uInt32 nCol = rMousePos.X() / aPartSize.Width();
423*cdf0e10cSrcweir         sal_uInt32 nSelect = nRow * pImpl->nColumns + nCol;
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir         if( nSelect < pImpl->aAdresses.size() &&
426*cdf0e10cSrcweir                 pImpl->nSelectedAddress != (sal_uInt16)nSelect)
427*cdf0e10cSrcweir         {
428*cdf0e10cSrcweir             pImpl->nSelectedAddress = (sal_uInt16)nSelect;
429*cdf0e10cSrcweir             m_aSelectHdl.Call(this);
430*cdf0e10cSrcweir         }
431*cdf0e10cSrcweir         Invalidate();
432*cdf0e10cSrcweir     }
433*cdf0e10cSrcweir }
434*cdf0e10cSrcweir /*-- 01.07.2004 12:33:59---------------------------------------------------
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
437*cdf0e10cSrcweir void  SwAddressPreview::KeyInput( const KeyEvent& rKEvt )
438*cdf0e10cSrcweir {
439*cdf0e10cSrcweir     sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
440*cdf0e10cSrcweir     if(pImpl->nRows || pImpl->nColumns)
441*cdf0e10cSrcweir     {
442*cdf0e10cSrcweir         sal_uInt32 nSelectedRow =    (pImpl->nSelectedAddress + 1)/ pImpl->nColumns;
443*cdf0e10cSrcweir         sal_uInt32 nSelectedColumn = pImpl->nSelectedAddress % nSelectedRow;
444*cdf0e10cSrcweir         switch(nKey)
445*cdf0e10cSrcweir         {
446*cdf0e10cSrcweir             case KEY_UP:
447*cdf0e10cSrcweir                 if(nSelectedRow)
448*cdf0e10cSrcweir                     --nSelectedRow;
449*cdf0e10cSrcweir             break;
450*cdf0e10cSrcweir             case KEY_DOWN:
451*cdf0e10cSrcweir                 if(pImpl->aAdresses.size() > sal_uInt32(pImpl->nSelectedAddress + pImpl->nColumns))
452*cdf0e10cSrcweir                     ++nSelectedRow;
453*cdf0e10cSrcweir             break;
454*cdf0e10cSrcweir             case KEY_LEFT:
455*cdf0e10cSrcweir                 if(nSelectedColumn)
456*cdf0e10cSrcweir                     --nSelectedColumn;
457*cdf0e10cSrcweir             break;
458*cdf0e10cSrcweir             case KEY_RIGHT:
459*cdf0e10cSrcweir                 if(nSelectedColumn < sal_uInt32(pImpl->nColumns - 1) &&
460*cdf0e10cSrcweir                        pImpl->aAdresses.size() - 1 > pImpl->nSelectedAddress )
461*cdf0e10cSrcweir                     ++nSelectedColumn;
462*cdf0e10cSrcweir             break;
463*cdf0e10cSrcweir         }
464*cdf0e10cSrcweir         sal_uInt32 nSelect = nSelectedRow * pImpl->nColumns + nSelectedColumn;
465*cdf0e10cSrcweir         if( nSelect < pImpl->aAdresses.size() &&
466*cdf0e10cSrcweir                 pImpl->nSelectedAddress != (sal_uInt16)nSelect)
467*cdf0e10cSrcweir         {
468*cdf0e10cSrcweir             pImpl->nSelectedAddress = (sal_uInt16)nSelect;
469*cdf0e10cSrcweir             m_aSelectHdl.Call(this);
470*cdf0e10cSrcweir             Invalidate();
471*cdf0e10cSrcweir         }
472*cdf0e10cSrcweir     }
473*cdf0e10cSrcweir     else
474*cdf0e10cSrcweir         Window::KeyInput(rKEvt);
475*cdf0e10cSrcweir }
476*cdf0e10cSrcweir /*-- 05.07.2004 12:02:28---------------------------------------------------
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
479*cdf0e10cSrcweir void SwAddressPreview::StateChanged( StateChangedType nStateChange )
480*cdf0e10cSrcweir {
481*cdf0e10cSrcweir     if(nStateChange == STATE_CHANGE_ENABLE)
482*cdf0e10cSrcweir         Invalidate();
483*cdf0e10cSrcweir     Window::StateChanged(nStateChange);
484*cdf0e10cSrcweir }
485*cdf0e10cSrcweir /*-- 27.04.2004 14:01:23---------------------------------------------------
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
488*cdf0e10cSrcweir void SwAddressPreview::DrawText_Impl(
489*cdf0e10cSrcweir         const ::rtl::OUString& rAddress, const Point& rTopLeft, const Size& rSize, bool bIsSelected)
490*cdf0e10cSrcweir {
491*cdf0e10cSrcweir     SetClipRegion( Region( Rectangle(rTopLeft, rSize)) );
492*cdf0e10cSrcweir     if(bIsSelected)
493*cdf0e10cSrcweir     {
494*cdf0e10cSrcweir         //selection rectangle
495*cdf0e10cSrcweir         SetFillColor(Color(COL_TRANSPARENT));
496*cdf0e10cSrcweir         DrawRect(Rectangle(rTopLeft, rSize));
497*cdf0e10cSrcweir     }
498*cdf0e10cSrcweir     sal_Int32 nHeight = GetTextHeight();
499*cdf0e10cSrcweir     String sAddress(rAddress);
500*cdf0e10cSrcweir     sal_uInt16 nTokens = sAddress.GetTokenCount('\n');
501*cdf0e10cSrcweir     Point aStart = rTopLeft;
502*cdf0e10cSrcweir     //put it away from the border
503*cdf0e10cSrcweir     aStart.Move( 2, 2);
504*cdf0e10cSrcweir     for(sal_uInt16 nToken = 0; nToken < nTokens; nToken++)
505*cdf0e10cSrcweir     {
506*cdf0e10cSrcweir         DrawText( aStart, sAddress.GetToken(nToken, '\n') );
507*cdf0e10cSrcweir         aStart.Y() += nHeight;
508*cdf0e10cSrcweir     }
509*cdf0e10cSrcweir }
510*cdf0e10cSrcweir /*-- 29.04.2004 11:24:47---------------------------------------------------
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
513*cdf0e10cSrcweir String SwAddressPreview::FillData(
514*cdf0e10cSrcweir         const ::rtl::OUString& rAddress,
515*cdf0e10cSrcweir         SwMailMergeConfigItem& rConfigItem,
516*cdf0e10cSrcweir         const Sequence< ::rtl::OUString>* pAssignments)
517*cdf0e10cSrcweir {
518*cdf0e10cSrcweir     //find the column names in the address string (with name assignment!) and
519*cdf0e10cSrcweir     //exchange the placeholder (like <Firstname>) with the database content
520*cdf0e10cSrcweir     //unassigned columns are expanded to <not assigned>
521*cdf0e10cSrcweir     Reference< XColumnsSupplier > xColsSupp( rConfigItem.GetResultSet(), UNO_QUERY);
522*cdf0e10cSrcweir     Reference <XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : 0;
523*cdf0e10cSrcweir     Sequence< ::rtl::OUString> aAssignment = pAssignments ?
524*cdf0e10cSrcweir                     *pAssignments :
525*cdf0e10cSrcweir                     rConfigItem.GetColumnAssignment(
526*cdf0e10cSrcweir                                                 rConfigItem.GetCurrentDBData() );
527*cdf0e10cSrcweir     const ::rtl::OUString* pAssignment = aAssignment.getConstArray();
528*cdf0e10cSrcweir     const ResStringArray& rDefHeaders = rConfigItem.GetDefaultAddressHeaders();
529*cdf0e10cSrcweir     String sAddress(rAddress);
530*cdf0e10cSrcweir     String sNotAssigned(SW_RES(STR_NOTASSIGNED));
531*cdf0e10cSrcweir     sNotAssigned.Insert('<', 0);
532*cdf0e10cSrcweir     sNotAssigned += '>';
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir     sal_Bool bIncludeCountry = rConfigItem.IsIncludeCountry();
535*cdf0e10cSrcweir     const ::rtl::OUString rExcludeCountry = rConfigItem.GetExcludeCountry();
536*cdf0e10cSrcweir     bool bSpecialReplacementForCountry = (!bIncludeCountry || rExcludeCountry.getLength());
537*cdf0e10cSrcweir     String sCountryColumn;
538*cdf0e10cSrcweir     if( bSpecialReplacementForCountry )
539*cdf0e10cSrcweir     {
540*cdf0e10cSrcweir         sCountryColumn = rDefHeaders.GetString(MM_PART_COUNTRY);
541*cdf0e10cSrcweir         Sequence< ::rtl::OUString> aSpecialAssignment =
542*cdf0e10cSrcweir                         rConfigItem.GetColumnAssignment( rConfigItem.GetCurrentDBData() );
543*cdf0e10cSrcweir         if(aSpecialAssignment.getLength() > MM_PART_COUNTRY && aSpecialAssignment[MM_PART_COUNTRY].getLength())
544*cdf0e10cSrcweir             sCountryColumn = aSpecialAssignment[MM_PART_COUNTRY];
545*cdf0e10cSrcweir     }
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir     SwAddressIterator aIter(sAddress);
548*cdf0e10cSrcweir     sAddress.Erase();
549*cdf0e10cSrcweir     while(aIter.HasMore())
550*cdf0e10cSrcweir     {
551*cdf0e10cSrcweir         SwMergeAddressItem aItem = aIter.Next();
552*cdf0e10cSrcweir         if(aItem.bIsColumn)
553*cdf0e10cSrcweir         {
554*cdf0e10cSrcweir             //get the default column name
555*cdf0e10cSrcweir 
556*cdf0e10cSrcweir             //find the appropriate assignment
557*cdf0e10cSrcweir             String sConvertedColumn = aItem.sText;
558*cdf0e10cSrcweir             for(sal_uInt16 nColumn = 0;
559*cdf0e10cSrcweir                     nColumn < rDefHeaders.Count() && nColumn < aAssignment.getLength();
560*cdf0e10cSrcweir                                                                                 ++nColumn)
561*cdf0e10cSrcweir             {
562*cdf0e10cSrcweir                 if(rDefHeaders.GetString(nColumn) == aItem.sText &&
563*cdf0e10cSrcweir                     pAssignment[nColumn].getLength())
564*cdf0e10cSrcweir                 {
565*cdf0e10cSrcweir                     sConvertedColumn = pAssignment[nColumn];
566*cdf0e10cSrcweir                     break;
567*cdf0e10cSrcweir                 }
568*cdf0e10cSrcweir             }
569*cdf0e10cSrcweir             if(sConvertedColumn.Len() &&
570*cdf0e10cSrcweir                     xColAccess.is() &&
571*cdf0e10cSrcweir                     xColAccess->hasByName(sConvertedColumn))
572*cdf0e10cSrcweir             {
573*cdf0e10cSrcweir                 //get the content and exchange it in the address string
574*cdf0e10cSrcweir                 Any aCol = xColAccess->getByName(sConvertedColumn);
575*cdf0e10cSrcweir                 Reference< XColumn > xColumn;
576*cdf0e10cSrcweir                 aCol >>= xColumn;
577*cdf0e10cSrcweir                 if(xColumn.is())
578*cdf0e10cSrcweir                 {
579*cdf0e10cSrcweir                     try
580*cdf0e10cSrcweir                     {
581*cdf0e10cSrcweir                         ::rtl::OUString sReplace = xColumn->getString();
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir                         if( bSpecialReplacementForCountry && sCountryColumn == sConvertedColumn )
584*cdf0e10cSrcweir                         {
585*cdf0e10cSrcweir                             if( rExcludeCountry.getLength() && sReplace != rExcludeCountry )
586*cdf0e10cSrcweir                                 aItem.sText = sReplace;
587*cdf0e10cSrcweir                             else
588*cdf0e10cSrcweir                                 aItem.sText.Erase();
589*cdf0e10cSrcweir                         }
590*cdf0e10cSrcweir                         else
591*cdf0e10cSrcweir                         {
592*cdf0e10cSrcweir                             aItem.sText = sReplace;
593*cdf0e10cSrcweir                         }
594*cdf0e10cSrcweir                     }
595*cdf0e10cSrcweir                     catch( sdbc::SQLException& )
596*cdf0e10cSrcweir                     {
597*cdf0e10cSrcweir                         DBG_ERROR("SQLException caught");
598*cdf0e10cSrcweir                     }
599*cdf0e10cSrcweir                 }
600*cdf0e10cSrcweir             }
601*cdf0e10cSrcweir             else
602*cdf0e10cSrcweir             {
603*cdf0e10cSrcweir                 aItem.sText = sNotAssigned;
604*cdf0e10cSrcweir             }
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir         }
607*cdf0e10cSrcweir         sAddress += aItem.sText;
608*cdf0e10cSrcweir     }
609*cdf0e10cSrcweir     return sAddress;
610*cdf0e10cSrcweir }
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir /*-- 11.05.2004 15:42:08---------------------------------------------------
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
615*cdf0e10cSrcweir SwMergeAddressItem   SwAddressIterator::Next()
616*cdf0e10cSrcweir {
617*cdf0e10cSrcweir     //currently the string may either start with a '<' then it's a column
618*cdf0e10cSrcweir     //otherwise it's simple text maybe containing a return
619*cdf0e10cSrcweir     SwMergeAddressItem   aRet;
620*cdf0e10cSrcweir     if(sAddress.Len())
621*cdf0e10cSrcweir     {
622*cdf0e10cSrcweir         if(sAddress.GetChar(0) == '<')
623*cdf0e10cSrcweir         {
624*cdf0e10cSrcweir             aRet.bIsColumn = true;
625*cdf0e10cSrcweir             xub_StrLen nClose = sAddress.Search('>');
626*cdf0e10cSrcweir             DBG_ASSERT(nClose != STRING_NOTFOUND, "closing '>' not found");
627*cdf0e10cSrcweir             if( nClose != STRING_NOTFOUND )
628*cdf0e10cSrcweir             {
629*cdf0e10cSrcweir                 aRet.sText = sAddress.Copy(1, nClose - 1);
630*cdf0e10cSrcweir                 sAddress.Erase(0, nClose + 1);
631*cdf0e10cSrcweir             }
632*cdf0e10cSrcweir             else
633*cdf0e10cSrcweir             {
634*cdf0e10cSrcweir                 aRet.sText = sAddress.Copy(1, 1);
635*cdf0e10cSrcweir                 sAddress.Erase(0, 1);
636*cdf0e10cSrcweir             }
637*cdf0e10cSrcweir         }
638*cdf0e10cSrcweir         else
639*cdf0e10cSrcweir         {
640*cdf0e10cSrcweir             xub_StrLen nOpen = sAddress.Search('<');
641*cdf0e10cSrcweir             xub_StrLen nReturn = sAddress.Search('\n');
642*cdf0e10cSrcweir             if(nReturn == 0)
643*cdf0e10cSrcweir             {
644*cdf0e10cSrcweir                 aRet.bIsReturn = true;
645*cdf0e10cSrcweir                 aRet.sText = '\n';
646*cdf0e10cSrcweir                 sAddress.Erase(0, 1);
647*cdf0e10cSrcweir             }
648*cdf0e10cSrcweir             else if(STRING_NOTFOUND == nOpen && STRING_NOTFOUND == nReturn)
649*cdf0e10cSrcweir             {
650*cdf0e10cSrcweir                 nOpen = sAddress.Len();
651*cdf0e10cSrcweir                 aRet.sText = sAddress;
652*cdf0e10cSrcweir                 sAddress.Erase();
653*cdf0e10cSrcweir             }
654*cdf0e10cSrcweir             else
655*cdf0e10cSrcweir             {
656*cdf0e10cSrcweir                 xub_StrLen nTarget = ::std::min(nOpen, nReturn);
657*cdf0e10cSrcweir                 aRet.sText = sAddress.Copy(0, nTarget);
658*cdf0e10cSrcweir                 sAddress.Erase(0, nTarget);
659*cdf0e10cSrcweir             }
660*cdf0e10cSrcweir         }
661*cdf0e10cSrcweir     }
662*cdf0e10cSrcweir     return aRet;
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir }
665*cdf0e10cSrcweir /*-- 21.05.2004 10:36:20---------------------------------------------------
666*cdf0e10cSrcweir 
667*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
668*cdf0e10cSrcweir SwAuthenticator::~SwAuthenticator()
669*cdf0e10cSrcweir {
670*cdf0e10cSrcweir }
671*cdf0e10cSrcweir /*-- 21.05.2004 10:36:20---------------------------------------------------
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
674*cdf0e10cSrcweir OUString SwAuthenticator::getUserName( ) throw (RuntimeException)
675*cdf0e10cSrcweir {
676*cdf0e10cSrcweir     return m_aUserName;
677*cdf0e10cSrcweir }
678*cdf0e10cSrcweir /*-- 21.05.2004 10:36:20---------------------------------------------------
679*cdf0e10cSrcweir 
680*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
681*cdf0e10cSrcweir OUString SwAuthenticator::getPassword(  ) throw (RuntimeException)
682*cdf0e10cSrcweir {
683*cdf0e10cSrcweir     if(m_aUserName.getLength() && !m_aPassword.getLength() && m_pParentWindow)
684*cdf0e10cSrcweir     {
685*cdf0e10cSrcweir        SfxPasswordDialog* pPasswdDlg =
686*cdf0e10cSrcweir                 new SfxPasswordDialog( m_pParentWindow );
687*cdf0e10cSrcweir        pPasswdDlg->SetMinLen( 0 );
688*cdf0e10cSrcweir        if(RET_OK == pPasswdDlg->Execute())
689*cdf0e10cSrcweir             m_aPassword = pPasswdDlg->GetPassword();
690*cdf0e10cSrcweir     }
691*cdf0e10cSrcweir     return m_aPassword;
692*cdf0e10cSrcweir }
693*cdf0e10cSrcweir /*-- 25.08.2004 12:53:03---------------------------------------------------
694*cdf0e10cSrcweir 
695*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
696*cdf0e10cSrcweir SwConnectionContext::SwConnectionContext(
697*cdf0e10cSrcweir         const ::rtl::OUString& rMailServer, sal_Int16 nPort,
698*cdf0e10cSrcweir         const ::rtl::OUString& rConnectionType) :
699*cdf0e10cSrcweir     m_sMailServer(rMailServer),
700*cdf0e10cSrcweir     m_nPort(nPort),
701*cdf0e10cSrcweir     m_sConnectionType(rConnectionType)
702*cdf0e10cSrcweir {
703*cdf0e10cSrcweir }
704*cdf0e10cSrcweir /*-- 25.08.2004 12:53:03---------------------------------------------------
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
707*cdf0e10cSrcweir SwConnectionContext::~SwConnectionContext()
708*cdf0e10cSrcweir {
709*cdf0e10cSrcweir }
710*cdf0e10cSrcweir /*-- 25.08.2004 12:53:03---------------------------------------------------
711*cdf0e10cSrcweir 
712*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
713*cdf0e10cSrcweir uno::Any SwConnectionContext::getValueByName( const ::rtl::OUString& rName )
714*cdf0e10cSrcweir                                                 throw (uno::RuntimeException)
715*cdf0e10cSrcweir {
716*cdf0e10cSrcweir     uno::Any aRet;
717*cdf0e10cSrcweir     if( !rName.compareToAscii( "ServerName" ))
718*cdf0e10cSrcweir         aRet <<= m_sMailServer;
719*cdf0e10cSrcweir     else if( !rName.compareToAscii( "Port" ))
720*cdf0e10cSrcweir         aRet <<= (sal_Int32) m_nPort;
721*cdf0e10cSrcweir     else if( !rName.compareToAscii( "ConnectionType" ))
722*cdf0e10cSrcweir         aRet <<= m_sConnectionType;
723*cdf0e10cSrcweir     return aRet;
724*cdf0e10cSrcweir }
725*cdf0e10cSrcweir /*-- 21.05.2004 10:45:33---------------------------------------------------
726*cdf0e10cSrcweir 
727*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
728*cdf0e10cSrcweir SwConnectionListener::~SwConnectionListener()
729*cdf0e10cSrcweir {
730*cdf0e10cSrcweir }
731*cdf0e10cSrcweir /*-- 21.05.2004 10:45:33---------------------------------------------------
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
734*cdf0e10cSrcweir void SwConnectionListener::connected(const lang::EventObject& /*aEvent*/)
735*cdf0e10cSrcweir     throw (uno::RuntimeException)
736*cdf0e10cSrcweir {
737*cdf0e10cSrcweir     //OSL_ENSURE(false, "Connection opened");
738*cdf0e10cSrcweir }
739*cdf0e10cSrcweir /*-- 21.05.2004 10:45:33---------------------------------------------------
740*cdf0e10cSrcweir 
741*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
742*cdf0e10cSrcweir void SwConnectionListener::disconnected(const lang::EventObject& /*aEvent*/)
743*cdf0e10cSrcweir     throw (uno::RuntimeException)
744*cdf0e10cSrcweir {
745*cdf0e10cSrcweir     //OSL_ENSURE(false, "Connection closed");
746*cdf0e10cSrcweir }
747*cdf0e10cSrcweir /*-- 21.05.2004 10:45:33---------------------------------------------------
748*cdf0e10cSrcweir 
749*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
750*cdf0e10cSrcweir void SwConnectionListener::disposing(const lang::EventObject& /*aEvent*/)
751*cdf0e10cSrcweir     throw(uno::RuntimeException)
752*cdf0e10cSrcweir {
753*cdf0e10cSrcweir }
754*cdf0e10cSrcweir /*-- 21.05.2004 10:17:22---------------------------------------------------
755*cdf0e10cSrcweir 
756*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
757*cdf0e10cSrcweir uno::Reference< uno::XComponentContext> getCurrentCmpCtx(
758*cdf0e10cSrcweir                         uno::Reference<lang::XMultiServiceFactory> rSrvMgr)
759*cdf0e10cSrcweir {
760*cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xPropSet =
761*cdf0e10cSrcweir                 uno::Reference< beans::XPropertySet>(rSrvMgr, uno::UNO_QUERY);
762*cdf0e10cSrcweir     Any aAny = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii("DefaultContext"));
763*cdf0e10cSrcweir     uno::Reference< uno::XComponentContext> rCmpCtx;
764*cdf0e10cSrcweir     aAny >>= rCmpCtx;
765*cdf0e10cSrcweir     return rCmpCtx;
766*cdf0e10cSrcweir }
767*cdf0e10cSrcweir /*-- 13.07.2004 09:07:01---------------------------------------------------
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
770*cdf0e10cSrcweir SwMailTransferable::SwMailTransferable(const rtl::OUString& rBody, const rtl::OUString& rMimeType) :
771*cdf0e10cSrcweir     cppu::WeakComponentImplHelper2< datatransfer::XTransferable, beans::XPropertySet >(m_aMutex),
772*cdf0e10cSrcweir     m_aMimeType( rMimeType ),
773*cdf0e10cSrcweir     m_sBody( rBody ),
774*cdf0e10cSrcweir     m_bIsBody( true )
775*cdf0e10cSrcweir {
776*cdf0e10cSrcweir }
777*cdf0e10cSrcweir /*-- 13.07.2004 09:07:01---------------------------------------------------
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
780*cdf0e10cSrcweir SwMailTransferable::SwMailTransferable(const rtl::OUString& rURL,
781*cdf0e10cSrcweir                 const rtl::OUString& rName, const rtl::OUString& rMimeType) :
782*cdf0e10cSrcweir     cppu::WeakComponentImplHelper2< datatransfer::XTransferable, beans::XPropertySet >(m_aMutex),
783*cdf0e10cSrcweir     m_aMimeType( rMimeType ),
784*cdf0e10cSrcweir     m_aURL(rURL),
785*cdf0e10cSrcweir     m_aName( rName ),
786*cdf0e10cSrcweir     m_bIsBody( false )
787*cdf0e10cSrcweir {
788*cdf0e10cSrcweir }
789*cdf0e10cSrcweir /*-- 13.07.2004 09:07:08---------------------------------------------------
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
792*cdf0e10cSrcweir SwMailTransferable::~SwMailTransferable()
793*cdf0e10cSrcweir {
794*cdf0e10cSrcweir }
795*cdf0e10cSrcweir /*-- 13.07.2004 09:07:08---------------------------------------------------
796*cdf0e10cSrcweir 
797*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
798*cdf0e10cSrcweir uno::Any SwMailTransferable::getTransferData( const datatransfer::DataFlavor& /*aFlavor*/ )
799*cdf0e10cSrcweir                             throw (datatransfer::UnsupportedFlavorException,
800*cdf0e10cSrcweir                             io::IOException, uno::RuntimeException)
801*cdf0e10cSrcweir {
802*cdf0e10cSrcweir     uno::Any aRet;
803*cdf0e10cSrcweir     if( m_bIsBody )
804*cdf0e10cSrcweir         aRet <<= ::rtl::OUString(m_sBody);
805*cdf0e10cSrcweir     else
806*cdf0e10cSrcweir     {
807*cdf0e10cSrcweir         Sequence<sal_Int8> aData;
808*cdf0e10cSrcweir         SfxMedium aMedium( m_aURL, STREAM_STD_READ, sal_False );
809*cdf0e10cSrcweir         SvStream* pStream = aMedium.GetInStream();
810*cdf0e10cSrcweir         if ( aMedium.GetErrorCode() == ERRCODE_NONE && pStream)
811*cdf0e10cSrcweir         {
812*cdf0e10cSrcweir             pStream->Seek(STREAM_SEEK_TO_END);
813*cdf0e10cSrcweir             aData.realloc(pStream->Tell());
814*cdf0e10cSrcweir             pStream->Seek(0);
815*cdf0e10cSrcweir             sal_Int8 * pData = aData.getArray();
816*cdf0e10cSrcweir             pStream->Read( pData, aData.getLength() );
817*cdf0e10cSrcweir         }
818*cdf0e10cSrcweir         aRet <<= aData;
819*cdf0e10cSrcweir     }
820*cdf0e10cSrcweir     return aRet;
821*cdf0e10cSrcweir }
822*cdf0e10cSrcweir /*-- 13.07.2004 09:07:08---------------------------------------------------
823*cdf0e10cSrcweir 
824*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
825*cdf0e10cSrcweir uno::Sequence< datatransfer::DataFlavor > SwMailTransferable::getTransferDataFlavors(  )
826*cdf0e10cSrcweir                             throw (uno::RuntimeException)
827*cdf0e10cSrcweir {
828*cdf0e10cSrcweir     uno::Sequence< datatransfer::DataFlavor > aRet(1);
829*cdf0e10cSrcweir     aRet[0].MimeType = m_aMimeType;
830*cdf0e10cSrcweir     if( m_bIsBody )
831*cdf0e10cSrcweir     {
832*cdf0e10cSrcweir         aRet[0].DataType = getCppuType((::rtl::OUString*)0);
833*cdf0e10cSrcweir     }
834*cdf0e10cSrcweir     else
835*cdf0e10cSrcweir     {
836*cdf0e10cSrcweir         aRet[0].HumanPresentableName = m_aName;
837*cdf0e10cSrcweir         aRet[0].DataType = getCppuType((uno::Sequence<sal_Int8>*)0);
838*cdf0e10cSrcweir     }
839*cdf0e10cSrcweir     return aRet;
840*cdf0e10cSrcweir }
841*cdf0e10cSrcweir /*-- 13.07.2004 09:07:08---------------------------------------------------
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
844*cdf0e10cSrcweir sal_Bool SwMailTransferable::isDataFlavorSupported(
845*cdf0e10cSrcweir             const datatransfer::DataFlavor& aFlavor )
846*cdf0e10cSrcweir                             throw (uno::RuntimeException)
847*cdf0e10cSrcweir {
848*cdf0e10cSrcweir     return (aFlavor.MimeType == ::rtl::OUString(m_aMimeType));
849*cdf0e10cSrcweir }
850*cdf0e10cSrcweir /*-- 28.04.2004 09:52:05---------------------------------------------------
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
853*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SwMailTransferable::getPropertySetInfo(  ) throw(uno::RuntimeException)
854*cdf0e10cSrcweir {
855*cdf0e10cSrcweir     return uno::Reference< beans::XPropertySetInfo >();
856*cdf0e10cSrcweir }
857*cdf0e10cSrcweir /*-- 28.04.2004 09:52:05---------------------------------------------------
858*cdf0e10cSrcweir 
859*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
860*cdf0e10cSrcweir void SwMailTransferable::setPropertyValue( const ::rtl::OUString& , const uno::Any& )
861*cdf0e10cSrcweir     throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
862*cdf0e10cSrcweir           lang::WrappedTargetException, uno::RuntimeException)
863*cdf0e10cSrcweir {
864*cdf0e10cSrcweir }
865*cdf0e10cSrcweir /*-- 28.04.2004 09:52:05---------------------------------------------------
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
868*cdf0e10cSrcweir uno::Any SwMailTransferable::getPropertyValue( const ::rtl::OUString& rPropertyName )
869*cdf0e10cSrcweir     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
870*cdf0e10cSrcweir {
871*cdf0e10cSrcweir     uno::Any aRet;
872*cdf0e10cSrcweir     if( rPropertyName.equalsAscii( "URL" ) )
873*cdf0e10cSrcweir         aRet <<= m_aURL;
874*cdf0e10cSrcweir     return aRet;
875*cdf0e10cSrcweir }
876*cdf0e10cSrcweir /*-- 28.04.2004 09:52:05---------------------------------------------------
877*cdf0e10cSrcweir 
878*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
879*cdf0e10cSrcweir void SwMailTransferable::addPropertyChangeListener(
880*cdf0e10cSrcweir     const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener >&  )
881*cdf0e10cSrcweir     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
882*cdf0e10cSrcweir {
883*cdf0e10cSrcweir }
884*cdf0e10cSrcweir /*-- 28.04.2004 09:52:05---------------------------------------------------
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
887*cdf0e10cSrcweir void SwMailTransferable::removePropertyChangeListener(
888*cdf0e10cSrcweir     const ::rtl::OUString&,
889*cdf0e10cSrcweir     const uno::Reference< beans::XPropertyChangeListener >& )
890*cdf0e10cSrcweir     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
891*cdf0e10cSrcweir {
892*cdf0e10cSrcweir }
893*cdf0e10cSrcweir /*-- 28.04.2004 09:52:05---------------------------------------------------
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
896*cdf0e10cSrcweir void SwMailTransferable::addVetoableChangeListener(
897*cdf0e10cSrcweir     const ::rtl::OUString&,
898*cdf0e10cSrcweir     const uno::Reference< beans::XVetoableChangeListener >& )
899*cdf0e10cSrcweir     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
900*cdf0e10cSrcweir {
901*cdf0e10cSrcweir }
902*cdf0e10cSrcweir /*-- 28.04.2004 09:52:05---------------------------------------------------
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
905*cdf0e10cSrcweir void SwMailTransferable::removeVetoableChangeListener(
906*cdf0e10cSrcweir     const ::rtl::OUString& ,
907*cdf0e10cSrcweir     const uno::Reference< beans::XVetoableChangeListener >&  )
908*cdf0e10cSrcweir         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
909*cdf0e10cSrcweir {
910*cdf0e10cSrcweir }
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir /*-- 22.06.2004 16:46:05---------------------------------------------------
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
915*cdf0e10cSrcweir SwMailMessage::SwMailMessage() :
916*cdf0e10cSrcweir         cppu::WeakComponentImplHelper1< mail::XMailMessage>(m_aMutex)
917*cdf0e10cSrcweir {
918*cdf0e10cSrcweir }
919*cdf0e10cSrcweir /*-- 22.06.2004 16:46:06---------------------------------------------------
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
922*cdf0e10cSrcweir SwMailMessage::~SwMailMessage()
923*cdf0e10cSrcweir {
924*cdf0e10cSrcweir }
925*cdf0e10cSrcweir /*-- 02.07.2007 16:00:07---------------------------------------------------
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
928*cdf0e10cSrcweir ::rtl::OUString SwMailMessage::getSenderName() throw (uno::RuntimeException)
929*cdf0e10cSrcweir {
930*cdf0e10cSrcweir     return m_sSenderName;
931*cdf0e10cSrcweir }
932*cdf0e10cSrcweir /*-- 22.06.2004 16:46:06---------------------------------------------------
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
935*cdf0e10cSrcweir ::rtl::OUString SwMailMessage::getSenderAddress() throw (uno::RuntimeException)
936*cdf0e10cSrcweir {
937*cdf0e10cSrcweir     return m_sSenderAddress;
938*cdf0e10cSrcweir }
939*cdf0e10cSrcweir /*-- 22.06.2004 16:46:06---------------------------------------------------
940*cdf0e10cSrcweir 
941*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
942*cdf0e10cSrcweir ::rtl::OUString SwMailMessage::getReplyToAddress() throw (uno::RuntimeException)
943*cdf0e10cSrcweir {
944*cdf0e10cSrcweir     return m_sReplyToAddress;
945*cdf0e10cSrcweir }
946*cdf0e10cSrcweir /*-- 22.06.2004 16:46:07---------------------------------------------------
947*cdf0e10cSrcweir 
948*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
949*cdf0e10cSrcweir void SwMailMessage::setReplyToAddress( const ::rtl::OUString& _replytoaddress ) throw (uno::RuntimeException)
950*cdf0e10cSrcweir {
951*cdf0e10cSrcweir     m_sReplyToAddress = _replytoaddress;
952*cdf0e10cSrcweir }
953*cdf0e10cSrcweir /*-- 22.06.2004 16:46:07---------------------------------------------------
954*cdf0e10cSrcweir 
955*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
956*cdf0e10cSrcweir ::rtl::OUString SwMailMessage::getSubject() throw (uno::RuntimeException)
957*cdf0e10cSrcweir {
958*cdf0e10cSrcweir     return m_sSubject;
959*cdf0e10cSrcweir }
960*cdf0e10cSrcweir /*-- 22.06.2004 16:46:07---------------------------------------------------
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
963*cdf0e10cSrcweir void SwMailMessage::setSubject( const ::rtl::OUString& _subject ) throw (uno::RuntimeException)
964*cdf0e10cSrcweir {
965*cdf0e10cSrcweir     m_sSubject = _subject;
966*cdf0e10cSrcweir }
967*cdf0e10cSrcweir /*-- 13.07.2004 09:57:18---------------------------------------------------
968*cdf0e10cSrcweir 
969*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
970*cdf0e10cSrcweir uno::Reference< datatransfer::XTransferable > SwMailMessage::getBody() throw (uno::RuntimeException)
971*cdf0e10cSrcweir {
972*cdf0e10cSrcweir     return m_xBody;
973*cdf0e10cSrcweir }
974*cdf0e10cSrcweir /*-- 13.07.2004 09:57:18---------------------------------------------------
975*cdf0e10cSrcweir 
976*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
977*cdf0e10cSrcweir void SwMailMessage::setBody(
978*cdf0e10cSrcweir         const uno::Reference< datatransfer::XTransferable >& rBody )
979*cdf0e10cSrcweir                                                 throw (uno::RuntimeException)
980*cdf0e10cSrcweir {
981*cdf0e10cSrcweir     m_xBody = rBody;
982*cdf0e10cSrcweir }
983*cdf0e10cSrcweir /*-- 22.06.2004 16:46:08---------------------------------------------------
984*cdf0e10cSrcweir 
985*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
986*cdf0e10cSrcweir void  SwMailMessage::addRecipient( const ::rtl::OUString& rRecipientAddress )
987*cdf0e10cSrcweir         throw (uno::RuntimeException)
988*cdf0e10cSrcweir {
989*cdf0e10cSrcweir     m_aRecipients.realloc(m_aRecipients.getLength() + 1);
990*cdf0e10cSrcweir     m_aRecipients[m_aRecipients.getLength() - 1] = rRecipientAddress;
991*cdf0e10cSrcweir }
992*cdf0e10cSrcweir /*-- 22.06.2004 16:46:09---------------------------------------------------
993*cdf0e10cSrcweir 
994*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
995*cdf0e10cSrcweir void  SwMailMessage::addCcRecipient( const ::rtl::OUString& rRecipientAddress )
996*cdf0e10cSrcweir         throw (uno::RuntimeException)
997*cdf0e10cSrcweir {
998*cdf0e10cSrcweir     m_aCcRecipients.realloc(m_aCcRecipients.getLength() + 1);
999*cdf0e10cSrcweir     m_aCcRecipients[m_aCcRecipients.getLength() - 1] = rRecipientAddress;
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir }
1002*cdf0e10cSrcweir /*-- 22.06.2004 16:46:09---------------------------------------------------
1003*cdf0e10cSrcweir 
1004*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1005*cdf0e10cSrcweir void  SwMailMessage::addBccRecipient( const ::rtl::OUString& rRecipientAddress ) throw (uno::RuntimeException)
1006*cdf0e10cSrcweir {
1007*cdf0e10cSrcweir     m_aBccRecipients.realloc(m_aBccRecipients.getLength() + 1);
1008*cdf0e10cSrcweir     m_aBccRecipients[m_aBccRecipients.getLength() - 1] = rRecipientAddress;
1009*cdf0e10cSrcweir }
1010*cdf0e10cSrcweir /*-- 22.06.2004 16:46:09---------------------------------------------------
1011*cdf0e10cSrcweir 
1012*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1013*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SwMailMessage::getRecipients(  ) throw (uno::RuntimeException)
1014*cdf0e10cSrcweir {
1015*cdf0e10cSrcweir     return m_aRecipients;
1016*cdf0e10cSrcweir }
1017*cdf0e10cSrcweir /*-- 22.06.2004 16:46:10---------------------------------------------------
1018*cdf0e10cSrcweir 
1019*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1020*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SwMailMessage::getCcRecipients(  ) throw (uno::RuntimeException)
1021*cdf0e10cSrcweir {
1022*cdf0e10cSrcweir     return m_aCcRecipients;
1023*cdf0e10cSrcweir }
1024*cdf0e10cSrcweir /*-- 22.06.2004 16:46:10---------------------------------------------------
1025*cdf0e10cSrcweir 
1026*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1027*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SwMailMessage::getBccRecipients(  ) throw (uno::RuntimeException)
1028*cdf0e10cSrcweir {
1029*cdf0e10cSrcweir     return m_aBccRecipients;
1030*cdf0e10cSrcweir }
1031*cdf0e10cSrcweir /*-- 13.07.2004 09:59:48---------------------------------------------------
1032*cdf0e10cSrcweir 
1033*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1034*cdf0e10cSrcweir void SwMailMessage::addAttachment( const mail::MailAttachment& rMailAttachment )
1035*cdf0e10cSrcweir             throw (uno::RuntimeException)
1036*cdf0e10cSrcweir {
1037*cdf0e10cSrcweir     m_aAttachments.realloc(m_aAttachments.getLength() + 1);
1038*cdf0e10cSrcweir     m_aAttachments[m_aAttachments.getLength() - 1] = rMailAttachment;
1039*cdf0e10cSrcweir }
1040*cdf0e10cSrcweir /*-- 13.07.2004 09:59:48---------------------------------------------------
1041*cdf0e10cSrcweir 
1042*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1043*cdf0e10cSrcweir uno::Sequence< mail::MailAttachment > SwMailMessage::getAttachments(  )
1044*cdf0e10cSrcweir                                             throw (uno::RuntimeException)
1045*cdf0e10cSrcweir {
1046*cdf0e10cSrcweir     return m_aAttachments;
1047*cdf0e10cSrcweir }
1048