1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10*1d2dbeb0SAndrew Rist * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1d2dbeb0SAndrew Rist * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19*1d2dbeb0SAndrew Rist * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _UNOMAILMERGE_HXX_ 25cdf0e10cSrcweir #define _UNOMAILMERGE_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <functional> 28cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> // WeakImplHelper4 29cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> // OMultiTypeInterfaceContainerHelperVar 30cdf0e10cSrcweir #include <unotools/configitem.hxx> // !! needed for OMultiTypeInterfaceContainerHelperVar !! 31cdf0e10cSrcweir 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <com/sun/star/task/XJob.hpp> 34cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 35cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 36cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 37cdf0e10cSrcweir #include <com/sun/star/beans/PropertyChangeEvent.hpp> 38cdf0e10cSrcweir #include <com/sun/star/text/XMailMergeBroadcaster.hpp> 39cdf0e10cSrcweir #include <svl/itemprop.hxx> 40cdf0e10cSrcweir #include <sfx2/objsh.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <functional> 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace com { namespace sun { namespace star { 45cdf0e10cSrcweir 46cdf0e10cSrcweir namespace sdbc { 47cdf0e10cSrcweir class XResultSet; 48cdf0e10cSrcweir class XConnection; 49cdf0e10cSrcweir } 50cdf0e10cSrcweir namespace frame { 51cdf0e10cSrcweir class XModel; 52cdf0e10cSrcweir } 53cdf0e10cSrcweir namespace lang { 54cdf0e10cSrcweir class XMultiServiceFactory; 55cdf0e10cSrcweir } 56cdf0e10cSrcweir namespace text { 57cdf0e10cSrcweir class XMailMergeListener; 58cdf0e10cSrcweir struct MailMergeEvent; 59cdf0e10cSrcweir } 60cdf0e10cSrcweir namespace beans{ 61cdf0e10cSrcweir struct PropertyValue; 62cdf0e10cSrcweir } 63cdf0e10cSrcweir 64cdf0e10cSrcweir }}} 65cdf0e10cSrcweir 66cdf0e10cSrcweir namespace rtl { 67cdf0e10cSrcweir class OUString; 68cdf0e10cSrcweir } 69cdf0e10cSrcweir 70cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 71cdf0e10cSrcweir 72cdf0e10cSrcweir // uses templates from <cppuhelper/interfacecontainer.h> 73cdf0e10cSrcweir // and <unotools/configitem.hxx> 74cdf0e10cSrcweir 75cdf0e10cSrcweir // helper function call class 76cdf0e10cSrcweir struct PropHashType_Impl 77cdf0e10cSrcweir { operator ()PropHashType_Impl78cdf0e10cSrcweir size_t operator()(const sal_Int32 &s) const { return s; } 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir 81cdf0e10cSrcweir typedef cppu::OMultiTypeInterfaceContainerHelperVar 82cdf0e10cSrcweir < 83cdf0e10cSrcweir sal_Int32, 84cdf0e10cSrcweir PropHashType_Impl, 85cdf0e10cSrcweir std::equal_to< sal_Int32 > 86cdf0e10cSrcweir > OPropertyListenerContainerHelper; 87cdf0e10cSrcweir 88cdf0e10cSrcweir //////////////////////////////////////////////////////////// 89cdf0e10cSrcweir 90cdf0e10cSrcweir class SwXMailMerge : 91cdf0e10cSrcweir public cppu::WeakImplHelper5 92cdf0e10cSrcweir < 93cdf0e10cSrcweir com::sun::star::task::XJob, 94cdf0e10cSrcweir com::sun::star::beans::XPropertySet, 95cdf0e10cSrcweir com::sun::star::text::XMailMergeBroadcaster, 96cdf0e10cSrcweir com::sun::star::lang::XComponent, 97cdf0e10cSrcweir com::sun::star::lang::XServiceInfo 98cdf0e10cSrcweir > 99cdf0e10cSrcweir { 100cdf0e10cSrcweir cppu::OInterfaceContainerHelper aEvtListeners; 101cdf0e10cSrcweir cppu::OInterfaceContainerHelper aMergeListeners; 102cdf0e10cSrcweir OPropertyListenerContainerHelper aPropListeners; 103cdf0e10cSrcweir 104cdf0e10cSrcweir //SfxItemPropertySet aPropSet; 105cdf0e10cSrcweir const SfxItemPropertySet* pPropSet; 106cdf0e10cSrcweir 107cdf0e10cSrcweir SfxObjectShellRef xDocSh; // the document 108cdf0e10cSrcweir 109cdf0e10cSrcweir String aTmpFileName; 110cdf0e10cSrcweir 111cdf0e10cSrcweir // properties of mail merge service 112cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Any > aSelection; 113cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSet > xResultSet; 114cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > xConnection; 115cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::frame::XModel > xModel; 116cdf0e10cSrcweir rtl::OUString aDataSourceName; 117cdf0e10cSrcweir rtl::OUString aDataCommand; 118cdf0e10cSrcweir rtl::OUString aFilter; 119cdf0e10cSrcweir rtl::OUString aDocumentURL; 120cdf0e10cSrcweir rtl::OUString aOutputURL; 121cdf0e10cSrcweir rtl::OUString aFileNamePrefix; 122cdf0e10cSrcweir sal_Int32 nDataCommandType; 123cdf0e10cSrcweir sal_Int16 nOutputType; 124cdf0e10cSrcweir sal_Bool bEscapeProcessing; 125cdf0e10cSrcweir sal_Bool bSinglePrintJobs; 126cdf0e10cSrcweir sal_Bool bFileNameFromColumn; 127cdf0e10cSrcweir 128cdf0e10cSrcweir 129cdf0e10cSrcweir ::rtl::OUString sInServerPassword; 130cdf0e10cSrcweir ::rtl::OUString sOutServerPassword; 131cdf0e10cSrcweir ::rtl::OUString sSubject; 132cdf0e10cSrcweir ::rtl::OUString sAddressFromColumn; 133cdf0e10cSrcweir ::rtl::OUString sMailBody; 134cdf0e10cSrcweir ::rtl::OUString sAttachmentName; 135cdf0e10cSrcweir ::rtl::OUString sAttachmentFilter; 136cdf0e10cSrcweir com::sun::star::uno::Sequence< ::rtl::OUString > aCopiesTo; 137cdf0e10cSrcweir com::sun::star::uno::Sequence< ::rtl::OUString > aBlindCopiesTo; 138cdf0e10cSrcweir sal_Bool bSendAsHTML; 139cdf0e10cSrcweir sal_Bool bSendAsAttachment; 140cdf0e10cSrcweir 141cdf0e10cSrcweir com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aPrintSettings; 142cdf0e10cSrcweir 143cdf0e10cSrcweir sal_Bool bSaveAsSingleFile; 144cdf0e10cSrcweir ::rtl::OUString sSaveFilter; 145cdf0e10cSrcweir ::rtl::OUString sSaveFilterOptions; 146cdf0e10cSrcweir com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSaveFilterData; 147cdf0e10cSrcweir 148cdf0e10cSrcweir 149cdf0e10cSrcweir 150cdf0e10cSrcweir sal_Bool bDisposing; 151cdf0e10cSrcweir 152cdf0e10cSrcweir 153cdf0e10cSrcweir void launchEvent( const com::sun::star::beans::PropertyChangeEvent &rEvt ) const; 154cdf0e10cSrcweir 155cdf0e10cSrcweir // disallow use of copy-constructor and assignment-operator for now 156cdf0e10cSrcweir SwXMailMerge( const SwXMailMerge & ); 157cdf0e10cSrcweir SwXMailMerge & operator = ( const SwXMailMerge & ); 158cdf0e10cSrcweir protected: 159cdf0e10cSrcweir virtual ~SwXMailMerge(); 160cdf0e10cSrcweir public: 161cdf0e10cSrcweir SwXMailMerge(); 162cdf0e10cSrcweir 163cdf0e10cSrcweir 164cdf0e10cSrcweir void LaunchMailMergeEvent( const com::sun::star::text::MailMergeEvent &rData ) const; 165cdf0e10cSrcweir 166cdf0e10cSrcweir // XJob 167cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 168cdf0e10cSrcweir 169cdf0e10cSrcweir // XPropertySet 170cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException); 171cdf0e10cSrcweir 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); 172cdf0e10cSrcweir 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); 173cdf0e10cSrcweir 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); 174cdf0e10cSrcweir 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); 175cdf0e10cSrcweir 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); 176cdf0e10cSrcweir 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); 177cdf0e10cSrcweir 178cdf0e10cSrcweir // XMailMergeBroadcaster 179cdf0e10cSrcweir virtual void SAL_CALL addMailMergeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XMailMergeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 180cdf0e10cSrcweir virtual void SAL_CALL removeMailMergeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XMailMergeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 181cdf0e10cSrcweir 182cdf0e10cSrcweir // XComponent 183cdf0e10cSrcweir virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); 184cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 185cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 186cdf0e10cSrcweir 187cdf0e10cSrcweir // XServiceInfo 188cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 189cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 190cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 191cdf0e10cSrcweir }; 192cdf0e10cSrcweir 193cdf0e10cSrcweir 194cdf0e10cSrcweir extern com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames() throw(); 195cdf0e10cSrcweir extern rtl::OUString SAL_CALL SwXMailMerge_getImplementationName() throw(); 196cdf0e10cSrcweir extern com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SwXMailMerge_createInstance(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( com::sun::star::uno::Exception ); 197cdf0e10cSrcweir 198cdf0e10cSrcweir //////////////////////////////////////////////////////////// 199cdf0e10cSrcweir 200cdf0e10cSrcweir #endif 201cdf0e10cSrcweir 202cdf0e10cSrcweir 203