LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/inc - mailmergehelper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 20 0.0 %
Date: 2012-12-27 Functions: 0 13 0.0 %
Legend: Lines: hit not hit

          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 _MAILMERGEHELPER_HXX
      20             : #define _MAILMERGEHELPER_HXX
      21             : 
      22             : #include <svtools/stdctrl.hxx>
      23             : #include <unotools/configitem.hxx>
      24             : #include <com/sun/star/uno/Sequence.h>
      25             : #include "com/sun/star/mail/XAuthenticator.hpp"
      26             : #include "com/sun/star/mail/XConnectionListener.hpp"
      27             : #include "com/sun/star/uno/XCurrentContext.hpp"
      28             : #include "com/sun/star/mail/XMailMessage.hpp"
      29             : #include "com/sun/star/datatransfer/XTransferable.hpp"
      30             : #include <com/sun/star/beans/XPropertySet.hpp>
      31             : #include <cppuhelper/implbase1.hxx>
      32             : #include <cppuhelper/compbase1.hxx>
      33             : #include <cppuhelper/compbase2.hxx>
      34             : #include <vcl/scrbar.hxx>
      35             : #include "swdllapi.h"
      36             : 
      37             : class SwMailMergeConfigItem;
      38             : 
      39             : namespace com { namespace sun { namespace star { namespace mail {
      40             :     class XMailService;
      41             :     class XSmtpService;
      42             : } } } }
      43             : 
      44             : namespace SwMailMergeHelper
      45             : {
      46             :     SW_DLLPUBLIC String  CallSaveAsDialog(String& rFilter);
      47             :     SW_DLLPUBLIC bool    CheckMailAddress( const ::rtl::OUString& rMailAddress );
      48             :     SW_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::mail::XSmtpService >
      49             :                          ConnectToSmtpServer( SwMailMergeConfigItem& rConfigItem,
      50             :                             com::sun::star::uno::Reference< com::sun::star::mail::XMailService >&  xInMailService,
      51             :                             const String& rInMailServerPassword,
      52             :                             const String& rOutMailServerPassword,
      53             :                             Window* pDialogParentWindow = 0 );
      54             : }
      55             : 
      56             : class SW_DLLPUBLIC SwBoldFixedInfo : public FixedInfo
      57             : {
      58             : public:
      59             :     SwBoldFixedInfo(Window* pParent, const ResId& rResId);
      60             :     ~SwBoldFixedInfo();
      61             : };
      62             : struct SwAddressPreview_Impl;
      63             : 
      64             : /*-------------------------------------------------------------------------
      65             :     Preview window used to show the possible selection of address blocks
      66             :     and also the resulting address filled with database data
      67             :   -----------------------------------------------------------------------*/
      68             : class SW_DLLPUBLIC SwAddressPreview : public Window
      69             : {
      70             :     ScrollBar               aVScrollBar;
      71             :     SwAddressPreview_Impl*  pImpl;
      72             :     Link                    m_aSelectHdl;
      73             : 
      74             :     void DrawText_Impl( const ::rtl::OUString& rAddress, const Point& rTopLeft, const Size& rSize, bool bIsSelected);
      75             : 
      76             :     virtual void        Paint(const Rectangle&);
      77             :     virtual void        MouseButtonDown( const MouseEvent& rMEvt );
      78             :     virtual void        KeyInput( const KeyEvent& rKEvt );
      79             :     virtual void        StateChanged( StateChangedType nStateChange );
      80             :     void                UpdateScrollBar();
      81             : 
      82             :     DECL_LINK(ScrollHdl, void*);
      83             : 
      84             : public:
      85             :     SwAddressPreview(Window* pParent, const ResId rResId);
      86             :     ~SwAddressPreview();
      87             : 
      88             :     /** The address string is a list of address elements separated by spaces
      89             :     and breaks. The addresses fit into the given layout. If more addresses then
      90             :     rows/columns should be used a scrollbar will be added.
      91             : 
      92             :      AddAddress appends the new address to the already added ones.
      93             :      Initially the first added address will be selected
      94             :     */
      95             :     void                    AddAddress(const ::rtl::OUString& rAddress);
      96             :     //  for preview mode - replaces the currently used address by the given one
      97             :     void                    SetAddress(const ::rtl::OUString& rAddress);
      98             :     // removes all addresses
      99             :     void                    Clear();
     100             : 
     101             :     // returns the selected address
     102             :     sal_uInt16              GetSelectedAddress() const;
     103             :     void                    SelectAddress(sal_uInt16 nSelect);
     104             :     void                    ReplaceSelectedAddress(const ::rtl::OUString&);
     105             :     void                    RemoveSelectedAddress();
     106             : 
     107             :     // set the number of rows and columns of addresses
     108             :     void                    SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns);
     109             :     void                    EnableScrollBar(bool bEnable = true);
     110             : 
     111             :     // fill the actual data into a string (address block or greeting)
     112             :     static String FillData(
     113             :             const ::rtl::OUString& rAddress,
     114             :             SwMailMergeConfigItem& rConfigItem,
     115             :             const ::com::sun::star::uno::Sequence< ::rtl::OUString>* pAssignments = 0);
     116             : 
     117           0 :     void    SetSelectHdl (const Link& rLink) {m_aSelectHdl = rLink;}
     118             : };
     119             : 
     120             : /*-------------------------------------------------------------------------
     121             :     iterate over an address block or a greeting line
     122             :     the iterator returns the parts either as pure string
     123             :     or as column
     124             :   -----------------------------------------------------------------------*/
     125           0 : struct SwMergeAddressItem
     126             : {
     127             :     String  sText;
     128             :     bool    bIsColumn;
     129             :     bool    bIsReturn;
     130           0 :     SwMergeAddressItem() :
     131             :         bIsColumn(false),
     132           0 :         bIsReturn(false) {}
     133             : };
     134             : 
     135           0 : class SW_DLLPUBLIC   SwAddressIterator
     136             : {
     137             :     String sAddress;
     138             : public:
     139           0 :     SwAddressIterator(const String& rAddress) :
     140           0 :         sAddress(rAddress){}
     141             : 
     142             :     SwMergeAddressItem  Next();
     143           0 :     bool                HasMore() const{return sAddress.Len() > 0;}
     144             : };
     145             : 
     146             : class SW_DLLPUBLIC SwAuthenticator :
     147             :     public cppu::WeakImplHelper1< ::com::sun::star::mail::XAuthenticator>
     148             : {
     149             :     ::rtl::OUString m_aUserName;
     150             :     ::rtl::OUString m_aPassword;
     151             :     Window*         m_pParentWindow;
     152             : public:
     153           0 :     SwAuthenticator() : m_pParentWindow(0) {}
     154           0 :     SwAuthenticator(const ::rtl::OUString& username, const ::rtl::OUString& password, Window* pParent) :
     155             :         m_aUserName(username),
     156             :         m_aPassword(password),
     157           0 :         m_pParentWindow( pParent )
     158           0 :     {}
     159             :     ~SwAuthenticator();
     160             : 
     161             :     virtual ::rtl::OUString SAL_CALL getUserName( ) throw (::com::sun::star::uno::RuntimeException);
     162             :     virtual ::rtl::OUString SAL_CALL getPassword(  ) throw (::com::sun::star::uno::RuntimeException);
     163             : 
     164             : };
     165             : 
     166             : class SW_DLLPUBLIC SwConnectionContext :
     167             :     public cppu::WeakImplHelper1< ::com::sun::star::uno::XCurrentContext >
     168             : {
     169             :     ::rtl::OUString     m_sMailServer;
     170             :     sal_Int16           m_nPort;
     171             :     ::rtl::OUString     m_sConnectionType;
     172             : 
     173             : public:
     174             :     SwConnectionContext(const ::rtl::OUString& rMailServer, sal_Int16 nPort, const ::rtl::OUString& rConnectionType);
     175             :     ~SwConnectionContext();
     176             : 
     177             :     virtual ::com::sun::star::uno::Any SAL_CALL     getValueByName( const ::rtl::OUString& Name )
     178             :                                                             throw (::com::sun::star::uno::RuntimeException);
     179             : };
     180             : 
     181           0 : class SwMutexBase
     182             : {
     183             : public:
     184             :     osl::Mutex m_aMutex;
     185             : };
     186             : 
     187             : class SW_DLLPUBLIC SwConnectionListener :
     188             :         public SwMutexBase,
     189             :         public cppu::WeakComponentImplHelper1< ::com::sun::star::mail::XConnectionListener >
     190             : {
     191             :     using cppu::WeakComponentImplHelperBase::disposing;
     192             : 
     193             : public:
     194           0 :     SwConnectionListener() :
     195           0 :         cppu::WeakComponentImplHelper1< ::com::sun::star::mail::XConnectionListener>(m_aMutex)
     196           0 :     {}
     197             :     ~SwConnectionListener();
     198             : 
     199             :     virtual void SAL_CALL connected(const ::com::sun::star::lang::EventObject& aEvent)
     200             :         throw (::com::sun::star::uno::RuntimeException);
     201             : 
     202             :     virtual void SAL_CALL disconnected(const ::com::sun::star::lang::EventObject& aEvent)
     203             :         throw (::com::sun::star::uno::RuntimeException);
     204             : 
     205             :     virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject& aEvent)
     206             :         throw(com::sun::star::uno::RuntimeException);
     207             : };
     208             : 
     209             : class SwMailTransferable :
     210             :         public SwMutexBase,
     211             :         public cppu::WeakComponentImplHelper2
     212             :         <
     213             :             ::com::sun::star::datatransfer::XTransferable,
     214             :             ::com::sun::star::beans::XPropertySet
     215             :         >
     216             : {
     217             :     rtl::OUString  m_aMimeType;
     218             :     rtl::OUString  m_sBody;
     219             :     rtl::OUString  m_aURL;
     220             :     rtl::OUString  m_aName;
     221             :     bool           m_bIsBody;
     222             : 
     223             :     public:
     224             :     SwMailTransferable(const rtl::OUString& rURL, const rtl::OUString& rName, const rtl::OUString& rMimeType);
     225             :     SwMailTransferable(const rtl::OUString& rBody, const rtl::OUString& rMimeType);
     226             :     ~SwMailTransferable();
     227             :     virtual ::com::sun::star::uno::Any SAL_CALL
     228             :                         getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
     229             :                             throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
     230             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL
     231             :                         getTransferDataFlavors(  )
     232             :                             throw (::com::sun::star::uno::RuntimeException) ;
     233             :     virtual ::sal_Bool SAL_CALL
     234             :                         isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
     235             :                             throw (::com::sun::star::uno::RuntimeException);
     236             : 
     237             :     //XPropertySet
     238             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
     239             :     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     240             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     241             :     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     242             :     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     243             :     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     244             :     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     245             : 
     246             : };
     247             : 
     248             : class SwMailMessage :
     249             :         public SwMutexBase,
     250             :         public cppu::WeakComponentImplHelper1< ::com::sun::star::mail::XMailMessage >
     251             : {
     252             :     ::rtl::OUString                                                                         m_sSenderName;
     253             :     ::rtl::OUString                                                                         m_sSenderAddress;
     254             :     ::rtl::OUString                                                                         m_sReplyToAddress;
     255             :     ::rtl::OUString                                                                         m_sSubject;
     256             : 
     257             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable>        m_xBody;
     258             : //    ::com::sun::star::mail::MailMessageBody                                                 m_aBody;
     259             : 
     260             :     ::com::sun::star::uno::Sequence< ::rtl::OUString >                                      m_aRecipients;
     261             :     ::com::sun::star::uno::Sequence< ::rtl::OUString >                                      m_aCcRecipients;
     262             :     ::com::sun::star::uno::Sequence< ::rtl::OUString >                                      m_aBccRecipients;
     263             : //    ::com::sun::star::uno::Sequence< ::com::sun::star::mail::MailAttachmentDescriptor >     m_aAttachments;
     264             :     ::com::sun::star::uno::Sequence<  ::com::sun::star::mail::MailAttachment >              m_aAttachments;
     265             : public:
     266             :     SwMailMessage();
     267             :     ~SwMailMessage();
     268             : 
     269             :     // attributes
     270             :     virtual ::rtl::OUString SAL_CALL    getSenderName() throw (::com::sun::star::uno::RuntimeException);
     271             :     virtual ::rtl::OUString SAL_CALL    getSenderAddress() throw (::com::sun::star::uno::RuntimeException);
     272             :     virtual ::rtl::OUString SAL_CALL    getReplyToAddress() throw (::com::sun::star::uno::RuntimeException);
     273             :     virtual void SAL_CALL               setReplyToAddress( const ::rtl::OUString& _replytoaddress ) throw (::com::sun::star::uno::RuntimeException);
     274             :     virtual ::rtl::OUString SAL_CALL    getSubject() throw (::com::sun::star::uno::RuntimeException);
     275             :     virtual void SAL_CALL               setSubject( const ::rtl::OUString& _subject ) throw (::com::sun::star::uno::RuntimeException);
     276             : 
     277             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL
     278             :                                         getBody()
     279             :                                                 throw (::com::sun::star::uno::RuntimeException);
     280             :     virtual void SAL_CALL               setBody( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _body )
     281             :                                                 throw (::com::sun::star::uno::RuntimeException);
     282             : 
     283             :     // methods
     284             :     virtual void SAL_CALL               addRecipient( const ::rtl::OUString& sRecipientAddress ) throw (::com::sun::star::uno::RuntimeException);
     285             :     virtual void SAL_CALL               addCcRecipient( const ::rtl::OUString& sRecipientAddress ) throw (::com::sun::star::uno::RuntimeException);
     286             :     virtual void SAL_CALL               addBccRecipient( const ::rtl::OUString& sRecipientAddress ) throw (::com::sun::star::uno::RuntimeException);
     287             :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
     288             :                                         getRecipients(  ) throw (::com::sun::star::uno::RuntimeException);
     289             :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
     290             :                                         getCcRecipients(  ) throw (::com::sun::star::uno::RuntimeException);
     291             :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
     292             :                                         getBccRecipients(  ) throw (::com::sun::star::uno::RuntimeException);
     293             :     virtual void SAL_CALL               addAttachment( const ::com::sun::star::mail::MailAttachment& aMailAttachment )
     294             :                                             throw (::com::sun::star::uno::RuntimeException);
     295             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::mail::MailAttachment > SAL_CALL
     296             :                                         getAttachments(  ) throw (::com::sun::star::uno::RuntimeException);
     297           0 :     void                                SetSenderName(const ::rtl::OUString& rSenderName)
     298           0 :                                                 {m_sSenderName = rSenderName;}
     299           0 :     void                                SetSenderAddress(const ::rtl::OUString& rSenderAddress)
     300           0 :                                                 {m_sSenderAddress = rSenderAddress;}
     301             : };
     302             : 
     303             : #endif
     304             : 
     305             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10