From c9483451aaeea5c47726336c7b465c7618e1d37e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 26 Sep 2013 14:00:22 +0200 Subject: convert mailmerge select page to .ui Change-Id: I34f527ff8e1e9819f4e6ac728efa1e31f8bc3d48 --- include/svtools/wizardmachine.hxx | 3 +- svtools/source/dialogs/wizardmachine.cxx | 7 ++ sw/AllLangResTarget_sw.mk | 1 - sw/UIConfig_swriter.mk | 1 + sw/inc/helpid.h | 1 - sw/source/ui/dbui/mmdocselectpage.cxx | 85 +++++++------- sw/source/ui/dbui/mmdocselectpage.hrc | 31 ----- sw/source/ui/dbui/mmdocselectpage.hxx | 22 ++-- sw/source/ui/dbui/mmdocselectpage.src | 99 ---------------- sw/uiconfig/swriter/ui/mmselectpage.ui | 190 +++++++++++++++++++++++++++++++ 10 files changed, 250 insertions(+), 190 deletions(-) delete mode 100644 sw/source/ui/dbui/mmdocselectpage.hrc delete mode 100644 sw/source/ui/dbui/mmdocselectpage.src create mode 100644 sw/uiconfig/swriter/ui/mmselectpage.ui diff --git a/include/svtools/wizardmachine.hxx b/include/svtools/wizardmachine.hxx index 99352ca0d4a5..5275f999f985 100644 --- a/include/svtools/wizardmachine.hxx +++ b/include/svtools/wizardmachine.hxx @@ -99,7 +99,8 @@ namespace svt if the OWizardPage is used in an OWizardMachine, this parameter must be the OWizardMachine (which is derived from Window) */ - OWizardPage( Window* _pParent, const ResId& _rResId ); + OWizardPage(Window* _pParent, const ResId& _rResId); + OWizardPage(Window *pParent, const OString& rID, const OUString& rUIXMLDescription); ~OWizardPage(); // IWizardPageController overridables diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index 1b6dc0dacdd8..84467ab8b12a 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -49,6 +49,13 @@ namespace svt { } + OWizardPage::OWizardPage(Window *pParent, const OString& rID, + const OUString& rUIXMLDescription) + : TabPage(pParent, rID, rUIXMLDescription) + , m_pImpl(new WizardPageImplData) + { + } + //--------------------------------------------------------------------- OWizardPage::~OWizardPage() { diff --git a/sw/AllLangResTarget_sw.mk b/sw/AllLangResTarget_sw.mk index aae749806b44..2cb0c710802b 100644 --- a/sw/AllLangResTarget_sw.mk +++ b/sw/AllLangResTarget_sw.mk @@ -76,7 +76,6 @@ $(eval $(call gb_SrsTarget_add_files,sw/res,\ sw/source/ui/dbui/mailmergechildwindow.src \ sw/source/ui/dbui/mailmergewizard.src \ sw/source/ui/dbui/mmaddressblockpage.src \ - sw/source/ui/dbui/mmdocselectpage.src \ sw/source/ui/dbui/mmgreetingspage.src \ sw/source/ui/dbui/mmlayoutpage.src \ sw/source/ui/dbui/mmmergepage.src \ diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 5be26fd58987..7e5d9308d0ae 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -159,6 +159,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/querydefaultcompatdialog \ sw/uiconfig/swriter/ui/querysavelabeldialog \ sw/uiconfig/swriter/ui/queryshowchangesdialog \ + sw/uiconfig/swriter/ui/mmselectpage \ sw/uiconfig/swriter/ui/paradialog \ sw/uiconfig/swriter/ui/picturedialog \ sw/uiconfig/swriter/ui/picturepage \ diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index ecbf662af03d..52ea16d08f21 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -368,7 +368,6 @@ #define HID_MERGE_SOURCE_UNAVAILABLE "SW_HID_MERGE_SOURCE_UNAVAILABLE" #define HID_MODULE_TOOLBOX "SW_HID_MODULE_TOOLBOX" -#define HID_MM_DOCSELECTPAGE "SW_HID_MM_DOCSELECTPAGE" #define HID_MM_OUTPUTTYPEPAGE "SW_HID_MM_OUTPUTTYPEPAGE" #define HID_MM_ADDRESSBLOCKPAGE "SW_HID_MM_ADDRESSBLOCKPAGE" #define HID_MM_GREETINGSPAGE "SW_HID_MM_GREETINGSPAGE" diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index c8551a5ef25c..de3b9599e43a 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -33,7 +33,6 @@ #include #include -#include #include "com/sun/star/ui/dialogs/TemplateDescription.hpp" #include @@ -44,54 +43,50 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace svt; -SwMailMergeDocSelectPage::SwMailMergeDocSelectPage( SwMailMergeWizard* _pParent ) : - svt::OWizardPage(_pParent, SW_RES(DLG_MM_DOCSELECT_PAGE)), -#ifdef _MSC_VER -#pragma warning (disable : 4355) -#endif - m_aHeaderFI(this, SW_RES( FI_HEADER ) ), - m_aHowToFT (this, SW_RES( FT_HOWTO )), - m_aCurrentDocRB (this, SW_RES( RB_CURRENTDOC )), - m_aNewDocRB (this, SW_RES( RB_NEWDOC )), - m_aLoadDocRB (this, SW_RES( RB_LOADDOC )), - m_aLoadTemplateRB (this, SW_RES( RB_LOADTEMPLATE )), - m_aRecentDocRB (this, SW_RES( RB_RECENTDOC )), - m_aBrowseDocPB (this, SW_RES( PB_LOADDOC )), - m_aBrowseTemplatePB (this, SW_RES( PB_BROWSETEMPLATE )), - m_aRecentDocLB (this, SW_RES( LB_RECENTDOC )), -#ifdef _MSC_VER -#pragma warning (default : 4355) -#endif - m_pWizard(_pParent) +SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(SwMailMergeWizard* pParent) + : svt::OWizardPage(pParent, "MMSelectPage", + "modules/swriter/ui/mmselectpage.ui") + , m_pWizard(pParent) { - FreeResource(); - - m_aCurrentDocRB.Check(); - DocSelectHdl(&m_aNewDocRB); + get(m_pCurrentDocRB, "currentdoc"); + get(m_pNewDocRB, "newdoc"); + get(m_pLoadDocRB, "loaddoc"); + get(m_pLoadTemplateRB, "template"); + get(m_pRecentDocRB, "recentdoc"); + get(m_pBrowseDocPB, "browsedoc"); + get(m_pBrowseTemplatePB, "browsetemplate"); + get(m_pRecentDocLB, "recentdoclb"); + + m_pCurrentDocRB->Check(); + DocSelectHdl(m_pNewDocRB); Link aDocSelectLink = LINK(this, SwMailMergeDocSelectPage, DocSelectHdl); - m_aCurrentDocRB.SetClickHdl(aDocSelectLink); - m_aNewDocRB.SetClickHdl(aDocSelectLink); - m_aLoadDocRB.SetClickHdl(aDocSelectLink); - m_aLoadTemplateRB.SetClickHdl(aDocSelectLink); - m_aRecentDocRB.SetClickHdl(aDocSelectLink); + m_pCurrentDocRB->SetClickHdl(aDocSelectLink); + m_pNewDocRB->SetClickHdl(aDocSelectLink); + m_pLoadDocRB->SetClickHdl(aDocSelectLink); + m_pLoadTemplateRB->SetClickHdl(aDocSelectLink); + m_pRecentDocRB->SetClickHdl(aDocSelectLink); Link aFileSelectHdl = LINK(this, SwMailMergeDocSelectPage, FileSelectHdl); - m_aBrowseDocPB.SetClickHdl(aFileSelectHdl); - m_aBrowseTemplatePB.SetClickHdl(aFileSelectHdl); + m_pBrowseDocPB->SetClickHdl(aFileSelectHdl); + m_pBrowseTemplatePB->SetClickHdl(aFileSelectHdl); const uno::Sequence< OUString >& rDocs = m_pWizard->GetConfigItem().GetSavedDocuments(); for(sal_Int32 nDoc = 0; nDoc < rDocs.getLength(); ++nDoc) { //insert in reverse order - m_aRecentDocLB.InsertEntry(rDocs[nDoc], 0); + m_pRecentDocLB->InsertEntry(rDocs[nDoc], 0); } - m_aRecentDocLB.SelectEntryPos(0); + m_pRecentDocLB->SelectEntryPos(0); if(!rDocs.getLength()) { - m_aRecentDocRB.Enable(sal_False); + m_pRecentDocRB->Enable(sal_False); } + + //Temp hack until all pages are converted to .ui and wizard + //base class adapted + SetSizePixel(LogicToPixel(Size(260 , 250), MapMode(MAP_APPFONT))); } SwMailMergeDocSelectPage::~SwMailMergeDocSelectPage() @@ -100,7 +95,7 @@ SwMailMergeDocSelectPage::~SwMailMergeDocSelectPage() IMPL_LINK(SwMailMergeDocSelectPage, DocSelectHdl, RadioButton*, pButton) { - m_aRecentDocLB.Enable(&m_aRecentDocRB == pButton); + m_pRecentDocLB->Enable(m_pRecentDocRB == pButton); m_pWizard->UpdateRoadmap(); m_pWizard->enableButtons(WZB_NEXT, m_pWizard->isStateEnabled(MM_OUTPUTTYPETPAGE)); @@ -110,11 +105,11 @@ IMPL_LINK(SwMailMergeDocSelectPage, DocSelectHdl, RadioButton*, pButton) IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, PushButton*, pButton) { - bool bTemplate = &m_aBrowseTemplatePB == pButton; + bool bTemplate = m_pBrowseTemplatePB == pButton; if(bTemplate) { - m_aLoadTemplateRB.Check(); + m_pLoadTemplateRB->Check(); SfxNewFileDialog* pNewFileDlg = new SfxNewFileDialog(this, 0); sal_uInt16 nRet = pNewFileDlg->Execute(); if(RET_TEMPLATE_LOAD == nRet) @@ -124,7 +119,7 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, PushButton*, pButton) delete pNewFileDlg; } else - m_aLoadDocRB.Check(); + m_pLoadDocRB->Check(); if(!bTemplate) { @@ -172,15 +167,15 @@ sal_Bool SwMailMergeDocSelectPage::commitPage( ::svt::WizardTypes::CommitPageRea if(bNext || _eReason == ::svt::WizardTypes::eValidate ) { OUString sReloadDocument; - bReturn = m_aCurrentDocRB.IsChecked() || - m_aNewDocRB.IsChecked() || - (!(sReloadDocument = m_sLoadFileName).isEmpty() && m_aLoadDocRB.IsChecked() )|| - (!(sReloadDocument = m_sLoadTemplateName).isEmpty() && m_aLoadTemplateRB.IsChecked())|| - (m_aRecentDocRB.IsChecked() && !(sReloadDocument = m_aRecentDocLB.GetSelectEntry()).isEmpty()); + bReturn = m_pCurrentDocRB->IsChecked() || + m_pNewDocRB->IsChecked() || + (!(sReloadDocument = m_sLoadFileName).isEmpty() && m_pLoadDocRB->IsChecked() )|| + (!(sReloadDocument = m_sLoadTemplateName).isEmpty() && m_pLoadTemplateRB->IsChecked())|| + (m_pRecentDocRB->IsChecked() && !(sReloadDocument = m_pRecentDocLB->GetSelectEntry()).isEmpty()); if( _eReason == ::svt::WizardTypes::eValidate ) - m_pWizard->SetDocumentLoad(!m_aCurrentDocRB.IsChecked()); + m_pWizard->SetDocumentLoad(!m_pCurrentDocRB->IsChecked()); - if(bNext && !m_aCurrentDocRB.IsChecked()) + if(bNext && !m_pCurrentDocRB->IsChecked()) { if(!sReloadDocument.isEmpty()) m_pWizard->SetReloadDocument( sReloadDocument ); diff --git a/sw/source/ui/dbui/mmdocselectpage.hrc b/sw/source/ui/dbui/mmdocselectpage.hrc deleted file mode 100644 index 88077ebb8599..000000000000 --- a/sw/source/ui/dbui/mmdocselectpage.hrc +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- 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 . - */ - -#define FT_HOWTO 1 -#define RB_CURRENTDOC 2 -#define RB_NEWDOC 3 -#define RB_LOADDOC 4 -#define PB_LOADDOC 5 -#define RB_LOADTEMPLATE 6 -#define PB_BROWSETEMPLATE 7 -#define RB_RECENTDOC 8 -#define LB_RECENTDOC 9 -#define FI_HEADER 10 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/mmdocselectpage.hxx b/sw/source/ui/dbui/mmdocselectpage.hxx index cc81c02c3dbe..a10064ba8642 100644 --- a/sw/source/ui/dbui/mmdocselectpage.hxx +++ b/sw/source/ui/dbui/mmdocselectpage.hxx @@ -28,21 +28,19 @@ class SwMailMergeWizard; class SwMailMergeDocSelectPage : public svt::OWizardPage { - SwBoldFixedInfo m_aHeaderFI; - FixedInfo m_aHowToFT; - RadioButton m_aCurrentDocRB; - RadioButton m_aNewDocRB; - RadioButton m_aLoadDocRB; - RadioButton m_aLoadTemplateRB; - RadioButton m_aRecentDocRB; + RadioButton* m_pCurrentDocRB; + RadioButton* m_pNewDocRB; + RadioButton* m_pLoadDocRB; + RadioButton* m_pLoadTemplateRB; + RadioButton* m_pRecentDocRB; - PushButton m_aBrowseDocPB; - PushButton m_aBrowseTemplatePB; + PushButton* m_pBrowseDocPB; + PushButton* m_pBrowseTemplatePB; - ListBox m_aRecentDocLB; + ListBox* m_pRecentDocLB; - String m_sLoadFileName; - String m_sLoadTemplateName; + OUString m_sLoadFileName; + OUString m_sLoadTemplateName; SwMailMergeWizard* m_pWizard; diff --git a/sw/source/ui/dbui/mmdocselectpage.src b/sw/source/ui/dbui/mmdocselectpage.src deleted file mode 100644 index d69abe80d7ff..000000000000 --- a/sw/source/ui/dbui/mmdocselectpage.src +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- 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 . - */ -#include -#include -#include -TabPage DLG_MM_DOCSELECT_PAGE -{ - HelpID = HID_MM_DOCSELECTPAGE ; - Size = MAP_APPFONT ( 260 , 250 ) ; - Hide = TRUE ; - - FixedText FI_HEADER - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Select starting document for the mail merge"; - }; - FixedText FT_HOWTO - { - Pos = MAP_APPFONT ( 6 , 27 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Select the document upon which to base the mail merge document"; - }; - RadioButton RB_CURRENTDOC - { - HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_CURRENTDOC"; - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 190 , 10 ) ; - Text[ en-US ] = "Use the current ~document"; - }; - RadioButton RB_NEWDOC - { - HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_NEWDOC"; - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 190 , 10 ) ; - Text[ en-US ] = "Create a ne~w document"; - }; - RadioButton RB_LOADDOC - { - HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_LOADDOC"; - Pos = MAP_APPFONT ( 12 , 84) ; - Size = MAP_APPFONT ( 190 , 10 ) ; - Text[ en-US ] = "Start from ~existing document"; - }; - PushButton PB_LOADDOC - { - HelpID = "sw:PushButton:DLG_MM_DOCSELECT_PAGE:PB_LOADDOC"; - Pos = MAP_APPFONT ( 204 , 80) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text[ en-US ] = "B~rowse..."; - }; - RadioButton RB_LOADTEMPLATE - { - HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_LOADTEMPLATE"; - Pos = MAP_APPFONT ( 12 , 103 ) ; - Size = MAP_APPFONT ( 190 , 10 ) ; - Text[ en-US ] = "Start from a t~emplate"; - }; - PushButton PB_BROWSETEMPLATE - { - HelpID = "sw:PushButton:DLG_MM_DOCSELECT_PAGE:PB_BROWSETEMPLATE"; - Pos = MAP_APPFONT ( 204 , 99 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text[ en-US ] = "B~rowse..."; - }; - RadioButton RB_RECENTDOC - { - HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_RECENTDOC"; - Pos = MAP_APPFONT ( 12 , 120) ; - Size = MAP_APPFONT ( 190 , 10 ) ; - Text[ en-US ] = "Start fro~m a recently saved starting document"; - }; - ListBox LB_RECENTDOC - { - HelpID = "sw:ListBox:DLG_MM_DOCSELECT_PAGE:LB_RECENTDOC"; - Pos = MAP_APPFONT ( 20 , 134 ) ; - Size = MAP_APPFONT ( 180 , 50 ) ; - DropDown = TRUE; - Border = TRUE; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/uiconfig/swriter/ui/mmselectpage.ui b/sw/uiconfig/swriter/ui/mmselectpage.ui new file mode 100644 index 000000000000..fcfc4f42645a --- /dev/null +++ b/sw/uiconfig/swriter/ui/mmselectpage.ui @@ -0,0 +1,190 @@ + + + + + True + False + 6 + vertical + 12 + + + True + False + 0 + none + + + True + False + 6 + 12 + + + True + False + True + 6 + 12 + True + + + Use the current _document + True + True + False + True + 0 + True + True + newdoc + + + 0 + 0 + 2 + 1 + + + + + Create a ne_w document + True + True + False + True + 0 + True + loaddoc + + + 0 + 1 + 2 + 1 + + + + + Start from _existing document + True + True + False + True + True + 0 + True + template + + + 0 + 2 + 1 + 1 + + + + + Start from a t_emplate + True + True + False + True + True + 0 + True + recentdoc + + + 0 + 3 + 1 + 1 + + + + + Start fro_m a recently saved starting document + True + True + False + True + 0 + True + currentdoc + + + 0 + 4 + 2 + 1 + + + + + True + False + 12 + 0 + 1 + + + 0 + 5 + 2 + 1 + + + + + B_rowse... + True + True + True + True + + + 1 + 2 + 1 + 1 + + + + + B_rowse... + True + True + True + True + + + 1 + 3 + 1 + 1 + + + + + + + + + True + False + Select starting document for the mail merge + + + + + + + + False + True + 0 + + + + -- cgit v1.2.3