update credits
[LibreOffice.git] / sw / source / ui / inc / unomailmerge.hxx
blobf6ec22f6337afadc1365f79d512e7922962bf47b
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 .
20 #ifndef _UNOMAILMERGE_HXX_
21 #define _UNOMAILMERGE_HXX_
23 #include <functional>
24 #include <cppuhelper/implbase5.hxx> // WeakImplHelper4
25 #include <cppuhelper/interfacecontainer.hxx> // OMultiTypeInterfaceContainerHelperVar
26 #include <unotools/configitem.hxx> // !! needed for OMultiTypeInterfaceContainerHelperVar !!
29 #include <com/sun/star/task/XJob.hpp>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <com/sun/star/lang/XComponent.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
34 #include <com/sun/star/text/XMailMergeBroadcaster.hpp>
35 #include <svl/itemprop.hxx>
36 #include <sfx2/objsh.hxx>
38 namespace com { namespace sun { namespace star {
40 namespace sdbc {
41 class XResultSet;
42 class XConnection;
44 namespace frame {
45 class XModel;
47 namespace lang {
48 class XMultiServiceFactory;
50 namespace text {
51 class XMailMergeListener;
52 struct MailMergeEvent;
54 namespace beans{
55 struct PropertyValue;
58 }}}
61 ///////////////////////////////////////////////////////////////////////////
63 // uses templates from <cppuhelper/interfacecontainer.h>
64 // and <unotools/configitem.hxx>
66 // helper function call class
67 struct PropHashType_Impl
69 size_t operator()(const sal_Int32 &s) const { return s; }
72 typedef cppu::OMultiTypeInterfaceContainerHelperVar
74 sal_Int32,
75 PropHashType_Impl,
76 std::equal_to< sal_Int32 >
77 > OPropertyListenerContainerHelper;
79 ////////////////////////////////////////////////////////////
81 class SwXMailMerge :
82 public cppu::WeakImplHelper5
84 com::sun::star::task::XJob,
85 com::sun::star::beans::XPropertySet,
86 com::sun::star::text::XMailMergeBroadcaster,
87 com::sun::star::lang::XComponent,
88 com::sun::star::lang::XServiceInfo
91 cppu::OInterfaceContainerHelper aEvtListeners;
92 cppu::OInterfaceContainerHelper aMergeListeners;
93 OPropertyListenerContainerHelper aPropListeners;
95 const SfxItemPropertySet* pPropSet;
97 SfxObjectShellRef xDocSh; // the document
99 String aTmpFileName;
101 // properties of mail merge service
102 com::sun::star::uno::Sequence< com::sun::star::uno::Any > aSelection;
103 com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSet > xResultSet;
104 com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > xConnection;
105 com::sun::star::uno::Reference< com::sun::star::frame::XModel > xModel;
106 OUString aDataSourceName;
107 OUString aDataCommand;
108 OUString aFilter;
109 OUString aDocumentURL;
110 OUString aOutputURL;
111 OUString aFileNamePrefix;
112 sal_Int32 nDataCommandType;
113 sal_Int16 nOutputType;
114 sal_Bool bEscapeProcessing;
115 sal_Bool bSinglePrintJobs;
116 sal_Bool bFileNameFromColumn;
119 OUString sInServerPassword;
120 OUString sOutServerPassword;
121 OUString sSubject;
122 OUString sAddressFromColumn;
123 OUString sMailBody;
124 OUString sAttachmentName;
125 OUString sAttachmentFilter;
126 com::sun::star::uno::Sequence< OUString > aCopiesTo;
127 com::sun::star::uno::Sequence< OUString > aBlindCopiesTo;
128 sal_Bool bSendAsHTML;
129 sal_Bool bSendAsAttachment;
131 com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aPrintSettings;
133 sal_Bool bSaveAsSingleFile;
134 OUString sSaveFilter;
135 OUString sSaveFilterOptions;
136 com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSaveFilterData;
140 sal_Bool bDisposing;
143 void launchEvent( const com::sun::star::beans::PropertyChangeEvent &rEvt ) const;
145 // disallow use of copy-constructor and assignment-operator for now
146 SwXMailMerge( const SwXMailMerge & );
147 SwXMailMerge & operator = ( const SwXMailMerge & );
148 protected:
149 virtual ~SwXMailMerge();
150 public:
151 SwXMailMerge();
154 void LaunchMailMergeEvent( const com::sun::star::text::MailMergeEvent &rData ) const;
156 // XJob
157 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);
159 // XPropertySet
160 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
161 virtual void SAL_CALL setPropertyValue( const 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);
162 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
163 virtual void SAL_CALL addPropertyChangeListener( const 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);
164 virtual void SAL_CALL removePropertyChangeListener( const 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);
165 virtual void SAL_CALL addVetoableChangeListener( const 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);
166 virtual void SAL_CALL removeVetoableChangeListener( const 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);
168 // XMailMergeBroadcaster
169 virtual void SAL_CALL addMailMergeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XMailMergeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
170 virtual void SAL_CALL removeMailMergeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XMailMergeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
172 // XComponent
173 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
174 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
175 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
177 // XServiceInfo
178 virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
179 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
180 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
184 extern com::sun::star::uno::Sequence< OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames() throw();
185 extern OUString SAL_CALL SwXMailMerge_getImplementationName() throw();
186 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 );
188 ////////////////////////////////////////////////////////////
190 #endif
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */