From 8bcbc765a2764a85add4be25ab9d4789f43bb640 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 30 Jul 2013 20:47:54 +0100 Subject: convert xslt filter dialog to .ui Change-Id: I02bb629af1f4811f382469b8e2aaaba272f07034 --- filter/AllLangResTarget_xsltdlg.mk | 1 - filter/UIConfig_xsltdlg.mk | 1 + filter/source/xsltdialog/xmlfiltercommon.hrc | 32 ------ .../source/xsltdialog/xmlfilterdialogstrings.hrc | 2 +- filter/source/xsltdialog/xmlfilterhelpids.hrc | 28 ----- .../source/xsltdialog/xmlfiltersettingsdialog.cxx | 1 - filter/source/xsltdialog/xmlfiltertabdialog.cxx | 77 +++++--------- filter/source/xsltdialog/xmlfiltertabdialog.hxx | 13 ++- filter/source/xsltdialog/xmlfiltertabdialog.src | 49 --------- filter/source/xsltdialog/xmlfiltertabpagebasic.cxx | 1 - filter/source/xsltdialog/xmlfiltertabpagexslt.cxx | 1 - filter/uiconfig/ui/xsltfilterdialog.ui | 118 +++++++++++++++++++++ 12 files changed, 151 insertions(+), 173 deletions(-) delete mode 100644 filter/source/xsltdialog/xmlfiltercommon.hrc delete mode 100644 filter/source/xsltdialog/xmlfilterhelpids.hrc delete mode 100644 filter/source/xsltdialog/xmlfiltertabdialog.src create mode 100644 filter/uiconfig/ui/xsltfilterdialog.ui diff --git a/filter/AllLangResTarget_xsltdlg.mk b/filter/AllLangResTarget_xsltdlg.mk index 316d0a24ce18..34262e21926e 100644 --- a/filter/AllLangResTarget_xsltdlg.mk +++ b/filter/AllLangResTarget_xsltdlg.mk @@ -30,7 +30,6 @@ $(eval $(call gb_SrsTarget_set_include,filter/xsltdlg,\ )) $(eval $(call gb_SrsTarget_add_files,filter/xsltdlg,\ - filter/source/xsltdialog/xmlfiltertabdialog.src \ filter/source/xsltdialog/xmlfilterdialogstrings.src \ )) diff --git a/filter/UIConfig_xsltdlg.mk b/filter/UIConfig_xsltdlg.mk index a54c4e8c4108..6b7b48faaba6 100644 --- a/filter/UIConfig_xsltdlg.mk +++ b/filter/UIConfig_xsltdlg.mk @@ -21,6 +21,7 @@ $(eval $(call gb_UIConfig_add_uifiles,filter,\ filter/uiconfig/ui/xmlfiltersettings \ filter/uiconfig/ui/xmlfiltertabpagegeneral \ filter/uiconfig/ui/xmlfiltertabpagetransformation \ + filter/uiconfig/ui/xsltfilterdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/filter/source/xsltdialog/xmlfiltercommon.hrc b/filter/source/xsltdialog/xmlfiltercommon.hrc deleted file mode 100644 index 9081799afcdd..000000000000 --- a/filter/source/xsltdialog/xmlfiltercommon.hrc +++ /dev/null @@ -1,32 +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 _XMLFILTERCOMMON_HRC_ -#define _XMLFILTERCOMMON_HRC_ - -#include "filter.hrc" - -#define DLG_XML_SOURCE_FILE_DIALOG (RID_XSLT_DIALOG_START+0) -#define DLG_XML_FILTER_TABDIALOG (RID_XSLT_DIALOG_START+1) -#define RID_XML_FILTER_TABPAGE_BASIC (RID_XSLT_DIALOG_START+2) -#define RID_XML_FILTER_TABPAGE_XSLT (RID_XSLT_DIALOG_START+3) -#define DLG_XML_FILTER_TEST_DIALOG (RID_XSLT_DIALOG_START+4) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/xsltdialog/xmlfilterdialogstrings.hrc b/filter/source/xsltdialog/xmlfilterdialogstrings.hrc index fa7c152ae650..8eb75169598d 100644 --- a/filter/source/xsltdialog/xmlfilterdialogstrings.hrc +++ b/filter/source/xsltdialog/xmlfilterdialogstrings.hrc @@ -20,7 +20,7 @@ #ifndef _XMLFILTERDIALOGSTRINGS_HRC_ #define _XMLFILTERDIALOGSTRINGS_HRC_ -#include "xmlfiltercommon.hrc" +#include "filter.hrc" #define STR_COLUMN_HEADER_NAME (RID_XSLT_DIALOG_START + 0) #define STR_COLUMN_HEADER_TYPE (RID_XSLT_DIALOG_START + 1) diff --git a/filter/source/xsltdialog/xmlfilterhelpids.hrc b/filter/source/xsltdialog/xmlfilterhelpids.hrc deleted file mode 100644 index ff6624a3f254..000000000000 --- a/filter/source/xsltdialog/xmlfilterhelpids.hrc +++ /dev/null @@ -1,28 +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 _XMLFILTERHELPIDS_HRC_ -#define _XMLFILTERHELPIDS_HRC_ - -#define HID_XML_FILTER_TABDIALOG "FILTER_HID_XML_FILTER_TABDIALOG" - -#define HID_XML_FILTER_TABPAGE_CTRL "FILTER_HID_XML_FILTER_TABPAGE_CTRL" - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index b9f89e046c21..699bbfe5a961 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -42,7 +42,6 @@ #include "xmlfiltertabdialog.hxx" #include "xmlfiltertestdialog.hxx" #include "xmlfilterjar.hxx" -#include "xmlfilterhelpids.hrc" using namespace osl; using namespace com::sun::star::lang; diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index 65ed311f0239..42b4a94a3f0c 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -25,29 +25,23 @@ #include "xmlfilterdialogstrings.hrc" #include "xmlfiltertabdialog.hxx" -#include "xmlfiltercommon.hrc" #include "xmlfiltertabpagebasic.hxx" #include "xmlfiltertabpagexslt.hxx" #include "xmlfiltersettingsdialog.hxx" -#include "xmlfilterhelpids.hrc" using namespace com::sun::star::uno; using namespace com::sun::star::container; using namespace com::sun::star::beans; using namespace com::sun::star::lang; -XMLFilterTabDialog::XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const Reference< XComponentContext >& rxContext, const filter_info_impl* pInfo ) : - TabDialog( pParent, ResId( DLG_XML_FILTER_TABDIALOG, rResMgr ) ), - mxContext( rxContext ), - mrResMgr( rResMgr ), - maTabCtrl( this, ResId( 1, rResMgr ) ), - maOKBtn( this ), - maCancelBtn( this ), - maHelpBtn( this ) +XMLFilterTabDialog::XMLFilterTabDialog(Window *pParent, ResMgr& rResMgr, + const Reference< XComponentContext >& rxContext, const filter_info_impl* pInfo) + : TabDialog(pParent, "XSLTFilterDialog","filter/ui/xsltfilterdialog.ui") + , mxContext(rxContext) + , mrResMgr(rResMgr) { - FreeResource(); - - maTabCtrl.SetHelpId( HID_XML_FILTER_TABPAGE_CTRL ); + get(m_pOKBtn, "ok"); + get(m_pTabCtrl, "tabcontrol"); mpOldInfo = pInfo; mpNewInfo = new filter_info_impl( *mpOldInfo ); @@ -56,45 +50,24 @@ XMLFilterTabDialog::XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const aTitle = aTitle.replaceAll("%s", mpNewInfo->maFilterName); SetText( aTitle ); - maTabCtrl.Show(); - maOKBtn.Show(); - maCancelBtn.Show(); - maHelpBtn.Show(); - - maOKBtn.SetClickHdl( LINK( this, XMLFilterTabDialog, OkHdl ) ); + m_pOKBtn->SetClickHdl( LINK( this, XMLFilterTabDialog, OkHdl ) ); - maTabCtrl.SetActivatePageHdl( LINK( this, XMLFilterTabDialog, ActivatePageHdl ) ); - maTabCtrl.SetDeactivatePageHdl( LINK( this, XMLFilterTabDialog, DeactivatePageHdl ) ); + m_pTabCtrl->SetActivatePageHdl( LINK( this, XMLFilterTabDialog, ActivatePageHdl ) ); + m_pTabCtrl->SetDeactivatePageHdl( LINK( this, XMLFilterTabDialog, DeactivatePageHdl ) ); - mpBasicPage = new XMLFilterTabPageBasic(&maTabCtrl); + mpBasicPage = new XMLFilterTabPageBasic(m_pTabCtrl); mpBasicPage->SetInfo( mpNewInfo ); - maTabCtrl.SetTabPage( RID_XML_FILTER_TABPAGE_BASIC, mpBasicPage ); - - Size aSiz = mpBasicPage->GetOptimalSize(); - Size aCtrlSiz = maTabCtrl.GetTabPageSizePixel(); - // set size on TabControl only if smaller than TabPage - if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() ) - { - maTabCtrl.SetTabPageSizePixel( aSiz ); - aCtrlSiz = aSiz; - } + m_nBasicPageId = m_pTabCtrl->GetPageId("general"); + m_pTabCtrl->SetTabPage(m_nBasicPageId, mpBasicPage); - mpXSLTPage = new XMLFilterTabPageXSLT( &maTabCtrl); + mpXSLTPage = new XMLFilterTabPageXSLT(m_pTabCtrl); mpXSLTPage->SetInfo( mpNewInfo ); - maTabCtrl.SetTabPage( RID_XML_FILTER_TABPAGE_XSLT, mpXSLTPage ); - - aSiz = mpXSLTPage->GetOptimalSize(); - if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() ) - { - maTabCtrl.SetTabPageSizePixel( aSiz ); - aCtrlSiz = aSiz; - } - - ActivatePageHdl( &maTabCtrl ); + m_nXSLTPageId = m_pTabCtrl->GetPageId("transformation"); + m_pTabCtrl->SetTabPage(m_nXSLTPageId, mpXSLTPage); - AdjustLayout(); + ActivatePageHdl(m_pTabCtrl); } // ----------------------------------------------------------------------- @@ -136,7 +109,7 @@ bool XMLFilterTabDialog::onOk() { if( xFilterContainer->hasByName( mpNewInfo->maFilterName ) ) { - nErrorPage = RID_XML_FILTER_TABPAGE_BASIC; + nErrorPage = m_nBasicPageId; nErrorId = STR_ERROR_FILTER_NAME_EXISTS; pFocusWindow = (mpBasicPage->m_pEDFilterName); aReplace1 = mpNewInfo->maFilterName; @@ -191,7 +164,7 @@ bool XMLFilterTabDialog::onOk() pValues->Value >>= aInterfaceName; if( aInterfaceName == mpNewInfo->maInterfaceName ) { - nErrorPage = RID_XML_FILTER_TABPAGE_BASIC; + nErrorPage = m_nBasicPageId; nErrorId = STR_ERROR_TYPE_NAME_EXISTS; pFocusWindow = (mpBasicPage->m_pEDInterfaceName); aReplace1 = mpNewInfo->maInterfaceName; @@ -219,7 +192,7 @@ bool XMLFilterTabDialog::onOk() if( aRC != osl::File::E_None ) { nErrorId = STR_ERROR_EXPORT_XSLT_NOT_FOUND; - nErrorPage = RID_XML_FILTER_TABPAGE_XSLT; + nErrorPage = m_nXSLTPageId; pFocusWindow = (mpXSLTPage->m_pEDExportXSLT); } } @@ -235,7 +208,7 @@ bool XMLFilterTabDialog::onOk() if( aRC != osl::File::E_None ) { nErrorId = STR_ERROR_IMPORT_XSLT_NOT_FOUND; - nErrorPage = RID_XML_FILTER_TABPAGE_XSLT; + nErrorPage = m_nXSLTPageId; pFocusWindow = (mpXSLTPage->m_pEDImportTemplate); } } @@ -245,7 +218,7 @@ bool XMLFilterTabDialog::onOk() if((mpNewInfo->maImportXSLT.isEmpty()) && (mpNewInfo->maExportXSLT.isEmpty()) ) { nErrorId = STR_ERROR_EXPORT_XSLT_NOT_FOUND; - nErrorPage = RID_XML_FILTER_TABPAGE_XSLT; + nErrorPage = m_nXSLTPageId; pFocusWindow = (mpXSLTPage->m_pEDExportXSLT); } @@ -259,7 +232,7 @@ bool XMLFilterTabDialog::onOk() if( aRC != osl::File::E_None ) { nErrorId = STR_ERROR_IMPORT_TEMPLATE_NOT_FOUND; - nErrorPage = RID_XML_FILTER_TABPAGE_XSLT; + nErrorPage = m_nXSLTPageId; pFocusWindow = (mpXSLTPage->m_pEDImportTemplate); } } @@ -267,8 +240,8 @@ bool XMLFilterTabDialog::onOk() if( 0 != nErrorId ) { - maTabCtrl.SetCurPageId( (sal_uInt16)nErrorPage ); - ActivatePageHdl( &maTabCtrl ); + m_pTabCtrl->SetCurPageId((sal_uInt16)nErrorPage); + ActivatePageHdl(m_pTabCtrl); ResId aResId( nErrorId, mrResMgr ); OUString aMessage( aResId ); diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.hxx b/filter/source/xsltdialog/xmlfiltertabdialog.hxx index f7af2fc9dd3d..563ad53314ab 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.hxx @@ -34,11 +34,9 @@ class XMLFilterTabPageXSLT; class XMLFilterTabDialog: public TabDialog { public: - XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo ); + XMLFilterTabDialog(Window *pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo); virtual ~XMLFilterTabDialog(); - ResMgr& getResMgr() { return mrResMgr; } - bool onOk(); filter_info_impl* getNewFilterInfo() const; @@ -55,10 +53,11 @@ private: const filter_info_impl* mpOldInfo; filter_info_impl* mpNewInfo; - TabControl maTabCtrl; - OKButton maOKBtn; - CancelButton maCancelBtn; - HelpButton maHelpBtn; + TabControl* m_pTabCtrl; + OKButton* m_pOKBtn; + + sal_Int16 m_nBasicPageId; + sal_Int16 m_nXSLTPageId; XMLFilterTabPageBasic* mpBasicPage; XMLFilterTabPageXSLT* mpXSLTPage; diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.src b/filter/source/xsltdialog/xmlfiltertabdialog.src deleted file mode 100644 index 9b3e1018315c..000000000000 --- a/filter/source/xsltdialog/xmlfiltertabdialog.src +++ /dev/null @@ -1,49 +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 "xmlfiltercommon.hrc" -#include "xmlfilterhelpids.hrc" - -TabDialog DLG_XML_FILTER_TABDIALOG -{ - HelpId = HID_XML_FILTER_TABDIALOG; - OutputSize = TRUE ; - SvLook = TRUE ; - Moveable = TRUE ; - Text [ en-US ] = "XML Filter: %s" ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem RID_XML_FILTER_TABPAGE_BASIC - { - Identifier = RID_XML_FILTER_TABPAGE_BASIC ; - Text [ en-US ] = "General" ; - }; - PageItem RID_XML_FILTER_TABPAGE_XSLT - { - Identifier = RID_XML_FILTER_TABPAGE_XSLT ; - Text [ en-US ] = "Transformation" ; - }; - }; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx index 095161aaae27..88670c874a11 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx @@ -22,7 +22,6 @@ #include "xmlfilterdialogstrings.hrc" #include "xmlfiltertabpagebasic.hxx" #include "xmlfiltersettingsdialog.hxx" -#include "xmlfilterhelpids.hrc" XMLFilterTabPageBasic::XMLFilterTabPageBasic(Window* pParent) : TabPage(pParent, "XmlFilterTabPageGeneral", "filter/ui/xmlfiltertabpagegeneral.ui") diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx index c32fb369880e..317dba8a3839 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx @@ -28,7 +28,6 @@ #include "xmlfiltertabpagexslt.hxx" #include "xmlfiltersettingsdialog.hxx" -#include "xmlfilterhelpids.hrc" using namespace ::rtl; using namespace ::com::sun::star::uno; diff --git a/filter/uiconfig/ui/xsltfilterdialog.ui b/filter/uiconfig/ui/xsltfilterdialog.ui new file mode 100644 index 000000000000..743e31d81953 --- /dev/null +++ b/filter/uiconfig/ui/xsltfilterdialog.ui @@ -0,0 +1,118 @@ + + + + + False + 6 + XML Filter: %s + dialog + + + False + vertical + 12 + + + False + end + + + gtk-ok + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + + + False + True + 1 + + + + + gtk-help + True + True + True + True + + + False + True + 2 + + + + + False + True + end + 0 + + + + + True + True + True + True + + + + + + True + False + General + + + False + + + + + + + + True + False + Transformation + + + 1 + False + + + + + False + True + 1 + + + + + + ok + cancel + help + + + -- cgit