Branch data 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_SFX_MAILMODEL_HXX
20 : : #define INCLUDED_SFX_MAILMODEL_HXX
21 : :
22 : : #include <vector>
23 : : #include <com/sun/star/frame/XFrame.hpp>
24 : : #include <com/sun/star/frame/XModel.hpp>
25 : : #include "tools/link.hxx"
26 : : #include <tools/string.hxx>
27 : : #include "sfx2/dllapi.h"
28 : :
29 : : // class AddressList_Impl ------------------------------------------------
30 : : typedef String* AddressItemPtr_Impl;
31 : : typedef ::std::vector< AddressItemPtr_Impl > AddressList_Impl;
32 : :
33 : : // class SfxMailModel_Impl -----------------------------------------------
34 : :
35 : : class SFX2_DLLPUBLIC SfxMailModel
36 : : {
37 : : public:
38 : : enum MailPriority
39 : : {
40 : : PRIO_HIGHEST,
41 : : PRIO_HIGH,
42 : : PRIO_NORMAL,
43 : : PRIO_LOW,
44 : : PRIO_LOWEST
45 : : };
46 : :
47 : : enum AddressRole
48 : : {
49 : : ROLE_TO,
50 : : ROLE_CC,
51 : : ROLE_BCC
52 : : };
53 : :
54 : : enum MailDocType
55 : : {
56 : : TYPE_SELF,
57 : : TYPE_ASPDF
58 : : };
59 : :
60 : : protected:
61 : : enum SaveResult
62 : : {
63 : : SAVE_SUCCESSFULL,
64 : : SAVE_CANCELLED,
65 : : SAVE_ERROR
66 : : };
67 : : ::std::vector< ::rtl::OUString > maAttachedDocuments;
68 : : SaveResult SaveDocumentAsFormat( const rtl::OUString& aSaveFileName,
69 : : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
70 : : const rtl::OUString& rType,
71 : : rtl::OUString& rFileNamePath );
72 : :
73 : : private:
74 : : AddressList_Impl* mpToList;
75 : : AddressList_Impl* mpCcList;
76 : : AddressList_Impl* mpBccList;
77 : : String maFromAddress;
78 : : String maSubject;
79 : : MailPriority mePriority;
80 : :
81 : : sal_Bool mbLoadDone;
82 : :
83 : : void ClearList( AddressList_Impl* pList );
84 : : SaveResult ShowFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR,
85 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel,
86 : : const ::rtl::OUString& rFilterName,
87 : : const ::rtl::OUString& rType,
88 : : bool bModified,
89 : : sal_Int32& rNumArgs,
90 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
91 : :
92 : : DECL_LINK( DoneHdl, void* );
93 : :
94 : : public:
95 : : enum SendMailResult
96 : : {
97 : : SEND_MAIL_OK,
98 : : SEND_MAIL_CANCELLED,
99 : : SEND_MAIL_ERROR
100 : : };
101 : :
102 : : SfxMailModel();
103 : : ~SfxMailModel();
104 : :
105 : : void AddAddress( const String& rAddress, AddressRole eRole );
106 : : void SetFromAddress( const String& rAddress ) { maFromAddress = rAddress; }
107 : 0 : void SetSubject( const String& rSubject ) { maSubject = rSubject; }
108 : : void SetPriority( MailPriority ePrio ) { mePriority = ePrio; }
109 : :
110 : : /** attaches a document to the current attachment list, can be called more than once.
111 : : * at the moment there will be a dialog for export executed for every model which is going to be attached.
112 : : *
113 : : * \param sDocumentType
114 : : The doc type to export. PDF will be at the moment only a direct export (no dialog).
115 : : * \param xModel
116 : : The current model to attach
117 : : * \param sAttachmentTitle
118 : : The title which will be used as attachment title
119 : : * \return @see error code
120 : : */
121 : : SendMailResult AttachDocument( const ::rtl::OUString& sDocumentType,
122 : : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
123 : : const ::rtl::OUString& sAttachmentTitle );
124 : :
125 : : SendMailResult SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
126 : : const rtl::OUString& rType );
127 : : SendMailResult Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
128 : :
129 : : sal_Bool IsEmpty() const;
130 : : };
131 : :
132 : : sal_Bool CreateFromAddress_Impl( String& rFrom );
133 : :
134 : : #endif // INCLUDED_SFX_MAILMODEL_HXX
135 : :
136 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|