Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / sfx2 / mailmodelapi.hxx
blobba8285e80bd55beb4f6941ad5c66f19fd365a234
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_SFX2_MAILMODELAPI_HXX
20 #define INCLUDED_SFX2_MAILMODELAPI_HXX
22 #include <com/sun/star/frame/XFrame.hpp>
23 #include <com/sun/star/frame/XModel.hpp>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <rtl/ustring.hxx>
26 #include <sfx2/dllapi.h>
27 #include <tools/link.hxx>
28 #include <vector>
30 // class AddressList_Impl ------------------------------------------------
31 typedef ::std::vector< OUString > 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 static SaveResult SaveDocumentAsFormat( const OUString& aSaveFileName,
69 const css::uno::Reference< css::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 OUString maFromAddress;
78 OUString maSubject;
80 static SaveResult ShowFilterOptionsDialog( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR,
81 const css::uno::Reference< css::frame::XModel >& xModel,
82 const OUString& rFilterName,
83 const OUString& rType,
84 bool bModified,
85 sal_Int32& rNumArgs,
86 css::uno::Sequence< css::beans::PropertyValue >& rArgs );
88 public:
89 enum SendMailResult
91 SEND_MAIL_OK,
92 SEND_MAIL_CANCELLED,
93 SEND_MAIL_ERROR
96 SfxMailModel();
97 ~SfxMailModel();
99 void AddAddress( const OUString& rAddress, AddressRole eRole );
100 void SetSubject( const OUString& rSubject ) { maSubject = rSubject; }
102 /** attaches a document to the current attachment list, can be called more than once.
103 * at the moment there will be a dialog for export executed for every model which is going to be attached.
105 * \param sDocumentType
106 The doc type to export. PDF will be at the moment only a direct export (no dialog).
107 * \param xModel
108 The current model to attach
109 * \param sAttachmentTitle
110 The title which will be used as attachment title
111 * \return @see error code
113 SendMailResult AttachDocument( const OUString& sDocumentType,
114 const css::uno::Reference< css::uno::XInterface >& xFrameOrModel,
115 const OUString& sAttachmentTitle );
117 SendMailResult SaveAndSend( const css::uno::Reference< css::frame::XFrame >& xFrame,
118 const OUString& rType );
119 SendMailResult Send( const css::uno::Reference< css::frame::XFrame >& xFrame );
121 bool IsEmpty() const;
124 bool CreateFromAddress_Impl( OUString& rFrom );
126 #endif // INCLUDED_SFX2_MAILMODELAPI_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */