1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unomailmerge.hxx,v $
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_
35 #include <cppuhelper/implbase5.hxx> // WeakImplHelper4
36 #include <cppuhelper/interfacecontainer.hxx> // OMultiTypeInterfaceContainerHelperVar
37 #include <unotools/configitem.hxx> // !! needed for OMultiTypeInterfaceContainerHelperVar !!
40 #include <com/sun/star/task/XJob.hpp>
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 #include <com/sun/star/lang/XComponent.hpp>
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
45 #include <com/sun/star/text/XMailMergeBroadcaster.hpp>
46 #include <svtools/itemprop.hxx>
47 #include <sfx2/objsh.hxx> // SfxObjectShellRef
51 namespace com
{ namespace sun
{ namespace star
{
61 class XMultiServiceFactory
;
64 class XMailMergeListener
;
65 struct MailMergeEvent
;
77 ///////////////////////////////////////////////////////////////////////////
79 // uses templates from <cppuhelper/interfacecontainer.h>
80 // and <unotools/configitem.hxx>
82 // helper function call class
83 struct PropHashType_Impl
85 size_t operator()(const INT32
&s
) const { return s
; }
88 typedef cppu::OMultiTypeInterfaceContainerHelperVar
92 std::equal_to
< INT32
>
93 > OPropertyListenerContainerHelper
;
95 ////////////////////////////////////////////////////////////
98 public cppu::WeakImplHelper5
100 com::sun::star::task::XJob
,
101 com::sun::star::beans::XPropertySet
,
102 com::sun::star::text::XMailMergeBroadcaster
,
103 com::sun::star::lang::XComponent
,
104 com::sun::star::lang::XServiceInfo
107 cppu::OInterfaceContainerHelper aEvtListeners
;
108 cppu::OInterfaceContainerHelper aMergeListeners
;
109 OPropertyListenerContainerHelper aPropListeners
;
111 //SfxItemPropertySet aPropSet;
112 const SfxItemPropertySet
* pPropSet
;
114 SfxObjectShellRef xDocSh
; // the document
118 // properties of mail merge service
119 com::sun::star::uno::Sequence
< com::sun::star::uno::Any
> aSelection
;
120 com::sun::star::uno::Reference
< com::sun::star::sdbc::XResultSet
> xResultSet
;
121 com::sun::star::uno::Reference
< com::sun::star::sdbc::XConnection
> xConnection
;
122 com::sun::star::uno::Reference
< com::sun::star::frame::XModel
> xModel
;
123 rtl::OUString aDataSourceName
;
124 rtl::OUString aDataCommand
;
125 rtl::OUString aFilter
;
126 rtl::OUString aDocumentURL
;
127 rtl::OUString aOutputURL
;
128 rtl::OUString aFileNamePrefix
;
129 sal_Int32 nDataCommandType
;
130 sal_Int16 nOutputType
;
131 sal_Bool bEscapeProcessing
;
132 sal_Bool bSinglePrintJobs
;
133 sal_Bool bFileNameFromColumn
;
136 ::rtl::OUString sInServerPassword
;
137 ::rtl::OUString sOutServerPassword
;
138 ::rtl::OUString sSubject
;
139 ::rtl::OUString sAddressFromColumn
;
140 ::rtl::OUString sMailBody
;
141 ::rtl::OUString sAttachmentName
;
142 ::rtl::OUString sAttachmentFilter
;
143 com::sun::star::uno::Sequence
< ::rtl::OUString
> aCopiesTo
;
144 com::sun::star::uno::Sequence
< ::rtl::OUString
> aBlindCopiesTo
;
145 sal_Bool bSendAsHTML
;
146 sal_Bool bSendAsAttachment
;
148 com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> aPrintSettings
;
150 sal_Bool bSaveAsSingleFile
;
151 ::rtl::OUString sSaveFilter
;
152 ::rtl::OUString sSaveFilterOptions
;
153 com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> aSaveFilterData
;
160 void launchEvent( const com::sun::star::beans::PropertyChangeEvent
&rEvt
) const;
162 // disallow use of copy-constructor and assignment-operator for now
163 SwXMailMerge( const SwXMailMerge
& );
164 SwXMailMerge
& operator = ( const SwXMailMerge
& );
166 virtual ~SwXMailMerge();
171 void LaunchMailMergeEvent( const com::sun::star::text::MailMergeEvent
&rData
) const;
174 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
);
177 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException
);
178 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
);
179 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
);
180 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
);
181 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
);
182 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
);
183 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
);
185 // XMailMergeBroadcaster
186 virtual void SAL_CALL
addMailMergeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::text::XMailMergeListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
187 virtual void SAL_CALL
removeMailMergeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::text::XMailMergeListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
190 virtual void SAL_CALL
dispose( ) throw (::com::sun::star::uno::RuntimeException
);
191 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
192 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
195 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
);
196 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
197 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
);
201 extern com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
SwXMailMerge_getSupportedServiceNames() throw();
202 extern rtl::OUString SAL_CALL
SwXMailMerge_getImplementationName() throw();
203 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
);
205 ////////////////////////////////////////////////////////////