From d63cf26df43eb4490634756f016d9a4f0607ac05 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 9 Sep 2013 13:58:53 +0100 Subject: convert customize address list dialog to .ui Change-Id: I91c69add679f62af5f67cc1bd7c2739b2de84cfb --- sw/source/ui/dbui/customizeaddresslistdialog.cxx | 94 +++++++++----------- sw/source/ui/dbui/customizeaddresslistdialog.hrc | 37 -------- sw/source/ui/dbui/customizeaddresslistdialog.hxx | 21 ++--- sw/source/ui/dbui/customizeaddresslistdialog.src | 107 ----------------------- 4 files changed, 49 insertions(+), 210 deletions(-) delete mode 100644 sw/source/ui/dbui/customizeaddresslistdialog.hrc delete mode 100644 sw/source/ui/dbui/customizeaddresslistdialog.src (limited to 'sw/source/ui') diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx b/sw/source/ui/dbui/customizeaddresslistdialog.cxx index 881458de5693..fcea7c22c667 100644 --- a/sw/source/ui/dbui/customizeaddresslistdialog.cxx +++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx @@ -22,49 +22,39 @@ #include #include #include -#include #include #include SwCustomizeAddressListDialog::SwCustomizeAddressListDialog( - Window* pParent, const SwCSVData& rOldData) : - SfxModalDialog(pParent, SW_RES(DLG_MM_CUSTOMIZE_ADDRESS_LIST)), -#ifdef _MSC_VER -#pragma warning (disable : 4355) -#endif - m_aFieldsFT( this, SW_RES( FT_FIELDS)), - m_aFieldsLB( this, SW_RES( LB_FIELDS)), - m_aAddPB( this, SW_RES( PB_ADD)), - m_aDeletePB( this, SW_RES( PB_DELETE)), - m_aRenamePB( this, SW_RES( PB_RENAME)), - m_aUpPB( this, SW_RES( PB_UP)), - m_aDownPB( this, SW_RES( PB_DOWN)), - m_aSeparatorFL( this, SW_RES( FL_SEPARATOR)), - m_aOK( this, SW_RES( PB_OK)), - m_aCancel( this, SW_RES( PB_CANCEL)), - m_aHelp( this, SW_RES( PB_HELP)), -#ifdef _MSC_VER -#pragma warning (default : 4355) -#endif - m_pNewData( new SwCSVData(rOldData)) + Window* pParent, const SwCSVData& rOldData) + : SfxModalDialog(pParent, "CustomizeAddrListDialog", + "modules/swriter/ui/customizeaddrlistdialog.ui") + , m_pNewData( new SwCSVData(rOldData)) { - FreeResource(); - m_aFieldsLB.SetSelectHdl(LINK(this, SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl)); + get(m_pFieldsLB, "treeview"); + m_pFieldsLB->SetDropDownLineCount(14); + get(m_pAddPB, "add"); + get(m_pDeletePB, "delete"); + get(m_pRenamePB, "rename"); + get(m_pUpPB, "up"); + get(m_pDownPB, "down"); + + m_pFieldsLB->SetSelectHdl(LINK(this, SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl)); Link aAddRenameLk = LINK(this, SwCustomizeAddressListDialog, AddRenameHdl_Impl ); - m_aAddPB.SetClickHdl(aAddRenameLk); - m_aRenamePB.SetClickHdl(aAddRenameLk); - m_aDeletePB.SetClickHdl(LINK(this, SwCustomizeAddressListDialog, DeleteHdl_Impl )); + m_pAddPB->SetClickHdl(aAddRenameLk); + m_pRenamePB->SetClickHdl(aAddRenameLk); + m_pDeletePB->SetClickHdl(LINK(this, SwCustomizeAddressListDialog, DeleteHdl_Impl )); Link aUpDownLk = LINK(this, SwCustomizeAddressListDialog, UpDownHdl_Impl); - m_aUpPB.SetClickHdl(aUpDownLk); - m_aDownPB.SetClickHdl(aUpDownLk); + m_pUpPB->SetClickHdl(aUpDownLk); + m_pDownPB->SetClickHdl(aUpDownLk); std::vector< OUString >::iterator aHeaderIter; for(aHeaderIter = m_pNewData->aDBColumnHeaders.begin(); aHeaderIter != m_pNewData->aDBColumnHeaders.end(); ++aHeaderIter) - m_aFieldsLB.InsertEntry(*aHeaderIter); + m_pFieldsLB->InsertEntry(*aHeaderIter); - m_aFieldsLB.SelectEntryPos(0); + m_pFieldsLB->SelectEntryPos(0); UpdateButtons(); } @@ -80,8 +70,8 @@ IMPL_LINK_NOARG(SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl) IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) { - bool bRename = pButton == &m_aRenamePB; - sal_uInt16 nPos = m_aFieldsLB.GetSelectEntryPos(); + bool bRename = pButton == m_pRenamePB; + sal_uInt16 nPos = m_pFieldsLB->GetSelectEntryPos(); if(nPos == LISTBOX_ENTRY_NOTFOUND) nPos = 0; @@ -92,7 +82,7 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) pDlg = new SwAddEntryDialog(pButton, m_pNewData->aDBColumnHeaders); if(bRename) { - String aTemp = m_aFieldsLB.GetEntry(nPos); + String aTemp = m_pFieldsLB->GetEntry(nPos); pDlg->SetFieldName(aTemp); } if(RET_OK == pDlg->Execute()) @@ -101,11 +91,11 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) if(bRename) { m_pNewData->aDBColumnHeaders[nPos] = sNew; - m_aFieldsLB.RemoveEntry(nPos); + m_pFieldsLB->RemoveEntry(nPos); } else { - if ( m_aFieldsLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + if ( m_pFieldsLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) ++nPos; // append the new entry behind the selected //add the new column m_pNewData->aDBColumnHeaders.insert(m_pNewData->aDBColumnHeaders.begin() + nPos, sNew); @@ -117,8 +107,8 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) } - m_aFieldsLB.InsertEntry(sNew, nPos); - m_aFieldsLB.SelectEntryPos(nPos); + m_pFieldsLB->InsertEntry(sNew, nPos); + m_pFieldsLB->SelectEntryPos(nPos); } delete pDlg; UpdateButtons(); @@ -127,9 +117,9 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) IMPL_LINK_NOARG(SwCustomizeAddressListDialog, DeleteHdl_Impl) { - sal_uInt16 nPos = m_aFieldsLB.GetSelectEntryPos(); - m_aFieldsLB.RemoveEntry(m_aFieldsLB.GetSelectEntryPos()); - m_aFieldsLB.SelectEntryPos(nPos > m_aFieldsLB.GetEntryCount() - 1 ? nPos - 1 : nPos); + sal_uInt16 nPos = m_pFieldsLB->GetSelectEntryPos(); + m_pFieldsLB->RemoveEntry(m_pFieldsLB->GetSelectEntryPos()); + m_pFieldsLB->SelectEntryPos(nPos > m_pFieldsLB->GetEntryCount() - 1 ? nPos - 1 : nPos); //remove the column m_pNewData->aDBColumnHeaders.erase(m_pNewData->aDBColumnHeaders.begin() + nPos); @@ -145,15 +135,15 @@ IMPL_LINK_NOARG(SwCustomizeAddressListDialog, DeleteHdl_Impl) IMPL_LINK(SwCustomizeAddressListDialog, UpDownHdl_Impl, PushButton*, pButton) { sal_uInt16 nPos; - sal_uInt16 nOldPos = nPos = m_aFieldsLB.GetSelectEntryPos(); - String aTemp = m_aFieldsLB.GetEntry(nPos); - m_aFieldsLB.RemoveEntry( nPos ); - if(pButton == &m_aUpPB) + sal_uInt16 nOldPos = nPos = m_pFieldsLB->GetSelectEntryPos(); + String aTemp = m_pFieldsLB->GetEntry(nPos); + m_pFieldsLB->RemoveEntry( nPos ); + if(pButton == m_pUpPB) --nPos; else ++nPos; - m_aFieldsLB.InsertEntry(aTemp, nPos); - m_aFieldsLB.SelectEntryPos(nPos); + m_pFieldsLB->InsertEntry(aTemp, nPos); + m_pFieldsLB->SelectEntryPos(nPos); //align m_pNewData OUString sHeader = m_pNewData->aDBColumnHeaders[nOldPos]; m_pNewData->aDBColumnHeaders.erase(m_pNewData->aDBColumnHeaders.begin() + nOldPos); @@ -172,12 +162,12 @@ IMPL_LINK(SwCustomizeAddressListDialog, UpDownHdl_Impl, PushButton*, pButton) void SwCustomizeAddressListDialog::UpdateButtons() { - sal_uInt16 nPos = m_aFieldsLB.GetSelectEntryPos(); - sal_uInt16 nEntries = m_aFieldsLB.GetEntryCount(); - m_aUpPB.Enable(nPos > 0 && nEntries > 0); - m_aDownPB.Enable(nPos < nEntries -1); - m_aDeletePB.Enable(nEntries > 0); - m_aRenamePB.Enable(nEntries > 0); + sal_uInt16 nPos = m_pFieldsLB->GetSelectEntryPos(); + sal_uInt16 nEntries = m_pFieldsLB->GetEntryCount(); + m_pUpPB->Enable(nPos > 0 && nEntries > 0); + m_pDownPB->Enable(nPos < nEntries -1); + m_pDeletePB->Enable(nEntries > 0); + m_pRenamePB->Enable(nEntries > 0); } SwCSVData* SwCustomizeAddressListDialog::GetNewData() diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hrc b/sw/source/ui/dbui/customizeaddresslistdialog.hrc deleted file mode 100644 index 4130046755cb..000000000000 --- a/sw/source/ui/dbui/customizeaddresslistdialog.hrc +++ /dev/null @@ -1,37 +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 . - */ -#ifndef _CUSTOMIZEADDRESSLISTDIALOG_HRC -#define _CUSTOMIZEADDRESSLISTDIALOG_HRC - -#define FT_FIELDS 1 -#define LB_FIELDS 2 -#define PB_ADD 3 -#define PB_DELETE 4 -#define PB_RENAME 5 -#define PB_UP 6 -#define PB_DOWN 7 -#define FL_SEPARATOR 8 - -#define PB_OK 14 -#define PB_CANCEL 15 -#define PB_HELP 16 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hxx b/sw/source/ui/dbui/customizeaddresslistdialog.hxx index ecea2dcf9943..dfcadc2c658d 100644 --- a/sw/source/ui/dbui/customizeaddresslistdialog.hxx +++ b/sw/source/ui/dbui/customizeaddresslistdialog.hxx @@ -29,23 +29,16 @@ struct SwCSVData; class SwCustomizeAddressListDialog : public SfxModalDialog { - FixedText m_aFieldsFT; - ListBox m_aFieldsLB; + ListBox* m_pFieldsLB; - PushButton m_aAddPB; - PushButton m_aDeletePB; - PushButton m_aRenamePB; + PushButton* m_pAddPB; + PushButton* m_pDeletePB; + PushButton* m_pRenamePB; - ImageButton m_aUpPB; - ImageButton m_aDownPB; + PushButton* m_pUpPB; + PushButton* m_pDownPB; - FixedLine m_aSeparatorFL; - - OKButton m_aOK; - CancelButton m_aCancel; - HelpButton m_aHelp; - - SwCSVData* m_pNewData; + SwCSVData* m_pNewData; DECL_LINK(AddRenameHdl_Impl, PushButton*); DECL_LINK(DeleteHdl_Impl, void *); diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.src b/sw/source/ui/dbui/customizeaddresslistdialog.src deleted file mode 100644 index 345f41156288..000000000000 --- a/sw/source/ui/dbui/customizeaddresslistdialog.src +++ /dev/null @@ -1,107 +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 - -ModalDialog DLG_MM_CUSTOMIZE_ADDRESS_LIST -{ - OutputSize = TRUE ; - SVLook = TRUE ; - HelpID = HID_MM_CUSTOMIZE_ADDRESS_LIST; - Size = MAP_APPFONT ( 200 , 171 ) ; - Moveable = TRUE ; - - Text [ en-US ] = "Customize Address List"; - - FixedText FT_FIELDS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "A~ddress list elements"; - }; - ListBox LB_FIELDS - { - HelpID = "sw:ListBox:DLG_MM_CUSTOMIZE_ADDRESS_LIST:LB_FIELDS"; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 112 , 120 ) ; - Border = TRUE; - }; - PushButton PB_ADD - { - HelpID = "sw:PushButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_ADD"; - Pos = MAP_APPFONT ( 144 , 3 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add..."; - }; - PushButton PB_DELETE - { - HelpID = "sw:PushButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_DELETE"; - Pos = MAP_APPFONT ( 144 , 20 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete"; - }; - PushButton PB_RENAME - { - HelpID = "sw:PushButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_RENAME"; - Pos = MAP_APPFONT ( 144 , 37 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Rename..."; - }; - ImageButton PB_UP - { - HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_UP"; - Pos = MAP_APPFONT ( 124 , 58 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - SYMBOL = IMAGEBUTTON_ARROW_UP; - QuickHelpText[ en-US ] = "Move up"; - }; - ImageButton PB_DOWN - { - HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_DOWN"; - Pos = MAP_APPFONT ( 124 , 75 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - SYMBOL = IMAGEBUTTON_ARROW_DOWN; - QuickHelpText[ en-US ] = "Move down"; - }; - FixedLine FL_SEPARATOR - { - Pos = MAP_APPFONT ( 0 , 140 ) ; - Size = MAP_APPFONT ( 200 , 8 ) ; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 35 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 88 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 144 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit