Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SFX2_MAILMODELAPI_HXX
20 : #define INCLUDED_SFX2_MAILMODELAPI_HXX
21 :
22 : #include <com/sun/star/frame/XFrame.hpp>
23 : #include <com/sun/star/frame/XModel.hpp>
24 : #include <rtl/ustring.hxx>
25 : #include <sfx2/dllapi.h>
26 : #include <tools/link.hxx>
27 : #include <vector>
28 :
29 : // class AddressList_Impl ------------------------------------------------
30 : typedef ::std::vector< OUString > AddressList_Impl;
31 :
32 : // class SfxMailModel_Impl -----------------------------------------------
33 :
34 : class SFX2_DLLPUBLIC SfxMailModel
35 : {
36 : public:
37 : enum MailPriority
38 : {
39 : PRIO_HIGHEST,
40 : PRIO_HIGH,
41 : PRIO_NORMAL,
42 : PRIO_LOW,
43 : PRIO_LOWEST
44 : };
45 :
46 : enum AddressRole
47 : {
48 : ROLE_TO,
49 : ROLE_CC,
50 : ROLE_BCC
51 : };
52 :
53 : enum MailDocType
54 : {
55 : TYPE_SELF,
56 : TYPE_ASPDF
57 : };
58 :
59 : protected:
60 : enum SaveResult
61 : {
62 : SAVE_SUCCESSFULL,
63 : SAVE_CANCELLED,
64 : SAVE_ERROR
65 : };
66 : ::std::vector< OUString > maAttachedDocuments;
67 : static SaveResult SaveDocumentAsFormat( const OUString& aSaveFileName,
68 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
69 : const OUString& rType,
70 : OUString& rFileNamePath );
71 :
72 : private:
73 : AddressList_Impl* mpToList;
74 : AddressList_Impl* mpCcList;
75 : AddressList_Impl* mpBccList;
76 : OUString maFromAddress;
77 : OUString maSubject;
78 : MailPriority mePriority;
79 :
80 : bool mbLoadDone;
81 :
82 : static SaveResult ShowFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR,
83 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel,
84 : const OUString& rFilterName,
85 : const OUString& rType,
86 : bool bModified,
87 : sal_Int32& rNumArgs,
88 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
89 :
90 : DECL_LINK( DoneHdl, void* );
91 :
92 : public:
93 : enum SendMailResult
94 : {
95 : SEND_MAIL_OK,
96 : SEND_MAIL_CANCELLED,
97 : SEND_MAIL_ERROR
98 : };
99 :
100 : SfxMailModel();
101 : ~SfxMailModel();
102 :
103 : void AddAddress( const OUString& rAddress, AddressRole eRole );
104 : void SetFromAddress( const OUString& rAddress ) { maFromAddress = rAddress; }
105 0 : void SetSubject( const OUString& rSubject ) { maSubject = rSubject; }
106 : void SetPriority( MailPriority ePrio ) { mePriority = ePrio; }
107 :
108 : /** attaches a document to the current attachment list, can be called more than once.
109 : * at the moment there will be a dialog for export executed for every model which is going to be attached.
110 : *
111 : * \param sDocumentType
112 : The doc type to export. PDF will be at the moment only a direct export (no dialog).
113 : * \param xModel
114 : The current model to attach
115 : * \param sAttachmentTitle
116 : The title which will be used as attachment title
117 : * \return @see error code
118 : */
119 : SendMailResult AttachDocument( const OUString& sDocumentType,
120 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
121 : const OUString& sAttachmentTitle );
122 :
123 : SendMailResult SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
124 : const OUString& rType );
125 : SendMailResult Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
126 :
127 : bool IsEmpty() const;
128 : };
129 :
130 : bool CreateFromAddress_Impl( OUString& rFrom );
131 :
132 : #endif // INCLUDED_SFX2_MAILMODELAPI_HXX
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|