/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
//#i51949# no output type page visible if e-Mail is not supported if (m_xConfigItem->IsMailAvailable())
declarePath(
PathId::COMMON_FIRST_STATE,
{MM_DOCUMENTSELECTPAGE,
MM_OUTPUTTYPETPAGE,
MM_ADDRESSBLOCKPAGE,
MM_GREETINGSPAGE,
MM_LAYOUTPAGE}
); else
declarePath(
PathId::COMMON_FIRST_STATE,
{MM_DOCUMENTSELECTPAGE,
MM_ADDRESSBLOCKPAGE,
MM_GREETINGSPAGE,
MM_LAYOUTPAGE}
);
/* tdf#52986 Set help ID using SetRoadmapHelpId for all pages so that when by default the focus is on the left side pane of the wizard the relevant help page is displayed when hitting
the Help / F1 button */
SetRoadmapHelpId(u"modules/swriter/ui/mmselectpage/MMSelectPage"_ustr); break; case MM_OUTPUTTYPETPAGE :
xRet = std::make_unique<SwMailMergeOutputTypePage>(pPageContainer, this);
SetRoadmapHelpId(u"modules/swriter/ui/mmoutputtypepage/MMOutputTypePage"_ustr); break; case MM_ADDRESSBLOCKPAGE :
xRet = std::make_unique<SwMailMergeAddressBlockPage>(pPageContainer, this);
SetRoadmapHelpId(u"modules/swriter/ui/mmaddressblockpage/MMAddressBlockPage"_ustr); break; case MM_GREETINGSPAGE :
xRet = std::make_unique<SwMailMergeGreetingsPage>(pPageContainer, this);
SetRoadmapHelpId(u"modules/swriter/ui/mmsalutationpage/MMSalutationPage"_ustr); break; case MM_LAYOUTPAGE :
xRet = std::make_unique<SwMailMergeLayoutPage>(pPageContainer, this);
SetRoadmapHelpId(u"modules/swriter/ui/mmlayoutpage/MMLayoutPage"_ustr); break;
}
if (m_xConfigItem->GetTargetView())
{ //close the dialog, remove the target view, show the source view
m_nRestartPage = _nState; //set ResultSet back to start
m_xConfigItem->MoveResultSet(1);
m_xAssistant->response(RET_REMOVE_TARGET); return;
} bool bEnablePrev = true; bool bEnableNext = true; switch(_nState)
{ case MM_DOCUMENTSELECTPAGE:
{
bEnablePrev = false; // the first page
OUString sDataSourceName = GetSwView().GetDataSourceName(); if(!sDataSourceName.isEmpty() &&
!SwView::IsDataSourceAvailable(sDataSourceName))
{
bEnableNext = false;
}
} break; case MM_ADDRESSBLOCKPAGE :
bEnableNext = m_xConfigItem->GetResultSet().is(); break; case MM_LAYOUTPAGE:
bEnableNext = false; // the last page break;
}
enableButtons( WizardButtonFlags::PREVIOUS, bEnablePrev);
enableButtons( WizardButtonFlags::NEXT, bEnableNext);
UpdateRoadmap();
}
OUString SwMailMergeWizard::getStateDisplayName( WizardState _nState ) const
{ switch(_nState)
{ case MM_DOCUMENTSELECTPAGE: return m_sStarting; case MM_OUTPUTTYPETPAGE: return m_sDocumentType; case MM_ADDRESSBLOCKPAGE: return m_xConfigItem->IsOutputToLetter() ?
m_sAddressBlock : m_sAddressList; case MM_GREETINGSPAGE: return m_sGreetingsLine; case MM_LAYOUTPAGE: return m_sLayout;
} return OUString();
}
// enables/disables pages in the roadmap depending on the current page and state void SwMailMergeWizard::UpdateRoadmap()
{ /* MM_DOCUMENTSELECTPAGE > inactive after the layoutpage MM_OUTPUTTYPETPAGE : > inactive after the layoutpage MM_ADDRESSBLOCKPAGE > inactive after the layoutpage MM_GREETINGSPAGE > inactive after the layoutpage MM_LAYOUTPAGE > inactive after the layoutpage inactive if address block and greeting are switched off or are already inserted into the source document
*/
//#i97436# if a document has to be loaded then enable output type page only
m_bDocumentLoad = false; bool bEnableOutputTypePage = (nCurPage != MM_DOCUMENTSELECTPAGE) || static_cast<vcl::OWizardPage*>(pCurPage)->commitPage( ::vcl::WizardTypes::eValidate );
for(sal_uInt16 nPage = MM_DOCUMENTSELECTPAGE; nPage <= MM_LAYOUTPAGE; ++nPage)
{ bool bEnable = true; switch(nPage)
{ case MM_DOCUMENTSELECTPAGE:
bEnable = true; break; case MM_OUTPUTTYPETPAGE:
bEnable = bEnableOutputTypePage; break; case MM_ADDRESSBLOCKPAGE:
bEnable = !m_bDocumentLoad && bEnableOutputTypePage; // update page title for email vs letter
m_xAssistant->set_page_title(OUString::number(MM_ADDRESSBLOCKPAGE), getStateDisplayName(MM_ADDRESSBLOCKPAGE)); break; case MM_GREETINGSPAGE:
bEnable = !m_bDocumentLoad && bEnableOutputTypePage &&
m_xConfigItem->GetResultSet().is() &&
bAddressFieldsConfigured; break; case MM_LAYOUTPAGE:
bEnable = bCanFinish &&
((m_xConfigItem->IsAddressBlock() && !m_xConfigItem->IsAddressInserted()) ||
(m_xConfigItem->IsGreetingLine(false) && !m_xConfigItem->IsGreetingInserted() )); break;
}
enableState( nPage, bEnable );
}
}
short SwMailMergeWizard::run()
{
OSL_FAIL("SwMailMergeWizard cannot be executed via Dialog::Execute!\n" "It creates a thread (MailDispatcher instance) that will call" "back to VCL apartment => deadlock!\n" "Use Dialog::StartExecuteAsync to execute the dialog!" ); return RET_CANCEL;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.