LibreOffice Module sw (master)  1
unomailmerge.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UNOMAILMERGE_HXX
21 #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOMAILMERGE_HXX
22 
23 #include <cppuhelper/implbase.hxx>
26 
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>
36 
37 namespace com { namespace sun { namespace star {
38 
39  namespace sdbc {
40  class XResultSet;
41  class XConnection;
42  }
43  namespace frame {
44  class XModel;
45  }
46  namespace lang {
47  class XMultiServiceFactory;
48  }
49  namespace text {
50  class XMailMergeListener;
51  struct MailMergeEvent;
52  }
53  namespace beans{
54  struct PropertyValue;
55  }
56 
57 }}}
58 
61 
62 class SwDBManager;
64 
65 class SwXMailMerge :
66  public cppu::WeakImplHelper
67  <
68  css::task::XJob,
69  css::util::XCancellable,
70  css::beans::XPropertySet,
71  css::text::XMailMergeBroadcaster,
72  css::lang::XComponent,
73  css::lang::XServiceInfo
74  >
75 {
77 
81 
83 
84  SfxObjectShellRef m_xDocSh; // the document
85 
86  OUString m_aTmpFileName;
87 
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;
94  OUString m_aDataCommand;
95  OUString m_aFilter;
96  OUString m_aDocumentURL;
97  OUString m_aOutputURL;
99  sal_Int32 m_nDataCommandType;
100  sal_Int16 m_nOutputType;
104 
107  OUString m_sSubject;
109  OUString m_sMailBody;
112  css::uno::Sequence< OUString > m_aCopiesTo;
113  css::uno::Sequence< OUString > m_aBlindCopiesTo;
116 
117  css::uno::Sequence< css::beans::PropertyValue > m_aPrintSettings;
118 
120  OUString m_sSaveFilter;
122  css::uno::Sequence< css::beans::PropertyValue > m_aSaveFilterData;
123 
126 
127  void launchEvent( const css::beans::PropertyChangeEvent &rEvt ) const;
128 
129  SwXMailMerge( const SwXMailMerge & ) = delete;
130  SwXMailMerge & operator = ( const SwXMailMerge & ) = delete;
131 protected:
132  virtual ~SwXMailMerge() override;
133 public:
134  SwXMailMerge();
135 
136  void LaunchMailMergeEvent( const css::text::MailMergeEvent &rData ) const;
137 
138  // XJob
139  virtual css::uno::Any SAL_CALL execute( const css::uno::Sequence< css::beans::NamedValue >& Arguments ) override;
140 
141  // XCancellable
142  virtual void SAL_CALL cancel() override;
143 
144  // XPropertySet
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;
152 
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;
156 
157  // XComponent
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;
161 
162  // XServiceInfo
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;
166 };
167 
168 #endif
169 
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString m_aDocumentURL
virtual void SAL_CALL removeMailMergeEventListener(const css::uno::Reference< css::text::XMailMergeListener > &xListener) override
OUString m_sAttachmentName
SwXMailMerge & operator=(const SwXMailMerge &)=delete
OUString m_sOutServerPassword
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
const SfxItemPropertySet * m_pPropSet
OUString m_sSaveFilter
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OUString m_sAddressFromColumn
sal_Int16 m_nOutputType
OUString m_sMailBody
virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue > &Arguments) override
css::uno::Reference< css::frame::XModel > m_xModel
virtual ~SwXMailMerge() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
OUString m_sAttachmentFilter
bool m_bSendAsAttachment
cppu::OMultiTypeInterfaceContainerHelperVar< sal_Int32 > OPropertyListenerContainerHelper
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
void launchEvent(const css::beans::PropertyChangeEvent &rEvt) const
virtual void SAL_CALL addMailMergeEventListener(const css::uno::Reference< css::text::XMailMergeListener > &xListener) override
css::uno::Sequence< css::beans::PropertyValue > m_aSaveFilterData
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
css::uno::Reference< css::sdbc::XConnection > m_xConnection
OUString m_sSubject
sal_Int32 m_nDataCommandType
OUString m_aFileNamePrefix
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
OUString m_aDataSourceName
OUString m_aOutputURL
unsigned char sal_Bool
SfxObjectShellRef m_xDocSh
void LaunchMailMergeEvent(const css::text::MailMergeEvent &rData) const
bool m_bEscapeProcessing
virtual void SAL_CALL dispose() override
css::uno::Sequence< OUString > m_aCopiesTo
css::uno::Sequence< css::beans::PropertyValue > m_aPrintSettings
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
OUString m_sInServerPassword
bool m_bSinglePrintJobs
OUString m_sSaveFilterOptions
comphelper::OInterfaceContainerHelper2 m_aMergeListeners
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
css::uno::Sequence< OUString > m_aBlindCopiesTo
OUString m_aDataCommand
OUString m_aTmpFileName
OUString m_aFilter
def text(shape, st)
OPropertyListenerContainerHelper m_aPropListeners
virtual void SAL_CALL cancel() override
bool m_bSaveAsSingleFile
css::uno::Reference< css::sdbc::XResultSet > m_xResultSet
css::uno::Sequence< css::uno::Any > m_aSelection
comphelper::OInterfaceContainerHelper2 m_aEvtListeners
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
bool m_bFileNameFromColumn
SwDBManager * m_pMgr