cmdmailmsg.cxx (79aad27f) cmdmailmsg.cxx (33bc51b9)
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

--- 10 unchanged lines hidden (view full) ---

19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_shell.hxx"
26
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

--- 10 unchanged lines hidden (view full) ---

19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_shell.hxx"
26
27//------------------------------------------------------------------------
28// includes
29//------------------------------------------------------------------------
30#include <osl/diagnose.h>
31#include "cmdmailmsg.hxx"
27#include "cmdmailmsg.hxx"
32#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
33#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
34#include <com/sun/star/uno/Reference.hxx>
35#include <com/sun/star/uno/RuntimeException.hpp>
36
28
37//------------------------------------------------------------------------
38// namespace directives
39//------------------------------------------------------------------------
40
41using com::sun::star::lang::IllegalArgumentException;
42using com::sun::star::lang::WrappedTargetException;
43using com::sun::star::container::NoSuchElementException;
44using com::sun::star::container::XNameAccess;
45using rtl::OUString;
46using osl::MutexGuard;
47
48using namespace cppu;
49using namespace com::sun::star::uno;
50
51
29using com::sun::star::lang::IllegalArgumentException;
30using com::sun::star::lang::WrappedTargetException;
31using com::sun::star::container::NoSuchElementException;
32using com::sun::star::container::XNameAccess;
33using rtl::OUString;
34using osl::MutexGuard;
35
36using namespace cppu;
37using namespace com::sun::star::uno;
38
39
52//------------------------------------------------
53//
54//------------------------------------------------
40void SAL_CALL CmdMailMsg::setBody( const OUString& aBody )
41 throw (RuntimeException)
42{
43 MutexGuard aGuard( m_aMutex );
44 m_aBody = aBody;
45}
55
46
56void SAL_CALL CmdMailMsg::setRecipient( const ::rtl::OUString& aRecipient )
47OUString SAL_CALL CmdMailMsg::getBody( )
57 throw (RuntimeException)
58{
59 MutexGuard aGuard( m_aMutex );
48 throw (RuntimeException)
49{
50 MutexGuard aGuard( m_aMutex );
51 return m_aBody;
52}
53
54void SAL_CALL CmdMailMsg::setRecipient( const OUString& aRecipient )
55 throw (RuntimeException)
56{
57 MutexGuard aGuard( m_aMutex );
60 m_aRecipient = aRecipient;
61}
62
58 m_aRecipient = aRecipient;
59}
60
63//------------------------------------------------
64//
65//------------------------------------------------
66
67::rtl::OUString SAL_CALL CmdMailMsg::getRecipient( )
61OUString SAL_CALL CmdMailMsg::getRecipient( )
68 throw (RuntimeException)
69{
70 MutexGuard aGuard( m_aMutex );
71 return m_aRecipient;
72}
73
62 throw (RuntimeException)
63{
64 MutexGuard aGuard( m_aMutex );
65 return m_aRecipient;
66}
67
74//------------------------------------------------
75//
76//------------------------------------------------
77
78void SAL_CALL CmdMailMsg::setCcRecipient( const Sequence< OUString >& aCcRecipient )
79 throw (RuntimeException)
80{
81 MutexGuard aGuard( m_aMutex );
82 m_CcRecipients = aCcRecipient;
83}
84
68void SAL_CALL CmdMailMsg::setCcRecipient( const Sequence< OUString >& aCcRecipient )
69 throw (RuntimeException)
70{
71 MutexGuard aGuard( m_aMutex );
72 m_CcRecipients = aCcRecipient;
73}
74
85//------------------------------------------------
86//
87//------------------------------------------------
88
89Sequence< OUString > SAL_CALL CmdMailMsg::getCcRecipient( )
90 throw (RuntimeException)
91{
92 MutexGuard aGuard( m_aMutex );
93 return m_CcRecipients;
94}
95
75Sequence< OUString > SAL_CALL CmdMailMsg::getCcRecipient( )
76 throw (RuntimeException)
77{
78 MutexGuard aGuard( m_aMutex );
79 return m_CcRecipients;
80}
81
96//------------------------------------------------
97//
98//------------------------------------------------
99
100void SAL_CALL CmdMailMsg::setBccRecipient( const Sequence< OUString >& aBccRecipient )
101 throw (RuntimeException)
102{
103 MutexGuard aGuard( m_aMutex );
104 m_BccRecipients = aBccRecipient;
105}
106
82void SAL_CALL CmdMailMsg::setBccRecipient( const Sequence< OUString >& aBccRecipient )
83 throw (RuntimeException)
84{
85 MutexGuard aGuard( m_aMutex );
86 m_BccRecipients = aBccRecipient;
87}
88
107//------------------------------------------------
108//
109//------------------------------------------------
110
111Sequence< OUString > SAL_CALL CmdMailMsg::getBccRecipient( )
112 throw (RuntimeException)
113{
114 MutexGuard aGuard( m_aMutex );
115 return m_BccRecipients;
116}
89Sequence< OUString > SAL_CALL CmdMailMsg::getBccRecipient( )
90 throw (RuntimeException)
91{
92 MutexGuard aGuard( m_aMutex );
93 return m_BccRecipients;
94}
117
118//------------------------------------------------
119//
120//------------------------------------------------
121
122void SAL_CALL CmdMailMsg::setOriginator( const OUString& aOriginator )
123 throw (RuntimeException)
124{
125 MutexGuard aGuard( m_aMutex );
126 m_aOriginator = aOriginator;
127}
128
95
96void SAL_CALL CmdMailMsg::setOriginator( const OUString& aOriginator )
97 throw (RuntimeException)
98{
99 MutexGuard aGuard( m_aMutex );
100 m_aOriginator = aOriginator;
101}
102
129//------------------------------------------------
130//
131//------------------------------------------------
132
133OUString SAL_CALL CmdMailMsg::getOriginator( )
134 throw (RuntimeException)
135{
136 MutexGuard aGuard( m_aMutex );
137 return m_aOriginator;
138}
103OUString SAL_CALL CmdMailMsg::getOriginator( )
104 throw (RuntimeException)
105{
106 MutexGuard aGuard( m_aMutex );
107 return m_aOriginator;
108}
139
140//------------------------------------------------
141//
142//------------------------------------------------
143
144void SAL_CALL CmdMailMsg::setSubject( const OUString& aSubject )
145 throw (RuntimeException)
146{
147 MutexGuard aGuard( m_aMutex );
148 m_aSubject = aSubject;
149}
150
109
110void SAL_CALL CmdMailMsg::setSubject( const OUString& aSubject )
111 throw (RuntimeException)
112{
113 MutexGuard aGuard( m_aMutex );
114 m_aSubject = aSubject;
115}
116
151//------------------------------------------------
152//
153//------------------------------------------------
154
155OUString SAL_CALL CmdMailMsg::getSubject( )
156 throw (RuntimeException)
157{
158 MutexGuard aGuard( m_aMutex );
159 return m_aSubject;
160}
161
117OUString SAL_CALL CmdMailMsg::getSubject( )
118 throw (RuntimeException)
119{
120 MutexGuard aGuard( m_aMutex );
121 return m_aSubject;
122}
123
162//------------------------------------------------
163//
164//------------------------------------------------
165
166void SAL_CALL CmdMailMsg::setAttachement( const Sequence< ::rtl::OUString >& aAttachment )
124void SAL_CALL CmdMailMsg::setAttachement( const Sequence< OUString >& aAttachment )
167 throw (IllegalArgumentException, RuntimeException)
168{
169 MutexGuard aGuard( m_aMutex );
170 m_Attachments = aAttachment;
171}
172
125 throw (IllegalArgumentException, RuntimeException)
126{
127 MutexGuard aGuard( m_aMutex );
128 m_Attachments = aAttachment;
129}
130
173//------------------------------------------------
174//
175//------------------------------------------------
176
177Sequence< OUString > SAL_CALL CmdMailMsg::getAttachement( )
178 throw (RuntimeException)
179{
180 MutexGuard aGuard( m_aMutex );
181 return m_Attachments;
182}
183
131Sequence< OUString > SAL_CALL CmdMailMsg::getAttachement( )
132 throw (RuntimeException)
133{
134 MutexGuard aGuard( m_aMutex );
135 return m_Attachments;
136}
137
184//------------------------------------------------
185//
186//------------------------------------------------
187
188Any SAL_CALL CmdMailMsg::getByName( const OUString& aName )
189 throw (NoSuchElementException, WrappedTargetException, RuntimeException)
190{
191 MutexGuard aGuard( m_aMutex );
192
138Any SAL_CALL CmdMailMsg::getByName( const OUString& aName )
139 throw (NoSuchElementException, WrappedTargetException, RuntimeException)
140{
141 MutexGuard aGuard( m_aMutex );
142
193 if( 0 == aName.compareToAscii( "from" ) && m_aOriginator.getLength() )
143 if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "body" )) && m_aBody.getLength() )
144 return makeAny( m_aBody );
145
146 if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "from" )) && m_aOriginator.getLength() )
194 return makeAny( m_aOriginator );
195
147 return makeAny( m_aOriginator );
148
196 else if( 0 == aName.compareToAscii( "to" ) && m_aRecipient.getLength() )
149 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "to" )) && m_aRecipient.getLength() )
197 return makeAny( m_aRecipient );
198
150 return makeAny( m_aRecipient );
151
199 else if( 0 == aName.compareToAscii( "cc" ) && m_CcRecipients.getLength() )
152 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "cc" )) && m_CcRecipients.getLength() )
200 return makeAny( m_CcRecipients );
153 return makeAny( m_CcRecipients );
201
202 else if( 0 == aName.compareToAscii( "bcc" ) && m_BccRecipients.getLength() )
154
155 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "bcc" )) && m_BccRecipients.getLength() )
203 return makeAny( m_BccRecipients );
156 return makeAny( m_BccRecipients );
204
205 else if( 0 == aName.compareToAscii( "subject" ) && m_aSubject.getLength() )
157
158 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "subject" )) && m_aSubject.getLength() )
206 return makeAny( m_aSubject );
159 return makeAny( m_aSubject );
207
208 else if( 0 == aName.compareToAscii( "attachment" ) && m_Attachments.getLength() )
160
161 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "attachment" )) && m_Attachments.getLength() )
209 return makeAny( m_Attachments );
162 return makeAny( m_Attachments );
210
211 throw NoSuchElementException( OUString::createFromAscii( "key not found: ") + aName,
163
164 throw NoSuchElementException( OUString(RTL_CONSTASCII_USTRINGPARAM( "key not found: ")) + aName,
212 static_cast < XNameAccess * > (this) );
213}
214
165 static_cast < XNameAccess * > (this) );
166}
167
215//------------------------------------------------
216//
217//------------------------------------------------
218
219Sequence< OUString > SAL_CALL CmdMailMsg::getElementNames( )
220 throw (::com::sun::star::uno::RuntimeException)
221{
222 MutexGuard aGuard( m_aMutex );
168Sequence< OUString > SAL_CALL CmdMailMsg::getElementNames( )
169 throw (::com::sun::star::uno::RuntimeException)
170{
171 MutexGuard aGuard( m_aMutex );
223
172
224 sal_Int32 nItems = 0;
173 sal_Int32 nItems = 0;
225 Sequence< OUString > aRet( 6 );
226
174 Sequence< OUString > aRet( 7 );
175
176 if( m_aBody.getLength() )
177 aRet[nItems++] = OUString(RTL_CONSTASCII_USTRINGPARAM( "body" ));
178
227 if( m_aOriginator.getLength() )
179 if( m_aOriginator.getLength() )
228 aRet[nItems++] = OUString::createFromAscii( "from" );
180 aRet[nItems++] = OUString(RTL_CONSTASCII_USTRINGPARAM( "from" ));
229
230 if( m_aRecipient.getLength() )
181
182 if( m_aRecipient.getLength() )
231 aRet[nItems++] = OUString::createFromAscii( "to" );
183 aRet[nItems++] = OUString(RTL_CONSTASCII_USTRINGPARAM( "to" ));
232
233 if( m_CcRecipients.getLength() )
184
185 if( m_CcRecipients.getLength() )
234 aRet[nItems++] = OUString::createFromAscii( "cc" );
186 aRet[nItems++] = OUString(RTL_CONSTASCII_USTRINGPARAM( "cc" ));
235
236 if( m_BccRecipients.getLength() )
187
188 if( m_BccRecipients.getLength() )
237 aRet[nItems++] = OUString::createFromAscii( "bcc" );
189 aRet[nItems++] = OUString(RTL_CONSTASCII_USTRINGPARAM( "bcc" ));
238
239 if( m_aSubject.getLength() )
190
191 if( m_aSubject.getLength() )
240 aRet[nItems++] = OUString::createFromAscii( "subject" );
192 aRet[nItems++] = OUString(RTL_CONSTASCII_USTRINGPARAM( "subject" ));
241
242 if( m_Attachments.getLength() )
193
194 if( m_Attachments.getLength() )
243 aRet[nItems++] = OUString::createFromAscii( "attachment" );
195 aRet[nItems++] = OUString(RTL_CONSTASCII_USTRINGPARAM( "attachment" ));
244
245 aRet.realloc( nItems );
196
197 aRet.realloc( nItems );
246 return aRet;
198 return aRet;
247}
248
199}
200
249//------------------------------------------------
250//
251//------------------------------------------------
252
253 sal_Bool SAL_CALL CmdMailMsg::hasByName( const ::rtl::OUString& aName )
201 sal_Bool SAL_CALL CmdMailMsg::hasByName( const OUString& aName )
254 throw (RuntimeException)
255{
256 MutexGuard aGuard( m_aMutex );
257
202 throw (RuntimeException)
203{
204 MutexGuard aGuard( m_aMutex );
205
258 if( 0 == aName.compareToAscii( "from" ) && m_aOriginator.getLength() )
206 if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "body" )) && m_aBody.getLength() )
259 return sal_True;
260
207 return sal_True;
208
261 else if( 0 == aName.compareToAscii( "to" ) && m_aRecipient.getLength() )
209 if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "from" )) && m_aOriginator.getLength() )
262 return sal_True;
263
210 return sal_True;
211
264 else if( 0 == aName.compareToAscii( "cc" ) && m_CcRecipients.getLength() )
212 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "to" )) && m_aRecipient.getLength() )
265 return sal_True;
213 return sal_True;
266
267 else if( 0 == aName.compareToAscii( "bcc" ) && m_BccRecipients.getLength() )
214
215 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "cc" )) && m_CcRecipients.getLength() )
268 return sal_True;
216 return sal_True;
269
270 else if( 0 == aName.compareToAscii( "subject" ) && m_aSubject.getLength() )
217
218 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "bcc" )) && m_BccRecipients.getLength() )
271 return sal_True;
219 return sal_True;
272
273 else if( 0 == aName.compareToAscii( "attachment" ) && m_Attachments.getLength() )
220
221 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "subject" )) && m_aSubject.getLength() )
274 return sal_True;
222 return sal_True;
275
223
224 else if( 0 == aName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "attachment" )) && m_Attachments.getLength() )
225 return sal_True;
226
276 return sal_False;
277}
278
227 return sal_False;
228}
229
279//------------------------------------------------
280//
281//------------------------------------------------
282
283Type SAL_CALL CmdMailMsg::getElementType( )
284 throw (RuntimeException)
285{
286 // returning void for multi type container
287 return Type();
288}
289
230Type SAL_CALL CmdMailMsg::getElementType( )
231 throw (RuntimeException)
232{
233 // returning void for multi type container
234 return Type();
235}
236
290//------------------------------------------------
291//
292//------------------------------------------------
293
294sal_Bool SAL_CALL CmdMailMsg::hasElements( )
295 throw (RuntimeException)
296{
297 return 0 != getElementNames().getLength();
298}
237sal_Bool SAL_CALL CmdMailMsg::hasElements( )
238 throw (RuntimeException)
239{
240 return 0 != getElementNames().getLength();
241}