update credits
[LibreOffice.git] / include / sfx2 / mailmodelapi.hxx
blob042a364e2b5a0888521e78014c3180f587c78a12
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SFX_MAILMODEL_HXX
20 #define INCLUDED_SFX_MAILMODEL_HXX
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"
29 // class AddressList_Impl ------------------------------------------------
30 typedef String* AddressItemPtr_Impl;
31 typedef ::std::vector< AddressItemPtr_Impl > AddressList_Impl;
33 // class SfxMailModel_Impl -----------------------------------------------
35 class SFX2_DLLPUBLIC SfxMailModel
37 public:
38 enum MailPriority
40 PRIO_HIGHEST,
41 PRIO_HIGH,
42 PRIO_NORMAL,
43 PRIO_LOW,
44 PRIO_LOWEST
47 enum AddressRole
49 ROLE_TO,
50 ROLE_CC,
51 ROLE_BCC
54 enum MailDocType
56 TYPE_SELF,
57 TYPE_ASPDF
60 protected:
61 enum SaveResult
63 SAVE_SUCCESSFULL,
64 SAVE_CANCELLED,
65 SAVE_ERROR
67 ::std::vector< OUString > maAttachedDocuments;
68 SaveResult SaveDocumentAsFormat( const OUString& aSaveFileName,
69 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
70 const OUString& rType,
71 OUString& rFileNamePath );
73 private:
74 AddressList_Impl* mpToList;
75 AddressList_Impl* mpCcList;
76 AddressList_Impl* mpBccList;
77 String maFromAddress;
78 String maSubject;
79 MailPriority mePriority;
81 sal_Bool mbLoadDone;
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 OUString& rFilterName,
87 const OUString& rType,
88 bool bModified,
89 sal_Int32& rNumArgs,
90 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
92 DECL_LINK( DoneHdl, void* );
94 public:
95 enum SendMailResult
97 SEND_MAIL_OK,
98 SEND_MAIL_CANCELLED,
99 SEND_MAIL_ERROR
102 SfxMailModel();
103 ~SfxMailModel();
105 void AddAddress( const String& rAddress, AddressRole eRole );
106 void SetFromAddress( const String& rAddress ) { maFromAddress = rAddress; }
107 void SetSubject( const String& rSubject ) { maSubject = rSubject; }
108 void SetPriority( MailPriority ePrio ) { mePriority = ePrio; }
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.
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
121 SendMailResult AttachDocument( const OUString& sDocumentType,
122 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
123 const OUString& sAttachmentTitle );
125 SendMailResult SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
126 const OUString& rType );
127 SendMailResult Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
129 sal_Bool IsEmpty() const;
132 sal_Bool CreateFromAddress_Impl( String& rFrom );
134 #endif // INCLUDED_SFX_MAILMODEL_HXX
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */