32#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
33#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
41 :
vcl::OWizardPage(pPage, pWizard,
"modules/swriter/ui/mmselectpage.ui",
"MMSelectPage")
43 , m_xCurrentDocRB(m_xBuilder->weld_radio_button(
"currentdoc"))
44 , m_xNewDocRB(m_xBuilder->weld_radio_button(
"newdoc"))
45 , m_xLoadDocRB(m_xBuilder->weld_radio_button(
"loaddoc"))
46 , m_xLoadTemplateRB(m_xBuilder->weld_radio_button(
"template"))
47 , m_xRecentDocRB(m_xBuilder->weld_radio_button(
"recentdoc"))
48 , m_xBrowseDocPB(m_xBuilder->weld_button(
"browsedoc"))
49 , m_xBrowseTemplatePB(m_xBuilder->weld_button(
"browsetemplate"))
50 , m_xRecentDocLB(m_xBuilder->weld_combo_box(
"recentdoclb"))
51 , m_xDataSourceWarningFT(m_xBuilder->weld_label(
"datasourcewarning"))
52 , m_xExchangeDatabasePB(m_xBuilder->weld_button(
"exchangedatabase"))
72 const uno::Sequence< OUString >& rDocs =
74 for(
const auto& rDoc : rDocs)
79 if (!rDocs.hasElements())
91 m_xRecentDocLB->set_sensitive(m_xRecentDocRB->get_active());
92 m_pWizard->UpdateRoadmap();
93 OUString sDataSourceName = m_pWizard->GetSwView()->GetDataSourceName();
95 if(m_xCurrentDocRB->get_active() &&
96 !sDataSourceName.isEmpty() &&
99 m_xDataSourceWarningFT->show();
100 m_pWizard->enableButtons(WizardButtonFlags::NEXT,
false);
104 m_xDataSourceWarningFT->hide();
105 m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(
MM_OUTPUTTYPETPAGE));
108 if(m_xCurrentDocRB->get_active())
109 m_xExchangeDatabasePB->set_sensitive(
true);
111 m_xExchangeDatabasePB->set_sensitive(
false);
116 bool bTemplate = m_xBrowseTemplatePB.get() == &rButton;
120 m_xLoadTemplateRB->set_active(
true);
121 SfxNewFileDialog aNewFileDlg(m_pWizard->getDialog(), SfxNewFileDialogMode::NONE);
122 sal_uInt16 nRet = aNewFileDlg.run();
129 m_xLoadDocRB->set_active(
true);
134 FileDialogFlags::NONE, m_pWizard->getDialog());
138 SfxObjectFactory &rFact = m_pWizard->GetSwView()->GetDocShell()->GetFactory();
141 std::shared_ptr<const SfxFilter> pFlt = aIter.
First();
144 if( pFlt && pFlt->IsAllowedAsTemplate() )
146 const OUString sWild = pFlt->GetWildcard().getGlob();
147 xFP->appendFilter( pFlt->GetUIName(), sWild );
150 if(pFlt->GetFilterFlags() & SfxFilterFlags::DEFAULT)
151 xFP->setCurrentFilter( pFlt->GetUIName() ) ;
159 m_sLoadFileName = xFP->getSelectedFiles().getConstArray()[0];
162 m_pWizard->UpdateRoadmap();
163 m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(
MM_OUTPUTTYPETPAGE));
173 OUString sDataSourceName = m_pWizard->GetSwView()->GetDataSourceName();
175 if(m_xCurrentDocRB->get_active() &&
176 !sDataSourceName.isEmpty() &&
179 m_xDataSourceWarningFT->hide();
180 m_pWizard->enableButtons(WizardButtonFlags::NEXT,
true);
186 bool bReturn =
false;
187 bool bNext = _eReason == ::vcl::WizardTypes::eTravelForward;
188 if(bNext || _eReason == ::vcl::WizardTypes::eValidate )
190 OUString sReloadDocument;
196 bReturn = !sReloadDocument.isEmpty() &&
m_xLoadDocRB->get_active();
209 bReturn = !sReloadDocument.isEmpty();
212 if( _eReason == ::vcl::WizardTypes::eValidate )
217 if(!sReloadDocument.isEmpty())
std::shared_ptr< const SfxFilter > First()
std::shared_ptr< const SfxFilter > Next()
OUString GetTemplateFileName() const
const OUString & GetFactoryName() const
virtual VclPtr< VclAbstractDialog > CreateSwChangeDBDlg(SwView &rVw)=0
const css::uno::Sequence< OUString > & GetSavedDocuments() const
std::unique_ptr< weld::RadioButton > m_xNewDocRB
SwMailMergeDocSelectPage(weld::Container *pPage, SwMailMergeWizard *pWizard)
std::unique_ptr< weld::RadioButton > m_xRecentDocRB
std::unique_ptr< weld::RadioButton > m_xCurrentDocRB
virtual ~SwMailMergeDocSelectPage() override
std::unique_ptr< weld::Button > m_xBrowseTemplatePB
virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason) override
std::unique_ptr< weld::Label > m_xDataSourceWarningFT
OUString m_sLoadTemplateName
std::unique_ptr< weld::RadioButton > m_xLoadTemplateRB
std::unique_ptr< weld::Button > m_xExchangeDatabasePB
SwMailMergeWizard * m_pWizard
std::unique_ptr< weld::RadioButton > m_xLoadDocRB
std::unique_ptr< weld::ComboBox > m_xRecentDocLB
std::unique_ptr< weld::Button > m_xBrowseDocPB
SwMailMergeConfigItem & GetConfigItem()
void SetDocumentLoad(bool bSet)
void SetRestartPage(sal_uInt16 nPage)
void SetReloadDocument(const OUString &rURL)
static bool IsDataSourceAvailable(const OUString sDataSourceName)
const css::uno::Reference< css::ui::dialogs::XFilePicker3 > & GetFilePicker() const
void SetContext(Context _eNewContext)
void response(int nResponse)
#define LINK(Instance, Class, Member)
#define MM_OUTPUTTYPETPAGE
IMPL_LINK_NOARG(SwMailMergeDocSelectPage, DocSelectHdl, weld::Toggleable &, void)
IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, weld::Button &, rButton, void)
#define RET_TEMPLATE_LOAD