1*353d8f4dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*353d8f4dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*353d8f4dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*353d8f4dSAndrew Rist * distributed with this work for additional information 6*353d8f4dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*353d8f4dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*353d8f4dSAndrew Rist * "License"); you may not use this file except in compliance 9*353d8f4dSAndrew Rist * with the License. You may obtain a copy of the License at 10*353d8f4dSAndrew Rist * 11*353d8f4dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*353d8f4dSAndrew Rist * 13*353d8f4dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*353d8f4dSAndrew Rist * software distributed under the License is distributed on an 15*353d8f4dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*353d8f4dSAndrew Rist * KIND, either express or implied. See the License for the 17*353d8f4dSAndrew Rist * specific language governing permissions and limitations 18*353d8f4dSAndrew Rist * under the License. 19*353d8f4dSAndrew Rist * 20*353d8f4dSAndrew Rist *************************************************************/ 21*353d8f4dSAndrew Rist 22*353d8f4dSAndrew Rist 23cdf0e10cSrcweir #ifndef INCLUDED_SFX_MAILMODEL_HXX 24cdf0e10cSrcweir #define INCLUDED_SFX_MAILMODEL_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <vector> 27cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 28cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp> 29cdf0e10cSrcweir #include "tools/link.hxx" 30cdf0e10cSrcweir #include <tools/string.hxx> 31cdf0e10cSrcweir #include "sfx2/dllapi.h" 32cdf0e10cSrcweir 33cdf0e10cSrcweir // class SfxMailModel_Impl ----------------------------------------------- 34cdf0e10cSrcweir 35cdf0e10cSrcweir class AddressList_Impl; 36cdf0e10cSrcweir 37cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxMailModel 38cdf0e10cSrcweir { 39cdf0e10cSrcweir public: 40cdf0e10cSrcweir enum MailPriority 41cdf0e10cSrcweir { 42cdf0e10cSrcweir PRIO_HIGHEST, 43cdf0e10cSrcweir PRIO_HIGH, 44cdf0e10cSrcweir PRIO_NORMAL, 45cdf0e10cSrcweir PRIO_LOW, 46cdf0e10cSrcweir PRIO_LOWEST 47cdf0e10cSrcweir }; 48cdf0e10cSrcweir 49cdf0e10cSrcweir enum AddressRole 50cdf0e10cSrcweir { 51cdf0e10cSrcweir ROLE_TO, 52cdf0e10cSrcweir ROLE_CC, 53cdf0e10cSrcweir ROLE_BCC 54cdf0e10cSrcweir }; 55cdf0e10cSrcweir 56cdf0e10cSrcweir enum MailDocType 57cdf0e10cSrcweir { 58cdf0e10cSrcweir TYPE_SELF, 59cdf0e10cSrcweir TYPE_ASPDF 60cdf0e10cSrcweir }; 61cdf0e10cSrcweir 62cdf0e10cSrcweir private: 63cdf0e10cSrcweir enum SaveResult 64cdf0e10cSrcweir { 65cdf0e10cSrcweir SAVE_SUCCESSFULL, 66cdf0e10cSrcweir SAVE_CANCELLED, 67cdf0e10cSrcweir SAVE_ERROR 68cdf0e10cSrcweir }; 69cdf0e10cSrcweir 70cdf0e10cSrcweir ::std::vector< ::rtl::OUString > maAttachedDocuments; 71cdf0e10cSrcweir AddressList_Impl* mpToList; 72cdf0e10cSrcweir AddressList_Impl* mpCcList; 73cdf0e10cSrcweir AddressList_Impl* mpBccList; 74cdf0e10cSrcweir String maFromAddress; 75cdf0e10cSrcweir String maSubject; 76cdf0e10cSrcweir MailPriority mePriority; 77cdf0e10cSrcweir 78cdf0e10cSrcweir sal_Bool mbLoadDone; 79cdf0e10cSrcweir 80cdf0e10cSrcweir void ClearList( AddressList_Impl* pList ); 81cdf0e10cSrcweir void MakeValueList( AddressList_Impl* pList, String& rValueList ); 82cdf0e10cSrcweir SaveResult SaveDocumentAsFormat( const rtl::OUString& aSaveFileName, 83cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel, 84cdf0e10cSrcweir const rtl::OUString& rType, 85cdf0e10cSrcweir rtl::OUString& rFileNamePath ); 86cdf0e10cSrcweir SaveResult ShowFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR, 87cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel, 88cdf0e10cSrcweir const ::rtl::OUString& rFilterName, 89cdf0e10cSrcweir const ::rtl::OUString& rType, 90cdf0e10cSrcweir bool bModified, 91cdf0e10cSrcweir sal_Int32& rNumArgs, 92cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir DECL_LINK( DoneHdl, void* ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir public: 97cdf0e10cSrcweir enum SendMailResult 98cdf0e10cSrcweir { 99cdf0e10cSrcweir SEND_MAIL_OK, 100cdf0e10cSrcweir SEND_MAIL_CANCELLED, 101cdf0e10cSrcweir SEND_MAIL_ERROR 102cdf0e10cSrcweir }; 103cdf0e10cSrcweir 104cdf0e10cSrcweir SfxMailModel(); 105cdf0e10cSrcweir ~SfxMailModel(); 106cdf0e10cSrcweir 107cdf0e10cSrcweir void AddAddress( const String& rAddress, AddressRole eRole ); SetFromAddress(const String & rAddress)108cdf0e10cSrcweir void SetFromAddress( const String& rAddress ) { maFromAddress = rAddress; } SetSubject(const String & rSubject)109cdf0e10cSrcweir void SetSubject( const String& rSubject ) { maSubject = rSubject; } SetPriority(MailPriority ePrio)110cdf0e10cSrcweir void SetPriority( MailPriority ePrio ) { mePriority = ePrio; } 111cdf0e10cSrcweir 112cdf0e10cSrcweir /** attaches a document to the current attachment list, can be called more than once. 113cdf0e10cSrcweir * at the moment there will be a dialog for export executed for every model which is going to be attached. 114cdf0e10cSrcweir * 115cdf0e10cSrcweir * \param sDocumentType 116cdf0e10cSrcweir The doc type to export. PDF will be at the moment only a direct export (no dialog). 117cdf0e10cSrcweir * \param xModel 118cdf0e10cSrcweir The current model to attach 119cdf0e10cSrcweir * \param sAttachmentTitle 120cdf0e10cSrcweir The title which will be used as attachment title 121cdf0e10cSrcweir * \return @see error code 122cdf0e10cSrcweir */ 123cdf0e10cSrcweir SendMailResult AttachDocument( const ::rtl::OUString& sDocumentType, 124cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel, 125cdf0e10cSrcweir const ::rtl::OUString& sAttachmentTitle ); 126cdf0e10cSrcweir 127cdf0e10cSrcweir SendMailResult SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, 128cdf0e10cSrcweir const rtl::OUString& rType ); 129cdf0e10cSrcweir SendMailResult Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir sal_Int32 GetCount() const; 132cdf0e10cSrcweir sal_Bool IsEmpty() const; 133cdf0e10cSrcweir }; 134cdf0e10cSrcweir 135cdf0e10cSrcweir sal_Bool CreateFromAddress_Impl( String& rFrom ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir #endif // INCLUDED_SFX_MAILMODEL_HXX 138