LibreOffice Module sw (master) 1
mailmrge.cxx
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#include <vcl/svapp.hxx>
21#include <vcl/settings.hxx>
23
24#include <tools/urlobj.hxx>
25#include <svl/urihelper.hxx>
27#include <view.hxx>
28#include <docsh.hxx>
30#include <printdata.hxx>
31#include <wrtsh.hxx>
32#include <dbmgr.hxx>
33#include <swmodule.hxx>
34#include <modcfg.hxx>
35#include <mailmergehelper.hxx>
36#include <mailmrge.hxx>
37#include <sfx2/docfile.hxx>
41#include <com/sun/star/container/XContainerQuery.hpp>
42#include <com/sun/star/container/XEnumeration.hpp>
43#include <com/sun/star/form/runtime/XFormController.hpp>
44#include <com/sun/star/frame/Frame.hpp>
45#include <com/sun/star/lang/XMultiServiceFactory.hpp>
46#include <com/sun/star/sdbcx/XRowLocate.hpp>
47#include <com/sun/star/sdb/XResultSetAccess.hpp>
48#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
49#include <com/sun/star/view/XSelectionSupplier.hpp>
52
53#include <algorithm>
54
55using namespace ::com::sun::star;
56using namespace ::com::sun::star::container;
57using namespace ::com::sun::star::lang;
58using namespace ::com::sun::star::sdb;
59using namespace ::com::sun::star::sdbc;
60using namespace ::com::sun::star::sdbcx;
61using namespace ::com::sun::star::beans;
62using namespace ::com::sun::star::util;
63using namespace ::com::sun::star::uno;
64using namespace ::com::sun::star::frame;
65using namespace ::com::sun::star::form;
66using namespace ::com::sun::star::view;
67using namespace ::com::sun::star::ui::dialogs;
68
70 uno::Reference<runtime::XFormController> xFController;
71 uno::Reference<XSelectionChangeListener> xChgLstnr;
72 uno::Reference<XSelectionSupplier> xSelSupp;
73};
74
75class SwXSelChgLstnr_Impl : public cppu::WeakImplHelper
76 <
77 view::XSelectionChangeListener
78 >
79{
81public:
82 explicit SwXSelChgLstnr_Impl(SwMailMergeDlg& rParentDlg);
83
84 virtual void SAL_CALL selectionChanged( const EventObject& aEvent ) override;
85 virtual void SAL_CALL disposing( const EventObject& Source ) override;
86};
87
89 m_rParent(rParentDlg)
90{}
91
92void SwXSelChgLstnr_Impl::selectionChanged( const EventObject& )
93{
94 //call the parent to enable selection mode
95 Sequence <Any> aSelection;
96 if(m_rParent.m_pImpl->xSelSupp.is())
97 m_rParent.m_pImpl->xSelSupp->getSelection() >>= aSelection;
98
99 bool bEnable = aSelection.hasElements();
100 m_rParent.m_xMarkedRB->set_sensitive(bEnable);
101 if(bEnable)
102 m_rParent.m_xMarkedRB->set_active(true);
103 else if(m_rParent.m_xMarkedRB->get_active()) {
104 m_rParent.m_xAllRB->set_active(true);
105 m_rParent.m_aSelection.realloc(0);
106 }
107}
108
109void SwXSelChgLstnr_Impl::disposing( const EventObject& )
110{
111 OSL_FAIL("disposing");
112}
113
115 const OUString& rSourceName,
116 const OUString& rTableName,
117 sal_Int32 nCommandType,
118 const uno::Reference< XConnection>& _xConnection,
119 Sequence< Any > const * pSelection)
120 : SfxDialogController(pParent, "modules/swriter/ui/mailmerge.ui", "MailmergeDialog")
122 , m_rSh(rShell)
123 , m_nMergeType(DBMGR_MERGE_EMAIL)
124 , m_xBeamerWin(m_xBuilder->weld_container("beamer"))
125 , m_xAllRB(m_xBuilder->weld_radio_button("all"))
126 , m_xMarkedRB(m_xBuilder->weld_radio_button("selected"))
127 , m_xFromRB(m_xBuilder->weld_radio_button("rbfrom"))
128 , m_xFromNF(m_xBuilder->weld_spin_button("from"))
129 , m_xToNF(m_xBuilder->weld_spin_button("to"))
130 , m_xPrinterRB(m_xBuilder->weld_radio_button("printer"))
131 , m_xMailingRB(m_xBuilder->weld_radio_button("electronic"))
132 , m_xFileRB(m_xBuilder->weld_radio_button("file"))
133 , m_xSingleJobsCB(m_xBuilder->weld_check_button("singlejobs"))
134 , m_xPasswordCB(m_xBuilder->weld_check_button("passwd-check"))
135 , m_xSaveMergedDocumentFT(m_xBuilder->weld_label("savemergeddoclabel"))
136 , m_xSaveSingleDocRB(m_xBuilder->weld_radio_button("singledocument"))
137 , m_xSaveIndividualRB(m_xBuilder->weld_radio_button("individualdocuments"))
138 , m_xGenerateFromDataBaseCB(m_xBuilder->weld_check_button("generate"))
139 , m_xColumnFT(m_xBuilder->weld_label("fieldlabel"))
140 , m_xColumnLB(m_xBuilder->weld_combo_box("field"))
141 , m_xPasswordFT(m_xBuilder->weld_label("passwd-label"))
142 , m_xPasswordLB(m_xBuilder->weld_combo_box("passwd-combobox"))
143 , m_xPathFT(m_xBuilder->weld_label("pathlabel"))
144 , m_xPathED(m_xBuilder->weld_entry("path"))
145 , m_xPathPB(m_xBuilder->weld_button("pathpb"))
146 , m_xFilterFT(m_xBuilder->weld_label("fileformatlabel"))
147 , m_xFilterLB(m_xBuilder->weld_combo_box("fileformat"))
148 , m_xAddressFieldLB(m_xBuilder->weld_combo_box("address"))
149 , m_xSubjectFT(m_xBuilder->weld_label("subjectlabel"))
150 , m_xSubjectED(m_xBuilder->weld_entry("subject"))
151 , m_xFormatFT(m_xBuilder->weld_label("mailformatlabel"))
152 , m_xAttachFT(m_xBuilder->weld_label("attachmentslabel"))
153 , m_xAttachED(m_xBuilder->weld_entry("attachments"))
154 , m_xAttachPB(m_xBuilder->weld_button("attach"))
155 , m_xFormatHtmlCB(m_xBuilder->weld_check_button("html"))
156 , m_xFormatRtfCB(m_xBuilder->weld_check_button("rtf"))
157 , m_xFormatSwCB(m_xBuilder->weld_check_button("swriter"))
158 , m_xOkBTN(m_xBuilder->weld_button("ok"))
159{
160 m_xSingleJobsCB->hide(); // not supported in since cws printerpullpages anymore
161 //task #97066# mailing of form letters is currently not supported
162 m_xMailingRB->hide();
163 m_xSubjectFT->hide();
164 m_xSubjectED->hide();
165 m_xFormatFT->hide();
166 m_xFormatSwCB->hide();
167 m_xFormatHtmlCB->hide();
168 m_xFormatRtfCB->hide();
169 m_xAttachFT->hide();
170 m_xAttachED->hide();
171 m_xAttachPB->hide();
172 m_xPasswordCB->hide();
173 m_xPasswordFT->hide();
174 m_xPasswordLB->hide();
175
176 uno::Reference< lang::XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
177 if(pSelection) {
178 m_aSelection = *pSelection;
179 m_xBeamerWin->hide();
180 } else {
181 try {
182 // create a frame wrapper for myself
183 m_xFrame = frame::Frame::create( comphelper::getProcessComponentContext() );
184 m_xFrame->initialize(m_xBeamerWin->CreateChildFrame());
185 } catch (const Exception&) {
186 m_xFrame.clear();
187 }
188 if(m_xFrame.is()) {
189 URL aURL;
190 aURL.Complete = ".component:DB/DataSourceBrowser";
191 uno::Reference<XDispatch> xD = m_xFrame->queryDispatch(aURL,
192 "",
193 0x0C);
194 if(xD.is()) {
195 Sequence<PropertyValue> aProperties
196 {
197 comphelper::makePropertyValue("DataSourceName", rSourceName),
198 comphelper::makePropertyValue("Command", rTableName),
199 comphelper::makePropertyValue("CommandType", nCommandType),
200 };
201 xD->dispatch(aURL, aProperties);
202 m_xBeamerWin->show();
203 }
204 uno::Reference<XController> xController = m_xFrame->getController();
205 m_pImpl->xFController.set(xController, UNO_QUERY);
206 if(m_pImpl->xFController.is()) {
207 uno::Reference< awt::XControl > xCtrl = m_pImpl->xFController->getCurrentControl( );
208 m_pImpl->xSelSupp.set(xCtrl, UNO_QUERY);
209 if(m_pImpl->xSelSupp.is()) {
210 m_pImpl->xChgLstnr = new SwXSelChgLstnr_Impl(*this);
211 m_pImpl->xSelSupp->addSelectionChangeListener( m_pImpl->xChgLstnr );
212 }
213 }
214 }
215 }
216
217 m_pModOpt = SW_MOD()->GetModuleConfig();
218
220 m_xFormatSwCB->set_active(bool(nMailingMode & MailTextFormats::OFFICE));
221 m_xFormatHtmlCB->set_active(bool(nMailingMode & MailTextFormats::HTML));
222 m_xFormatRtfCB->set_active(bool(nMailingMode & MailTextFormats::RTF));
223
224 m_xAllRB->set_active(true);
225
226 // Install handlers
227 m_xOkBTN->connect_clicked(LINK(this, SwMailMergeDlg, ButtonHdl));
228
229 m_xPathPB->connect_clicked(LINK(this, SwMailMergeDlg, InsertPathHdl));
230
231 m_xPrinterRB->connect_toggled(LINK(this, SwMailMergeDlg, OutputTypeHdl));
232 m_xFileRB->connect_toggled(LINK(this, SwMailMergeDlg, OutputTypeHdl));
233
234 //#i63267# printing might be disabled
236 m_xPrinterRB->set_sensitive(bIsPrintable);
237 OutputTypeHdl(bIsPrintable ? *m_xPrinterRB : *m_xFileRB);
238
239 m_xGenerateFromDataBaseCB->connect_toggled(LINK(this, SwMailMergeDlg, FilenameHdl));
240 bool bColumn = m_pModOpt->IsNameFromColumn();
241 if(bColumn)
242 m_xGenerateFromDataBaseCB->set_active(true);
243
244 FilenameHdl(*m_xGenerateFromDataBaseCB);
245 m_xSaveSingleDocRB->set_active(true);
246 m_xSaveSingleDocRB->connect_toggled(LINK(this, SwMailMergeDlg, SaveTypeHdl));
247 m_xSaveIndividualRB->connect_toggled(LINK(this, SwMailMergeDlg, SaveTypeHdl));
248 SaveTypeHdl(*m_xSaveSingleDocRB);
249
250 m_xFilterLB->connect_changed(LINK(this, SwMailMergeDlg, FileFormatHdl));
251
252 Link<weld::SpinButton&,void> aLk2 = LINK(this, SwMailMergeDlg, ModifyHdl);
253 m_xFromNF->connect_value_changed(aLk2);
254 m_xToNF->connect_value_changed(aLk2);
255 m_xFromNF->set_max(SAL_MAX_INT32);
256 m_xToNF->set_max(SAL_MAX_INT32);
257
258 SwDBManager* pDBManager = m_rSh.GetDBManager();
259 if(_xConnection.is())
260 SwDBManager::GetColumnNames(*m_xAddressFieldLB, _xConnection, rTableName);
261 else
262 pDBManager->GetColumnNames(*m_xAddressFieldLB, rSourceName, rTableName);
263 for(sal_Int32 nEntry = 0, nEntryCount = m_xAddressFieldLB->get_count(); nEntry < nEntryCount; ++nEntry)
264 {
265 m_xColumnLB->append_text(m_xAddressFieldLB->get_text(nEntry));
266 m_xPasswordLB->append_text(m_xAddressFieldLB->get_text(nEntry));
267 }
268
269 m_xAddressFieldLB->set_active_text("EMAIL");
270
271 OUString sPath(m_pModOpt->GetMailingPath());
272 if(sPath.isEmpty()) {
273 SvtPathOptions aPathOpt;
274 sPath = aPathOpt.GetWorkPath();
275 }
276 INetURLObject aURL(sPath);
277 if(aURL.GetProtocol() == INetProtocol::File)
278 m_xPathED->set_text(aURL.PathToFileName());
279 else
280 m_xPathED->set_text(aURL.GetFull());
281
282 if (!bColumn )
283 {
284 m_xColumnLB->set_active_text("NAME");
285 m_xPasswordLB->set_active_text("PASSWORD");
286 }
287 else
288 {
289 m_xColumnLB->set_active_text(m_pModOpt->GetNameFromColumn());
290 m_xPasswordLB->set_active_text(m_pModOpt->GetPasswordFromColumn());
291 }
292
293 if (m_xAddressFieldLB->get_active() == -1)
294 m_xAddressFieldLB->set_active(0);
295 if (m_xColumnLB->get_active() == -1)
296 m_xColumnLB->set_active(0);
297 if (m_xPasswordLB->get_active() == -1)
298 m_xPasswordLB->set_active(0);
299
300 const bool bEnable = m_aSelection.hasElements();
301 m_xMarkedRB->set_sensitive(bEnable);
302 if (bEnable)
303 m_xMarkedRB->set_active(true);
304 else {
305 m_xAllRB->set_active(true);
306 m_xMarkedRB->set_sensitive(false);
307 }
308 try {
309 uno::Reference< container::XNameContainer> xFilterFactory(
310 xMSF->createInstance("com.sun.star.document.FilterFactory"), UNO_QUERY_THROW);
311 uno::Reference< container::XContainerQuery > xQuery(xFilterFactory, UNO_QUERY_THROW);
312 const OUString sCommand("matchByDocumentService=com.sun.star.text.TextDocument:iflags="
313 + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::EXPORT))
314 + ":eflags="
315 + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::NOTINFILEDLG))
316 + ":default_first");
317 uno::Reference< container::XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand);
318 static constexpr OUStringLiteral sName(u"Name");
319 sal_Int32 nODT = -1;
320 while(xList->hasMoreElements()) {
321 comphelper::SequenceAsHashMap aFilter(xList->nextElement());
322 const OUString sFilter = aFilter.getUnpackedValueOrDefault(sName, OUString());
323
324 uno::Any aProps = xFilterFactory->getByName(sFilter);
325 uno::Sequence< beans::PropertyValue > aFilterProperties;
326 aProps >>= aFilterProperties;
327 OUString sUIName2;
328 auto pProp = std::find_if(std::cbegin(aFilterProperties), std::cend(aFilterProperties),
329 [](const beans::PropertyValue& rProp) { return rProp.Name == "UIName"; });
330 if (pProp != std::cend(aFilterProperties))
331 pProp->Value >>= sUIName2;
332 if( !sUIName2.isEmpty() ) {
333 if( sFilter == "writer8" )
334 nODT = m_xFilterLB->get_count();
335 m_xFilterLB->append(sFilter, sUIName2);
336 }
337 }
338 m_xFilterLB->set_active( nODT );
339 } catch (const uno::Exception&) {
340 }
341}
342
344{
345 if(m_xFrame.is()) {
346 m_xFrame->setComponent(nullptr, nullptr);
347 m_xFrame->dispose();
348 }
349}
350
352{
353 if (ExecQryShell())
354 m_xDialog->response(RET_OK);
355}
356
358{
359 bool bPrint = m_xPrinterRB->get_active();
360 m_xSingleJobsCB->set_sensitive(bPrint);
361
362 m_xSaveMergedDocumentFT->set_sensitive( !bPrint );
363 m_xSaveSingleDocRB->set_sensitive( !bPrint );
364 m_xSaveIndividualRB->set_sensitive( !bPrint );
365
366 if( !bPrint ) {
367 SaveTypeHdl( m_xSaveSingleDocRB->get_active() ? *m_xSaveSingleDocRB : *m_xSaveIndividualRB );
368 } else {
369 m_xPathFT->set_sensitive(false);
370 m_xPathED->set_sensitive(false);
371 m_xPathPB->set_sensitive(false);
372 m_xColumnFT->set_sensitive(false);
373 m_xColumnLB->set_sensitive(false);
374 m_xFilterFT->set_sensitive(false);
375 m_xFilterLB->set_sensitive(false);
376 m_xGenerateFromDataBaseCB->set_sensitive(false);
377 m_xPasswordCB->set_sensitive( false );
378 m_xPasswordFT->set_sensitive( false );
379 m_xPasswordLB->set_sensitive( false );
380 }
381}
382
384{
385 bool bIndividual = m_xSaveIndividualRB->get_active();
386
387 m_xGenerateFromDataBaseCB->set_sensitive( bIndividual );
388 if( bIndividual )
389 {
390 FilenameHdl(*m_xGenerateFromDataBaseCB);
391 }
392 else
393 {
394 m_xColumnFT->set_sensitive(false);
395 m_xColumnLB->set_sensitive(false);
396 m_xPathFT->set_sensitive( false );
397 m_xPathED->set_sensitive( false );
398 m_xPathPB->set_sensitive( false );
399 m_xFilterFT->set_sensitive( false );
400 m_xFilterLB->set_sensitive( false );
401 m_xPasswordCB->set_sensitive( false );
402 m_xPasswordFT->set_sensitive( false );
403 m_xPasswordLB->set_sensitive( false );
404 }
405}
406
407IMPL_LINK( SwMailMergeDlg, FilenameHdl, weld::Toggleable&, rBox, void )
408{
409 bool bEnable = rBox.get_active();
410 m_xColumnFT->set_sensitive( bEnable );
411 m_xColumnLB->set_sensitive(bEnable);
412 m_xPathFT->set_sensitive( bEnable );
413 m_xPathED->set_sensitive(bEnable);
414 m_xPathPB->set_sensitive( bEnable );
415 m_xFilterFT->set_sensitive( bEnable );
416 m_xFilterLB->set_sensitive( bEnable );
417
418 if(m_xFilterLB->get_active_id() == "writer_pdf_Export")
419 {
420 m_xPasswordCB->show();
421 m_xPasswordFT->show();
422 m_xPasswordLB->show();
423
424 m_xPasswordCB->set_sensitive( bEnable );
425 m_xPasswordFT->set_sensitive( bEnable );
426 m_xPasswordLB->set_sensitive( bEnable );
427 }
428}
429
431{
432 if(m_xFilterLB->get_active_id() == "writer_pdf_Export")
433 {
434 m_xPasswordCB->show();
435 m_xPasswordFT->show();
436 m_xPasswordLB->show();
437
438 m_xPasswordCB->set_sensitive( true );
439 m_xPasswordFT->set_sensitive( true );
440 m_xPasswordLB->set_sensitive( true );
441 }
442 else
443 {
444 m_xPasswordCB->hide();
445 m_xPasswordFT->hide();
446 m_xPasswordLB->hide();
447 }
448}
449
451{
452 m_xFromRB->set_active(true);
453}
454
456{
457 return (m_xSaveSingleDocRB->get_active() || !m_xGenerateFromDataBaseCB->get_active());
458}
459
461{
462 SfxMedium* pMedium = m_rSh.GetView().GetDocShell()->GetMedium();
463 INetURLObject aAbs;
464 if( pMedium )
465 aAbs = pMedium->GetURLObject();
466 if( INetProtocol::NotValid == aAbs.GetProtocol() )
467 {
468 SvtPathOptions aPathOpt;
469 aAbs.SetURL( aPathOpt.GetWorkPath() );
470 }
472 aAbs, m_xPathED->get_text(), URIHelper::GetMaybeFileHdl());
473}
474
476{
477 if(m_pImpl->xSelSupp.is()) {
478 m_pImpl->xSelSupp->removeSelectionChangeListener( m_pImpl->xChgLstnr );
479 }
480
481 if (m_xPrinterRB->get_active())
483 else {
488
489 if (!AskUserFilename())
490 {
491 m_pModOpt->SetNameFromColumn(m_xColumnLB->get_active_text());
492 m_pModOpt->SetPasswordFromColumn(m_xPasswordLB->get_active_text());
493 if (m_xFilterLB->get_active() != -1)
494 m_sSaveFilter = m_xFilterLB->get_active_id();
495 m_sFilename = OUString();
496 } else {
497 //#i97667# reset column name - otherwise it's remembered from the last run
498 m_pModOpt->SetNameFromColumn(OUString());
499 m_pModOpt->SetPasswordFromColumn(OUString());
500 //start save as dialog
501 OUString sFilter;
503 if (m_sFilename.isEmpty())
504 return false;
505 m_sSaveFilter = sFilter;
506 }
507 }
508
509 if (m_xFromRB->get_active()) { // Insert list
510 // Safe: the maximal value of the fields is limited
511 sal_Int32 nStart = m_xFromNF->get_value();
512 sal_Int32 nEnd = m_xToNF->get_value();
513
514 if (nEnd < nStart)
515 std::swap(nEnd, nStart);
516
517 m_aSelection.realloc(nEnd - nStart + 1);
518 Any* pSelection = m_aSelection.getArray();
519 for (sal_Int32 i = nStart; i <= nEnd; ++i, ++pSelection)
520 *pSelection <<= i;
521 } else if (m_xAllRB->get_active() )
522 m_aSelection.realloc(0); // Empty selection = insert all
523 else {
524 if(m_pImpl->xSelSupp.is()) {
525 //update selection
526 uno::Reference< XRowLocate > xRowLocate(GetResultSet(),UNO_QUERY);
527 uno::Reference< XResultSet > xRes(xRowLocate,UNO_QUERY);
528 m_pImpl->xSelSupp->getSelection() >>= m_aSelection;
529 if ( xRowLocate.is() ) {
530 for (Any& rRow : asNonConstRange(m_aSelection)) {
531 if ( xRowLocate->moveToBookmark(rRow) )
532 rRow <<= xRes->getRow();
533 }
534 }
535 }
536 }
538 SwPrintData aPrtData( rIDDA.getPrintData() );
539 aPrtData.SetPrintSingleJobs(m_xSingleJobsCB->get_active());
540 rIDDA.setPrintData(aPrtData);
541
543
545
546 if (m_xFormatSwCB->get_active())
547 nMailingMode |= MailTextFormats::OFFICE;
548 if (m_xFormatHtmlCB->get_active())
549 nMailingMode |= MailTextFormats::HTML;
550 if (m_xFormatRtfCB->get_active())
551 nMailingMode |= MailTextFormats::RTF;
552 m_pModOpt->SetMailingFormats(nMailingMode);
553 return true;
554}
555
557{
558 if( AskUserFilename() )
559 return m_sFilename;
560 OUString sPath( m_pModOpt->GetMailingPath() );
561 if( sPath.isEmpty() ) {
562 SvtPathOptions aPathOpt;
563 sPath = aPathOpt.GetWorkPath();
564 }
565 if( !sPath.endsWith("/") )
566 sPath += "/";
567 return sPath;
568}
569
571{
572 uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
573 uno::Reference < XFolderPicker2 > xFP = sfx2::createFolderPicker(xContext, m_xDialog.get());
574 xFP->setDisplayDirectory( GetURLfromPath() );
575 if( xFP->execute() == RET_OK ) {
576 INetURLObject aURL(xFP->getDirectory());
577 if(aURL.GetProtocol() == INetProtocol::File)
578 m_xPathED->set_text(aURL.PathToFileName());
579 else
580 m_xPathED->set_text(aURL.GetFull());
581 }
582}
583
584uno::Reference<XResultSet> SwMailMergeDlg::GetResultSet() const
585{
586 uno::Reference< XResultSet > xResSetClone;
587 if ( m_pImpl->xFController.is() ) {
588 // we create a clone to do the task
589 uno::Reference< XResultSetAccess > xResultSetAccess( m_pImpl->xFController->getModel(),UNO_QUERY);
590 if ( xResultSetAccess.is() )
591 xResSetClone = xResultSetAccess->createResultSet();
592 }
593 return xResSetClone;
594}
595
597 : GenericDialogController(pParent, "modules/swriter/ui/mailmergedialog.ui", "MailMergeDialog")
598 , m_xThisDocRB(m_xBuilder->weld_radio_button("document"))
599{
600}
601
603{
604}
605
607 : GenericDialogController(pParent, "modules/swriter/ui/mergeconnectdialog.ui", "MergeConnectDialog")
608 , m_xUseExistingRB(m_xBuilder->weld_radio_button("existing"))
609{
610}
611
613{
614}
615
616/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
PropertiesInfo aProperties
XSLTFilter & m_rParent
Reference< XExecutableDialog > m_xDialog
const MiscSettings & GetMiscSettings() const
static const AllSettings & GetSettings()
Provides access to the formatting devices of a document.
virtual void setPrintData(const SwPrintData &rPrtData)=0
Sets the PrintData.
virtual const SwPrintData & getPrintData() const =0
Returns the PrintData.
INetProtocol GetProtocol() const
bool SetURL(std::u16string_view rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool GetDisablePrinting() const
const INetURLObject & GetURLObject() const
SfxMedium * GetMedium() const
const OUString & GetWorkPath() const
void GetColumnNames(weld::ComboBox &rBox, const OUString &rDBName, const OUString &rTableName)
Fill listbox with all column names of a database table.
Definition: dbmgr.cxx:674
SwDBManager * GetDBManager() const
For evaluation of DB fields (new DB-manager).
Definition: edfld.cxx:329
virtual ~SwMailMergeCreateFromDlg() override
Definition: mailmrge.cxx:602
SwMailMergeCreateFromDlg(weld::Window *pParent)
Definition: mailmrge.cxx:596
SwMailMergeDlg(weld::Window *pParent, SwWrtShell &rSh, const OUString &rSourceName, const OUString &rTableName, sal_Int32 nCommandType, const css::uno::Reference< css::sdbc::XConnection > &xConnection, css::uno::Sequence< css::uno::Any > const *pSelection)
Definition: mailmrge.cxx:114
std::unique_ptr< weld::CheckButton > m_xFormatRtfCB
Definition: mailmrge.hxx:99
std::unique_ptr< weld::SpinButton > m_xFromNF
Definition: mailmrge.hxx:65
std::unique_ptr< weld::RadioButton > m_xFileRB
Definition: mailmrge.hxx:70
std::unique_ptr< weld::RadioButton > m_xFromRB
Definition: mailmrge.hxx:64
std::unique_ptr< weld::CheckButton > m_xFormatSwCB
Definition: mailmrge.hxx:100
css::uno::Sequence< css::uno::Any > m_aSelection
Definition: mailmrge.hxx:54
std::unique_ptr< weld::CheckButton > m_xGenerateFromDataBaseCB
Definition: mailmrge.hxx:79
std::unique_ptr< weld::Label > m_xFormatFT
Definition: mailmrge.hxx:94
std::unique_ptr< weld::Entry > m_xSubjectED
Definition: mailmrge.hxx:93
std::unique_ptr< SwMailMergeDlg_Impl > m_pImpl
Definition: mailmrge.hxx:48
virtual ~SwMailMergeDlg() override
Definition: mailmrge.cxx:343
std::unique_ptr< weld::CheckButton > m_xSingleJobsCB
Definition: mailmrge.hxx:72
std::unique_ptr< weld::RadioButton > m_xAllRB
Definition: mailmrge.hxx:62
css::uno::Reference< css::frame::XFrame2 > m_xFrame
Definition: mailmrge.hxx:55
std::unique_ptr< weld::Label > m_xSubjectFT
Definition: mailmrge.hxx:92
std::unique_ptr< weld::Button > m_xAttachPB
Definition: mailmrge.hxx:97
std::unique_ptr< weld::RadioButton > m_xPrinterRB
Definition: mailmrge.hxx:68
std::unique_ptr< weld::Button > m_xOkBTN
Definition: mailmrge.hxx:102
std::unique_ptr< weld::ComboBox > m_xAddressFieldLB
Definition: mailmrge.hxx:91
std::unique_ptr< weld::ComboBox > m_xFilterLB
Definition: mailmrge.hxx:89
std::unique_ptr< weld::ComboBox > m_xColumnLB
Definition: mailmrge.hxx:82
OUString GetURLfromPath() const
Definition: mailmrge.cxx:460
OUString m_sFilename
Definition: mailmrge.hxx:58
bool AskUserFilename() const
Definition: mailmrge.cxx:455
OUString GetTargetURL() const
Definition: mailmrge.cxx:556
friend class SwXSelChgLstnr_Impl
Definition: mailmrge.hxx:46
std::unique_ptr< weld::Entry > m_xAttachED
Definition: mailmrge.hxx:96
bool ExecQryShell()
Definition: mailmrge.cxx:475
std::unique_ptr< weld::Container > m_xBeamerWin
Definition: mailmrge.hxx:60
DBManagerOptions m_nMergeType
Definition: mailmrge.hxx:53
OUString m_sSaveFilter
Definition: mailmrge.hxx:57
std::unique_ptr< weld::RadioButton > m_xSaveSingleDocRB
Definition: mailmrge.hxx:76
std::unique_ptr< weld::ComboBox > m_xPasswordLB
Definition: mailmrge.hxx:84
std::unique_ptr< weld::Button > m_xPathPB
Definition: mailmrge.hxx:87
std::unique_ptr< weld::CheckButton > m_xFormatHtmlCB
Definition: mailmrge.hxx:98
std::unique_ptr< weld::SpinButton > m_xToNF
Definition: mailmrge.hxx:66
std::unique_ptr< weld::Label > m_xPasswordFT
Definition: mailmrge.hxx:83
SwModuleOptions * m_pModOpt
Definition: mailmrge.hxx:51
std::unique_ptr< weld::CheckButton > m_xPasswordCB
Definition: mailmrge.hxx:73
std::unique_ptr< weld::Label > m_xAttachFT
Definition: mailmrge.hxx:95
css::uno::Reference< css::sdbc::XResultSet > GetResultSet() const
Definition: mailmrge.cxx:584
std::unique_ptr< weld::Entry > m_xPathED
Definition: mailmrge.hxx:86
std::unique_ptr< weld::RadioButton > m_xMarkedRB
Definition: mailmrge.hxx:63
std::unique_ptr< weld::RadioButton > m_xMailingRB
Definition: mailmrge.hxx:69
SwWrtShell & m_rSh
Definition: mailmrge.hxx:50
std::unique_ptr< weld::RadioButton > m_xSaveIndividualRB
Definition: mailmrge.hxx:77
virtual ~SwMailMergeFieldConnectionsDlg() override
Definition: mailmrge.cxx:612
SwMailMergeFieldConnectionsDlg(weld::Window *pParent)
Definition: mailmrge.cxx:606
const OUString & GetNameFromColumn() const
Definition: modcfg.hxx:340
void SetIsFileEncryptedFromColumn(bool bSet)
Definition: modcfg.hxx:345
void SetNameFromColumn(const OUString &rSet)
Definition: modcfg.hxx:341
void SetIsNameFromColumn(bool bSet)
Definition: modcfg.hxx:332
void SetMailingPath(const OUString &sPath)
Definition: modcfg.hxx:356
void SetMailingFormats(MailTextFormats nSet)
Definition: modcfg.hxx:325
MailTextFormats GetMailingFormats() const
Definition: modcfg.hxx:324
void SetPasswordFromColumn(const OUString &rSet)
Definition: modcfg.hxx:352
bool IsNameFromColumn() const
Definition: modcfg.hxx:331
void SetSinglePrintJob(bool b)
Definition: modcfg.hxx:328
const OUString & GetPasswordFromColumn() const
Definition: modcfg.hxx:351
const OUString & GetMailingPath() const
Definition: modcfg.hxx:355
void SetPrintSingleJobs(bool b)
Definition: printdata.hxx:164
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: viewsh.cxx:2819
SwDocShell * GetDocShell()
Definition: view.cxx:1193
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
const SwView & GetView() const
Definition: wrtsh.hxx:443
virtual void SAL_CALL disposing(const EventObject &Source) override
Definition: mailmrge.cxx:109
SwXSelChgLstnr_Impl(SwMailMergeDlg &rParentDlg)
Definition: mailmrge.cxx:88
virtual void SAL_CALL selectionChanged(const EventObject &aEvent) override
Definition: mailmrge.cxx:92
SwMailMergeDlg & m_rParent
Definition: mailmrge.cxx:80
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
@ DBMGR_MERGE_EMAIL
Send mail merge as email.
Definition: dbmgr.hxx:91
@ DBMGR_MERGE_PRINTER
Print mail merge.
Definition: dbmgr.hxx:90
@ DBMGR_MERGE_FILE
Save mail merge as files.
Definition: dbmgr.hxx:92
URL aURL
float u
OUString sName
IMPL_LINK(SwMailMergeDlg, FilenameHdl, weld::Toggleable &, rBox, void)
Definition: mailmrge.cxx:407
IMPL_LINK_NOARG(SwMailMergeDlg, ButtonHdl, weld::Button &, void)
Definition: mailmrge.cxx:351
MailTextFormats
Definition: modcfg.hxx:39
OUString CallSaveAsDialog(weld::Window *pParent, OUString &rFilter)
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
@ Exception
Reference< XMultiServiceFactory > getProcessServiceFactory()
Reference< XComponentContext > getProcessComponentContext()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
int i
css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker(const css::uno::Reference< css::uno::XComponentContext > &rContext, weld::Window *pPreferredParent)
uno::Reference< XSelectionSupplier > xSelSupp
Definition: mailmrge.cxx:72
uno::Reference< runtime::XFormController > xFController
Definition: mailmrge.cxx:70
uno::Reference< XSelectionChangeListener > xChgLstnr
Definition: mailmrge.cxx:71
Object Value
Reference< XController > xController
#define SW_MOD()
Definition: swmodule.hxx:254
#define SAL_MAX_INT32
RET_OK