build fix
[LibreOffice.git] / include / sfx2 / mailmodelapi.hxx
blobb0591e8450454db2c35bcb7860ec8ed337b45433
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>
29 #include <memory>
31 // class AddressList_Impl ------------------------------------------------
32 typedef ::std::vector< OUString > AddressList_Impl;
34 // class SfxMailModel_Impl -----------------------------------------------
36 class SFX2_DLLPUBLIC SfxMailModel
38 protected:
39 enum SaveResult
41 SAVE_SUCCESSFULL,
42 SAVE_CANCELLED,
43 SAVE_ERROR
45 ::std::vector< OUString > maAttachedDocuments;
46 static SaveResult SaveDocumentAsFormat( const OUString& aSaveFileName,
47 const css::uno::Reference< css::uno::XInterface >& xFrameOrModel,
48 const OUString& rType,
49 OUString& rFileNamePath );
51 private:
52 std::unique_ptr<AddressList_Impl> mpToList;
53 std::unique_ptr<AddressList_Impl> mpCcList;
54 std::unique_ptr<AddressList_Impl> mpBccList;
55 OUString maFromAddress;
56 OUString maSubject;
58 static SaveResult ShowFilterOptionsDialog( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR,
59 const css::uno::Reference< css::frame::XModel >& xModel,
60 const OUString& rFilterName,
61 const OUString& rType,
62 bool bModified,
63 sal_Int32& rNumArgs,
64 css::uno::Sequence< css::beans::PropertyValue >& rArgs );
66 public:
67 enum SendMailResult
69 SEND_MAIL_OK,
70 SEND_MAIL_CANCELLED,
71 SEND_MAIL_ERROR
74 SfxMailModel();
75 ~SfxMailModel();
77 void AddToAddress( const OUString& rAddress );
78 void SetSubject( const OUString& rSubject ) { maSubject = rSubject; }
80 /** attaches a document to the current attachment list, can be called more than once.
81 * at the moment there will be a dialog for export executed for every model which is going to be attached.
83 * \param sDocumentType
84 The doc type to export. PDF will be at the moment only a direct export (no dialog).
85 * \param xModel
86 The current model to attach
87 * \param sAttachmentTitle
88 The title which will be used as attachment title
89 * \return @see error code
91 SendMailResult AttachDocument( const OUString& sDocumentType,
92 const css::uno::Reference< css::uno::XInterface >& xFrameOrModel,
93 const OUString& sAttachmentTitle );
95 SendMailResult SaveAndSend( const css::uno::Reference< css::frame::XFrame >& xFrame,
96 const OUString& rType );
97 SendMailResult Send( const css::uno::Reference< css::frame::XFrame >& xFrame );
99 bool IsEmpty() const;
102 bool CreateFromAddress_Impl( OUString& rFrom );
104 #endif // INCLUDED_SFX2_MAILMODELAPI_HXX
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */