Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sw / unomailmerge.hxx
blob4533bcc654544376dd61e82622bf879c59dfc0bf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unomailmerge.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _UNOMAILMERGE_HXX_
32 #define _UNOMAILMERGE_HXX_
34 #ifndef _CPPUHELPER_IMPLBASE5_HXX_
35 #include <cppuhelper/implbase5.hxx> // WeakImplHelper4
36 #endif
37 #ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
38 #include <cppuhelper/interfacecontainer.hxx> // OMultiTypeInterfaceContainerHelperVar
39 #endif
40 #ifndef _UTL_CONFIGITEM_HXX_
41 #include <unotools/configitem.hxx> // !! needed for OMultiTypeInterfaceContainerHelperVar !!
42 #endif
45 #ifndef _COM_SUN_STAR_TASK_XJOB_HPP_
46 #include <com/sun/star/task/XJob.hpp>
47 #endif
48 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
49 #include <com/sun/star/beans/XPropertySet.hpp>
50 #endif
51 #ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
52 #include <com/sun/star/lang/XComponent.hpp>
53 #endif
54 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
55 #include <com/sun/star/lang/XServiceInfo.hpp>
56 #endif
57 #ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
58 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
59 #endif
60 #ifndef _COM_SUN_STAR_TEXT_XMAILMERGEBROADCASTER_HPP_
61 #include <com/sun/star/text/XMailMergeBroadcaster.hpp>
62 #endif
64 #ifndef _SFX_ITEMPROP_HXX
65 #include <bf_svtools/itemprop.hxx>
66 #endif
67 #ifndef _SFX_OBJSH_HXX
68 #include <bf_sfx2/objsh.hxx> // SfxObjectShellRef
69 #endif
70 namespace com { namespace sun { namespace star { namespace sdbc {
71 class XResultSet;
72 class XConnection;
73 }}}}
75 namespace com { namespace sun { namespace star { namespace frame {
76 class XModel;
77 }}}}
79 namespace com { namespace sun { namespace star { namespace lang {
80 class XMultiServiceFactory;
81 }}}}
83 namespace com { namespace sun { namespace star { namespace text {
84 class XMailMergeListener;
85 struct MailMergeEvent;
86 }}}}
88 namespace rtl {
89 class OUString;
91 namespace binfilter {
93 //STRIP008 namespace com { namespace sun { namespace star { namespace sdbc {
94 //STRIP008 class XResultSet;
95 //STRIP008 class XConnection;
96 //STRIP008 }}}}
97 //STRIP008
98 //STRIP008 namespace com { namespace sun { namespace star { namespace frame {
99 //STRIP008 class XModel;
100 //STRIP008 }}}}
101 //STRIP008
102 //STRIP008 namespace com { namespace sun { namespace star { namespace lang {
103 //STRIP008 class XMultiServiceFactory;
104 //STRIP008 }}}}
105 //STRIP008
106 //STRIP008 namespace com { namespace sun { namespace star { namespace text {
107 //STRIP008 class XMailMergeListener;
108 //STRIP008 struct MailMergeEvent;
109 //STRIP008 }}}}
110 //STRIP008
111 //STRIP008 namespace rtl {
112 //STRIP008 class OUString;
113 //STRIP008 }
115 ///////////////////////////////////////////////////////////////////////////
117 // uses templates from <cppuhelper/interfacecontainer.h>
118 // and <unotools/configitem.hxx>
120 // helper function call class
121 struct PropHashType_Impl
123 size_t operator()(const INT32 &s) const { return s; }
126 typedef cppu::OMultiTypeInterfaceContainerHelperVar
128 INT32,
129 PropHashType_Impl,
130 std::equal_to< INT32 >
131 > OPropertyListenerContainerHelper;
133 ////////////////////////////////////////////////////////////
135 class SwXMailMerge :
136 public cppu::WeakImplHelper5
138 ::com::sun::star::task::XJob,
139 ::com::sun::star::beans::XPropertySet,
140 ::com::sun::star::text::XMailMergeBroadcaster,
141 ::com::sun::star::lang::XComponent,
142 ::com::sun::star::lang::XServiceInfo
145 cppu::OInterfaceContainerHelper aEvtListeners;
146 cppu::OInterfaceContainerHelper aMergeListeners;
147 OPropertyListenerContainerHelper aPropListeners;
149 //SfxItemPropertySet aPropSet;
150 const SfxItemPropertyMap* pMap;
152 SfxObjectShellRef xDocSh; // the document
154 String aTmpFileName;
156 // properties of mail merge service
157 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSelection;
158 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet;
159 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > xConnection;
160 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel;
161 ::rtl::OUString aDataSourceName;
162 ::rtl::OUString aDataCommand;
163 ::rtl::OUString aFilter;
164 ::rtl::OUString aDocumentURL;
165 ::rtl::OUString aOutputURL;
166 ::rtl::OUString aFileNamePrefix;
167 sal_Int32 nDataCommandType;
168 sal_Int16 nOutputType;
169 sal_Bool bEscapeProcessing;
170 sal_Bool bSinglePrintJobs;
171 sal_Bool bFileNameFromColumn;
173 sal_Bool bDisposing;
176 void launchEvent( const ::com::sun::star::beans::PropertyChangeEvent &rEvt ) const;
178 // disallow use of copy-constructor and assignment-operator for now
179 SwXMailMerge( const SwXMailMerge & );
180 SwXMailMerge & operator = ( const SwXMailMerge & );
181 protected:
182 virtual ~SwXMailMerge();
183 public:
184 SwXMailMerge();
187 void LaunchMailMergeEvent( const ::com::sun::star::text::MailMergeEvent &rData ) const;
189 // XJob
190 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);
192 // XPropertySet
193 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
194 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);
195 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);
196 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);
197 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);
198 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);
199 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);
201 // XMailMergeBroadcaster
202 virtual void SAL_CALL addMailMergeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XMailMergeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
203 virtual void SAL_CALL removeMailMergeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XMailMergeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
205 // XComponent
206 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
207 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
208 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
210 // XServiceInfo
211 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
212 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
213 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
217 extern ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames() throw();
218 extern ::rtl::OUString SAL_CALL SwXMailMerge_getImplementationName() throw();
219 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 );
221 ////////////////////////////////////////////////////////////
223 } //namespace binfilter
224 #endif