Revert "tdf#158280 Replace usage of InputDialog with SvxNameDialog"
[LibreOffice.git] / sw / source / uibase / inc / unomailmerge.hxx
blob35200f837b794a3c9d35710894411e26905aa57d
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 INCLUDED_SW_SOURCE_UIBASE_INC_UNOMAILMERGE_HXX
21 #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOMAILMERGE_HXX
23 #include <cppuhelper/implbase.hxx>
24 #include <comphelper/interfacecontainer2.hxx>
25 #include <comphelper/interfacecontainer3.hxx>
26 #include <comphelper/multiinterfacecontainer3.hxx>
28 #include <com/sun/star/task/XJob.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/lang/XComponent.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
33 #include <com/sun/star/text/XMailMergeBroadcaster.hpp>
34 #include <com/sun/star/util/XCancellable.hpp>
35 #include <svl/itemprop.hxx>
36 #include <sfx2/objsh.hxx>
38 namespace com::sun::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;
60 typedef comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XPropertyChangeListener, sal_Int32>
61 OPropertyListenerContainerHelper;
63 class SwDBManager;
64 class MailMergeExecuteFinalizer;
66 /**
67 * Gives UNO access to the global mail merge functionality, via the com.sun.star.text.MailMerge
68 * service.
70 class SwXMailMerge final :
71 public cppu::WeakImplHelper
73 css::task::XJob,
74 css::util::XCancellable,
75 css::beans::XPropertySet,
76 css::text::XMailMergeBroadcaster,
77 css::lang::XComponent,
78 css::lang::XServiceInfo
81 friend class MailMergeExecuteFinalizer;
83 comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_aEvtListeners;
84 comphelper::OInterfaceContainerHelper2 m_aMergeListeners;
85 OPropertyListenerContainerHelper m_aPropListeners;
87 const SfxItemPropertySet* m_pPropSet;
89 SfxObjectShellRef m_xDocSh; // the document
91 OUString m_aTmpFileName;
93 // properties of mail merge service
94 css::uno::Sequence< css::uno::Any > m_aSelection;
95 css::uno::Reference< css::sdbc::XResultSet > m_xResultSet;
96 css::uno::Reference< css::sdbc::XConnection > m_xConnection;
97 css::uno::Reference< css::frame::XModel > m_xModel;
98 OUString m_aDataSourceName;
99 OUString m_aDataCommand;
100 OUString m_aFilter;
101 OUString m_aDocumentURL;
102 OUString m_aOutputURL;
103 OUString m_aFileNamePrefix;
104 sal_Int32 m_nDataCommandType;
105 sal_Int16 m_nOutputType;
106 bool m_bEscapeProcessing;
107 bool m_bFileNameFromColumn;
109 OUString m_sInServerPassword;
110 OUString m_sOutServerPassword;
111 OUString m_sSubject;
112 OUString m_sAddressFromColumn;
113 OUString m_sMailBody;
114 OUString m_sAttachmentName;
115 OUString m_sAttachmentFilter;
116 css::uno::Sequence< OUString > m_aCopiesTo;
117 css::uno::Sequence< OUString > m_aBlindCopiesTo;
118 bool m_bSendAsHTML;
119 bool m_bSendAsAttachment;
121 css::uno::Sequence< css::beans::PropertyValue > m_aPrintSettings;
123 bool m_bSaveAsSingleFile;
124 OUString m_sSaveFilter;
125 OUString m_sSaveFilterOptions;
126 css::uno::Sequence< css::beans::PropertyValue > m_aSaveFilterData;
128 bool m_bDisposing;
129 SwDBManager *m_pMgr;
131 void launchEvent( const css::beans::PropertyChangeEvent &rEvt ) const;
133 SwXMailMerge( const SwXMailMerge & ) = delete;
134 SwXMailMerge & operator = ( const SwXMailMerge & ) = delete;
136 virtual ~SwXMailMerge() override;
137 public:
138 SwXMailMerge();
140 void LaunchMailMergeEvent( const css::text::MailMergeEvent &rData ) const;
142 // XJob
143 virtual css::uno::Any SAL_CALL execute( const css::uno::Sequence< css::beans::NamedValue >& Arguments ) override;
145 // XCancellable
146 virtual void SAL_CALL cancel() override;
148 // XPropertySet
149 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
150 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
151 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
152 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
153 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
154 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
155 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
157 // XMailMergeBroadcaster
158 virtual void SAL_CALL addMailMergeEventListener( const css::uno::Reference< css::text::XMailMergeListener >& xListener ) override;
159 virtual void SAL_CALL removeMailMergeEventListener( const css::uno::Reference< css::text::XMailMergeListener >& xListener ) override;
161 // XComponent
162 virtual void SAL_CALL dispose( ) override;
163 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
164 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
166 // XServiceInfo
167 virtual OUString SAL_CALL getImplementationName( ) override;
168 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
169 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
172 #endif
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */