convert xslt filter dialog to .ui

Change-Id: I02bb629af1f4811f382469b8e2aaaba272f07034
This commit is contained in:
Caolán McNamara 2013-07-30 20:47:54 +01:00
parent 8fa9fb87ee
commit 8bcbc765a2
12 changed files with 151 additions and 173 deletions

View file

@ -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 \
))

View file

@ -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:

View file

@ -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: */

View file

@ -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)

View file

@ -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: */

View file

@ -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;

View file

@ -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();
m_pOKBtn->SetClickHdl( LINK( this, XMLFilterTabDialog, OkHdl ) );
maOKBtn.SetClickHdl( LINK( this, XMLFilterTabDialog, OkHdl ) );
m_pTabCtrl->SetActivatePageHdl( LINK( this, XMLFilterTabDialog, ActivatePageHdl ) );
m_pTabCtrl->SetDeactivatePageHdl( LINK( this, XMLFilterTabDialog, DeactivatePageHdl ) );
maTabCtrl.SetActivatePageHdl( LINK( this, XMLFilterTabDialog, ActivatePageHdl ) );
maTabCtrl.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 );
m_nBasicPageId = m_pTabCtrl->GetPageId("general");
m_pTabCtrl->SetTabPage(m_nBasicPageId, 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;
}
mpXSLTPage = new XMLFilterTabPageXSLT( &maTabCtrl);
mpXSLTPage = new XMLFilterTabPageXSLT(m_pTabCtrl);
mpXSLTPage->SetInfo( mpNewInfo );
maTabCtrl.SetTabPage( RID_XML_FILTER_TABPAGE_XSLT, mpXSLTPage );
m_nXSLTPageId = m_pTabCtrl->GetPageId("transformation");
m_pTabCtrl->SetTabPage(m_nXSLTPageId, mpXSLTPage);
aSiz = mpXSLTPage->GetOptimalSize();
if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() )
{
maTabCtrl.SetTabPageSizePixel( aSiz );
aCtrlSiz = aSiz;
}
ActivatePageHdl( &maTabCtrl );
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 );

View file

@ -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;

View file

@ -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: */

View file

@ -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")

View file

@ -28,7 +28,6 @@
#include "xmlfiltertabpagexslt.hxx"
#include "xmlfiltersettingsdialog.hxx"
#include "xmlfilterhelpids.hrc"
using namespace ::rtl;
using namespace ::com::sun::star::uno;

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="XSLTFilterDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">XML Filter: %s</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkNotebook" id="tabcontrol">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<placeholder/>
</child>
<child type="tab">
<object class="GtkLabel" id="general">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">General</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<object class="GtkLabel" id="transformation">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Transformation</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">help</action-widget>
</action-widgets>
</object>
</interface>