1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_SW_SOURCE_UIBASE_INC_UNOMAILMERGE_HXX
21 #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOMAILMERGE_HXX
23 #include <cppuhelper/implbase.hxx>
24 #include <cppuhelper/interfacecontainer.hxx>
25 #include <comphelper/interfacecontainer2.hxx>
27 #include <com/sun/star/task/XJob.hpp>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/lang/XComponent.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
32 #include <com/sun/star/text/XMailMergeBroadcaster.hpp>
33 #include <com/sun/star/util/XCancellable.hpp>
34 #include <svl/itemprop.hxx>
35 #include <sfx2/objsh.hxx>
37 namespace com::sun::star
{
47 class XMultiServiceFactory
;
50 class XMailMergeListener
;
51 struct MailMergeEvent
;
59 typedef cppu::OMultiTypeInterfaceContainerHelperVar
<sal_Int32
>
60 OPropertyListenerContainerHelper
;
63 class MailMergeExecuteFinalizer
;
66 public cppu::WeakImplHelper
69 css::util::XCancellable
,
70 css::beans::XPropertySet
,
71 css::text::XMailMergeBroadcaster
,
72 css::lang::XComponent
,
73 css::lang::XServiceInfo
76 friend class MailMergeExecuteFinalizer
;
78 comphelper::OInterfaceContainerHelper2 m_aEvtListeners
;
79 comphelper::OInterfaceContainerHelper2 m_aMergeListeners
;
80 OPropertyListenerContainerHelper m_aPropListeners
;
82 const SfxItemPropertySet
* m_pPropSet
;
84 SfxObjectShellRef m_xDocSh
; // the document
86 OUString m_aTmpFileName
;
88 // properties of mail merge service
89 css::uno::Sequence
< css::uno::Any
> m_aSelection
;
90 css::uno::Reference
< css::sdbc::XResultSet
> m_xResultSet
;
91 css::uno::Reference
< css::sdbc::XConnection
> m_xConnection
;
92 css::uno::Reference
< css::frame::XModel
> m_xModel
;
93 OUString m_aDataSourceName
;
94 OUString m_aDataCommand
;
96 OUString m_aDocumentURL
;
97 OUString m_aOutputURL
;
98 OUString m_aFileNamePrefix
;
99 sal_Int32 m_nDataCommandType
;
100 sal_Int16 m_nOutputType
;
101 bool m_bEscapeProcessing
;
102 bool m_bSinglePrintJobs
;
103 bool m_bFileNameFromColumn
;
105 OUString m_sInServerPassword
;
106 OUString m_sOutServerPassword
;
108 OUString m_sAddressFromColumn
;
109 OUString m_sMailBody
;
110 OUString m_sAttachmentName
;
111 OUString m_sAttachmentFilter
;
112 css::uno::Sequence
< OUString
> m_aCopiesTo
;
113 css::uno::Sequence
< OUString
> m_aBlindCopiesTo
;
115 bool m_bSendAsAttachment
;
117 css::uno::Sequence
< css::beans::PropertyValue
> m_aPrintSettings
;
119 bool m_bSaveAsSingleFile
;
120 OUString m_sSaveFilter
;
121 OUString m_sSaveFilterOptions
;
122 css::uno::Sequence
< css::beans::PropertyValue
> m_aSaveFilterData
;
127 void launchEvent( const css::beans::PropertyChangeEvent
&rEvt
) const;
129 SwXMailMerge( const SwXMailMerge
& ) = delete;
130 SwXMailMerge
& operator = ( const SwXMailMerge
& ) = delete;
132 virtual ~SwXMailMerge() override
;
136 void LaunchMailMergeEvent( const css::text::MailMergeEvent
&rData
) const;
139 virtual css::uno::Any SAL_CALL
execute( const css::uno::Sequence
< css::beans::NamedValue
>& Arguments
) override
;
142 virtual void SAL_CALL
cancel() override
;
145 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
146 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
147 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
148 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
149 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
150 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
151 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
153 // XMailMergeBroadcaster
154 virtual void SAL_CALL
addMailMergeEventListener( const css::uno::Reference
< css::text::XMailMergeListener
>& xListener
) override
;
155 virtual void SAL_CALL
removeMailMergeEventListener( const css::uno::Reference
< css::text::XMailMergeListener
>& xListener
) override
;
158 virtual void SAL_CALL
dispose( ) override
;
159 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
160 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
163 virtual OUString SAL_CALL
getImplementationName( ) override
;
164 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
165 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */