diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-19 10:44:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-19 17:57:22 +0200 |
commit | a1533910d896f18980a37c7a9c15154366dacae3 (patch) | |
tree | 97f53cdba75a7ecb20d8ed37186e58d889311dbd /filter | |
parent | 4bacf58f4af44ac8c4632b43289ccfcc07e5820c (diff) |
weld XMLFilterTabDialog
Change-Id: I5ef92805690f55913e6366fce1fd4dc5180bb5a6
Reviewed-on: https://gerrit.libreoffice.org/53146
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 12 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabdialog.cxx | 90 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabdialog.hxx | 25 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagebasic.cxx | 62 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagebasic.hxx | 26 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagexslt.cxx | 117 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagexslt.hxx | 52 | ||||
-rw-r--r-- | filter/uiconfig/ui/xmlfiltertabpagegeneral.ui | 22 | ||||
-rw-r--r-- | filter/uiconfig/ui/xmlfiltertabpagetransformation.ui | 43 | ||||
-rw-r--r-- | filter/uiconfig/ui/xsltfilterdialog.ui | 56 |
10 files changed, 249 insertions, 256 deletions
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index d9c1a03dfcdd..c0cfa1b0c327 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -236,11 +236,11 @@ void XMLFilterSettingsDialog::onNew() aTempInfo.maDocumentService = "com.sun.star.text.TextDocument"; // execute XML Filter Dialog - ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, mxContext, &aTempInfo ); - if ( aDlg->Execute() == RET_OK ) + XMLFilterTabDialog aDlg(GetFrameWeld(), mxContext, &aTempInfo); + if (aDlg.run() == RET_OK) { // insert the new filter - insertOrEdit( aDlg->getNewFilterInfo() ); + insertOrEdit( aDlg.getNewFilterInfo() ); } } @@ -255,10 +255,10 @@ void XMLFilterSettingsDialog::onEdit() filter_info_impl* pOldInfo = static_cast<filter_info_impl*>(pEntry->GetUserData()); // execute XML Filter Dialog - ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, mxContext, pOldInfo ); - if ( aDlg->Execute() == RET_OK ) + XMLFilterTabDialog aDlg(GetFrameWeld(), mxContext, pOldInfo); + if (aDlg.run() == RET_OK) { - filter_info_impl* pNewInfo = aDlg->getNewFilterInfo(); + filter_info_impl* pNewInfo = aDlg.getNewFilterInfo(); if( !(*pOldInfo == *pNewInfo) ) { diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index b153cb67ea2f..2f8f5e306506 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -36,65 +36,41 @@ using namespace com::sun::star::container; using namespace com::sun::star::beans; using namespace com::sun::star::lang; -XMLFilterTabDialog::XMLFilterTabDialog(vcl::Window *pParent, +XMLFilterTabDialog::XMLFilterTabDialog(weld::Window *pParent, const Reference< XComponentContext >& rxContext, const filter_info_impl* pInfo) - : TabDialog(pParent, "XSLTFilterDialog","filter/ui/xsltfilterdialog.ui") + : GenericDialogController(pParent, "filter/ui/xsltfilterdialog.ui", "XSLTFilterDialog") , mxContext(rxContext) + , m_xTabCtrl(m_xBuilder->weld_notebook("tabcontrol")) + , m_xOKBtn(m_xBuilder->weld_button("ok")) + , mpBasicPage(new XMLFilterTabPageBasic(m_xTabCtrl->get_page("general"))) + , mpXSLTPage(new XMLFilterTabPageXSLT(m_xTabCtrl->get_page("transformation"), m_xDialog.get())) { - get(m_pOKBtn, "ok"); - get(m_pTabCtrl, "tabcontrol"); - mpOldInfo = pInfo; mpNewInfo = new filter_info_impl( *mpOldInfo ); - OUString aTitle( GetText() ); + OUString aTitle(m_xDialog->get_title()); aTitle = aTitle.replaceAll("%s", mpNewInfo->maFilterName); - SetText( aTitle ); - - m_pOKBtn->SetClickHdl( LINK( this, XMLFilterTabDialog, OkHdl ) ); + m_xDialog->set_title(aTitle); - m_pTabCtrl->SetActivatePageHdl( LINK( this, XMLFilterTabDialog, ActivatePageHdl ) ); + m_xOKBtn->connect_clicked( LINK( this, XMLFilterTabDialog, OkHdl ) ); - mpBasicPage = VclPtr<XMLFilterTabPageBasic>::Create(m_pTabCtrl); mpBasicPage->SetInfo( mpNewInfo ); - - m_nBasicPageId = m_pTabCtrl->GetPageId("general"); - m_pTabCtrl->SetTabPage(m_nBasicPageId, mpBasicPage); - - mpXSLTPage = VclPtr<XMLFilterTabPageXSLT>::Create(m_pTabCtrl); mpXSLTPage->SetInfo( mpNewInfo ); - - m_nXSLTPageId = m_pTabCtrl->GetPageId("transformation"); - m_pTabCtrl->SetTabPage(m_nXSLTPageId, mpXSLTPage); - - ActivatePageHdl(nullptr, m_pTabCtrl); } - XMLFilterTabDialog::~XMLFilterTabDialog() { - disposeOnce(); -} - -void XMLFilterTabDialog::dispose() -{ - mpBasicPage.disposeAndClear(); - mpXSLTPage.disposeAndClear(); delete mpNewInfo; - m_pTabCtrl.clear(); - m_pOKBtn.clear(); - TabDialog::dispose(); } - bool XMLFilterTabDialog::onOk() { mpXSLTPage->FillInfo( mpNewInfo ); mpBasicPage->FillInfo( mpNewInfo ); - sal_uInt16 nErrorPage = 0; + OString sErrorPage; const char* pErrorId = nullptr; - vcl::Window* pFocusWindow = nullptr; + weld::Widget* pFocusWindow = nullptr; OUString aReplace1; OUString aReplace2; @@ -115,9 +91,9 @@ bool XMLFilterTabDialog::onOk() { if( xFilterContainer->hasByName( mpNewInfo->maFilterName ) ) { - nErrorPage = m_nBasicPageId; + sErrorPage = "general"; pErrorId = STR_ERROR_FILTER_NAME_EXISTS; - pFocusWindow = mpBasicPage->m_pEDFilterName; + pFocusWindow = mpBasicPage->m_xEDFilterName.get(); aReplace1 = mpNewInfo->maFilterName; } @@ -170,9 +146,9 @@ bool XMLFilterTabDialog::onOk() pValues->Value >>= aInterfaceName; if( aInterfaceName == mpNewInfo->maInterfaceName ) { - nErrorPage = m_nBasicPageId; + sErrorPage = "general"; pErrorId = STR_ERROR_TYPE_NAME_EXISTS; - pFocusWindow = mpBasicPage->m_pEDInterfaceName; + pFocusWindow = mpBasicPage->m_xEDInterfaceName.get(); aReplace1 = mpNewInfo->maInterfaceName; aReplace2 = *pFilterName; } @@ -198,8 +174,8 @@ bool XMLFilterTabDialog::onOk() if( aRC != osl::File::E_None ) { pErrorId = STR_ERROR_EXPORT_XSLT_NOT_FOUND; - nErrorPage = m_nXSLTPageId; - pFocusWindow = mpXSLTPage->m_pEDExportXSLT; + sErrorPage = "transformation"; + pFocusWindow = mpXSLTPage->m_xEDExportXSLT->getWidget(); } } } @@ -214,8 +190,8 @@ bool XMLFilterTabDialog::onOk() if( aRC != osl::File::E_None ) { pErrorId = STR_ERROR_IMPORT_XSLT_NOT_FOUND; - nErrorPage = m_nXSLTPageId; - pFocusWindow = mpXSLTPage->m_pEDImportTemplate; + sErrorPage = "transformation"; + pFocusWindow = mpXSLTPage->m_xEDImportTemplate->getWidget(); } } } @@ -224,8 +200,8 @@ bool XMLFilterTabDialog::onOk() if((mpNewInfo->maImportXSLT.isEmpty()) && (mpNewInfo->maExportXSLT.isEmpty()) ) { pErrorId = STR_ERROR_EXPORT_XSLT_NOT_FOUND; - nErrorPage = m_nXSLTPageId; - pFocusWindow = mpXSLTPage->m_pEDExportXSLT; + sErrorPage = "transformation"; + pFocusWindow = mpXSLTPage->m_xEDExportXSLT->getWidget(); } if (!pErrorId) @@ -238,16 +214,15 @@ bool XMLFilterTabDialog::onOk() if( aRC != osl::File::E_None ) { pErrorId = STR_ERROR_IMPORT_TEMPLATE_NOT_FOUND; - nErrorPage = m_nXSLTPageId; - pFocusWindow = mpXSLTPage->m_pEDImportTemplate; + sErrorPage = "transformation"; + pFocusWindow = mpXSLTPage->m_xEDImportTemplate->getWidget(); } } } if (pErrorId) { - m_pTabCtrl->SetCurPageId(nErrorPage); - ActivatePageHdl(nullptr, m_pTabCtrl); + m_xTabCtrl->set_current_page(sErrorPage); OUString aMessage(XsltResId(pErrorId)); @@ -261,13 +236,13 @@ bool XMLFilterTabDialog::onOk() aMessage = aMessage.replaceAll( "%s", aReplace1 ); } - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Warning, VclButtonsType::Ok, aMessage)); xBox->run(); if( pFocusWindow ) - pFocusWindow->GrabFocus(); + pFocusWindow->grab_focus(); return false; } @@ -277,19 +252,10 @@ bool XMLFilterTabDialog::onOk() } } - -IMPL_LINK_NOARG(XMLFilterTabDialog, OkHdl, Button*, void) +IMPL_LINK_NOARG(XMLFilterTabDialog, OkHdl, weld::Button&, void) { if( onOk() ) - EndDialog(1); -} - - -IMPL_STATIC_LINK( XMLFilterTabDialog, ActivatePageHdl, TabControl *, pTabCtrl, void ) -{ - const sal_uInt16 nId = pTabCtrl->GetCurPageId(); - TabPage* pTabPage = pTabCtrl->GetTabPage( nId ); - pTabPage->Show(); + m_xDialog->response(RET_OK); } diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.hxx b/filter/source/xsltdialog/xmlfiltertabdialog.hxx index 0e9b02ac2bff..475a8c34225a 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.hxx @@ -20,22 +20,17 @@ #define INCLUDED_FILTER_SOURCE_XSLTDIALOG_XMLFILTERTABDIALOG_HXX #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <vcl/tabctrl.hxx> -#include <vcl/tabdlg.hxx> -#include <vcl/button.hxx> - -namespace vcl { class Window; } +#include <vcl/weld.hxx> class filter_info_impl; class XMLFilterTabPageBasic; class XMLFilterTabPageXSLT; -class XMLFilterTabDialog: public TabDialog +class XMLFilterTabDialog : public weld::GenericDialogController { public: - XMLFilterTabDialog(vcl::Window *pParent, const css::uno::Reference< css::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo); + XMLFilterTabDialog(weld::Window *pParent, const css::uno::Reference< css::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo); virtual ~XMLFilterTabDialog() override; - virtual void dispose() override; bool onOk(); @@ -44,20 +39,16 @@ public: private: css::uno::Reference< css::uno::XComponentContext > mxContext; - DECL_STATIC_LINK( XMLFilterTabDialog, ActivatePageHdl, TabControl*, void ); - DECL_LINK(OkHdl, Button*, void); + DECL_LINK(OkHdl, weld::Button&, void); const filter_info_impl* mpOldInfo; filter_info_impl* mpNewInfo; - VclPtr<TabControl> m_pTabCtrl; - VclPtr<OKButton> m_pOKBtn; - - sal_Int16 m_nBasicPageId; - sal_Int16 m_nXSLTPageId; + std::unique_ptr<weld::Notebook> m_xTabCtrl; + std::unique_ptr<weld::Button> m_xOKBtn; - VclPtr<XMLFilterTabPageBasic> mpBasicPage; - VclPtr<XMLFilterTabPageXSLT> mpXSLTPage; + std::unique_ptr<XMLFilterTabPageBasic> mpBasicPage; + std::unique_ptr<XMLFilterTabPageXSLT> mpXSLTPage; }; diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx index a86e68a67f6b..3db0c58ac267 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx @@ -23,37 +23,27 @@ #include "xmlfiltertabpagebasic.hxx" #include "xmlfiltersettingsdialog.hxx" -XMLFilterTabPageBasic::XMLFilterTabPageBasic(vcl::Window* pParent) - : TabPage(pParent, "XmlFilterTabPageGeneral", "filter/ui/xmlfiltertabpagegeneral.ui") +XMLFilterTabPageBasic::XMLFilterTabPageBasic(weld::Widget* pPage) + : m_xBuilder(Application::CreateBuilder(pPage, "filter/ui/xmlfiltertabpagegeneral.ui")) + , m_xContainer(m_xBuilder->weld_widget("XmlFilterTabPageGeneral")) + , m_xEDFilterName(m_xBuilder->weld_entry("filtername")) + , m_xCBApplication(m_xBuilder->weld_combo_box_text("application")) + , m_xEDInterfaceName(m_xBuilder->weld_entry("interfacename")) + , m_xEDExtension(m_xBuilder->weld_entry("extension")) + , m_xEDDescription(m_xBuilder->weld_text_view("description")) { - get(m_pEDFilterName, "filtername"); - get(m_pCBApplication, "application"); - get(m_pEDInterfaceName,"interfacename"); - get(m_pEDExtension, "extension"); - get(m_pEDDescription, "description"); - m_pEDDescription->set_height_request(m_pEDDescription->GetTextHeight() * 4); + m_xEDDescription->set_size_request(-1, m_xEDDescription->get_height_rows(4)); std::vector< application_info_impl* >& rInfos = getApplicationInfos(); for (auto const& info : rInfos) { OUString aEntry( info->maDocumentUIName ); - m_pCBApplication->InsertEntry( aEntry ); + m_xCBApplication->append_text( aEntry ); } } XMLFilterTabPageBasic::~XMLFilterTabPageBasic() { - disposeOnce(); -} - -void XMLFilterTabPageBasic::dispose() -{ - m_pEDFilterName.clear(); - m_pCBApplication.clear(); - m_pEDInterfaceName.clear(); - m_pEDExtension.clear(); - m_pEDDescription.clear(); - TabPage::dispose(); } static OUString checkExtensions( const OUString& rExtensions ) @@ -86,19 +76,19 @@ void XMLFilterTabPageBasic::FillInfo( filter_info_impl* pInfo ) { if( pInfo ) { - if( !m_pEDFilterName->GetText().isEmpty() ) - pInfo->maFilterName = m_pEDFilterName->GetText(); + if( !m_xEDFilterName->get_text().isEmpty() ) + pInfo->maFilterName = m_xEDFilterName->get_text(); - if( !m_pCBApplication->GetText().isEmpty() ) - pInfo->maDocumentService = m_pCBApplication->GetText(); + if( !m_xCBApplication->get_active_text().isEmpty() ) + pInfo->maDocumentService = m_xCBApplication->get_active_text(); - if( !m_pEDInterfaceName->GetText().isEmpty() ) - pInfo->maInterfaceName = m_pEDInterfaceName->GetText(); + if( !m_xEDInterfaceName->get_text().isEmpty() ) + pInfo->maInterfaceName = m_xEDInterfaceName->get_text(); - if( !m_pEDExtension->GetText().isEmpty() ) - pInfo->maExtension = checkExtensions( m_pEDExtension->GetText() ); + if( !m_xEDExtension->get_text().isEmpty() ) + pInfo->maExtension = checkExtensions( m_xEDExtension->get_text() ); - pInfo->maComment = string_encode( m_pEDDescription->GetText() ); + pInfo->maComment = string_encode( m_xEDDescription->get_text() ); if( !pInfo->maDocumentService.isEmpty() ) { @@ -121,18 +111,18 @@ void XMLFilterTabPageBasic::SetInfo(const filter_info_impl* pInfo) { if( pInfo ) { - m_pEDFilterName->SetText( string_decode(pInfo->maFilterName) ); + m_xEDFilterName->set_text( string_decode(pInfo->maFilterName) ); /* if( pInfo->maDocumentService.getLength() ) - maCBApplication.SetText( getApplicationUIName( pInfo->maDocumentService ) ); + maCBApplication.set_text( getApplicationUIName( pInfo->maDocumentService ) ); */ if( !pInfo->maExportService.isEmpty() ) - m_pCBApplication->SetText( getApplicationUIName( pInfo->maExportService ) ); + m_xCBApplication->set_entry_text( getApplicationUIName( pInfo->maExportService ) ); else - m_pCBApplication->SetText( getApplicationUIName( pInfo->maImportService ) ); - m_pEDInterfaceName->SetText( string_decode(pInfo->maInterfaceName) ); - m_pEDExtension->SetText( pInfo->maExtension ); - m_pEDDescription->SetText( string_decode( pInfo->maComment ) ); + m_xCBApplication->set_entry_text( getApplicationUIName( pInfo->maImportService ) ); + m_xEDInterfaceName->set_text( string_decode(pInfo->maInterfaceName) ); + m_xEDExtension->set_text( pInfo->maExtension ); + m_xEDDescription->set_text( string_decode( pInfo->maComment ) ); } } diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx index e366703e8a0c..22e2787ac554 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx +++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx @@ -19,30 +19,26 @@ #ifndef INCLUDED_FILTER_SOURCE_XSLTDIALOG_XMLFILTERTABPAGEBASIC_HXX #define INCLUDED_FILTER_SOURCE_XSLTDIALOG_XMLFILTERTABPAGEBASIC_HXX -#include <sfx2/tabdlg.hxx> -#include <vcl/fixed.hxx> -#include <vcl/edit.hxx> -#include <vcl/combobox.hxx> -#include <svtools/svmedit.hxx> +#include <vcl/weld.hxx> -namespace vcl { class Window; } class filter_info_impl; -class XMLFilterTabPageBasic : public TabPage +class XMLFilterTabPageBasic { public: - explicit XMLFilterTabPageBasic(vcl::Window* pParent); - virtual ~XMLFilterTabPageBasic() override; - virtual void dispose() override; + explicit XMLFilterTabPageBasic(weld::Widget* pPage); + ~XMLFilterTabPageBasic(); void FillInfo( filter_info_impl* pInfo ); void SetInfo(const filter_info_impl* pInfo); - VclPtr<Edit> m_pEDFilterName; - VclPtr<ComboBox> m_pCBApplication; - VclPtr<Edit> m_pEDInterfaceName; - VclPtr<Edit> m_pEDExtension; - VclPtr<VclMultiLineEdit> m_pEDDescription; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Widget> m_xContainer; + std::unique_ptr<weld::Entry> m_xEDFilterName; + std::unique_ptr<weld::ComboBoxText> m_xCBApplication; + std::unique_ptr<weld::Entry> m_xEDInterfaceName; + std::unique_ptr<weld::Entry> m_xEDExtension; + std::unique_ptr<weld::TextView> m_xEDDescription; }; #endif diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx index 80b6a65a5bba..6c5a12db9b3e 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx @@ -30,56 +30,41 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( vcl::Window* pParent) : - TabPage( pParent, "XmlFilterTabPageTransformation", "filter/ui/xmlfiltertabpagetransformation.ui" ), - - sInstPath( "$(prog)/" ) +XMLFilterTabPageXSLT::XMLFilterTabPageXSLT(weld::Widget* pPage, weld::Dialog* pDialog) + : sInstPath( "$(prog)/" ) + , m_pDialog(pDialog) + , m_xBuilder(Application::CreateBuilder(pPage, "filter/ui/xmlfiltertabpagetransformation.ui")) + , m_xContainer(m_xBuilder->weld_widget("XmlFilterTabPageTransformation")) + , m_xEDDocType(m_xBuilder->weld_entry("doc")) + , m_xEDExportXSLT(new URLBox(m_xBuilder->weld_combo_box_text("xsltexport"))) + , m_xPBExprotXSLT(m_xBuilder->weld_button("browseexport")) + , m_xEDImportXSLT(new URLBox(m_xBuilder->weld_combo_box_text("xsltimport"))) + , m_xPBImportXSLT(m_xBuilder->weld_button("browseimport")) + , m_xEDImportTemplate(new URLBox(m_xBuilder->weld_combo_box_text("tempimport"))) + , m_xPBImportTemplate(m_xBuilder->weld_button("browsetemp")) + , m_xCBNeedsXSLT2(m_xBuilder->weld_check_button("filtercb")) { - get(m_pEDDocType,"doc"); - get(m_pEDExportXSLT,"xsltexport"); - get(m_pPBExprotXSLT,"browseexport"); - get(m_pEDImportXSLT,"xsltimport"); - get(m_pPBImportXSLT,"browseimport"); - get(m_pEDImportTemplate,"tempimport"); - get(m_pPBImportTemplate,"browsetemp"); - get(m_pCBNeedsXSLT2,"filtercb"); - - SvtPathOptions aOptions; sInstPath = aOptions.SubstituteVariable( sInstPath ); - m_pPBExprotXSLT->SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) ); - m_pPBImportXSLT->SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) ); - m_pPBImportTemplate->SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) ); + m_xPBExprotXSLT->connect_clicked( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) ); + m_xPBImportXSLT->connect_clicked( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) ); + m_xPBImportTemplate->connect_clicked( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) ); } XMLFilterTabPageXSLT::~XMLFilterTabPageXSLT() { - disposeOnce(); -} - -void XMLFilterTabPageXSLT::dispose() -{ - m_pEDDocType.clear(); - m_pEDExportXSLT.clear(); - m_pPBExprotXSLT.clear(); - m_pEDImportXSLT.clear(); - m_pPBImportXSLT.clear(); - m_pEDImportTemplate.clear(); - m_pPBImportTemplate.clear(); - m_pCBNeedsXSLT2.clear(); - TabPage::dispose(); } void XMLFilterTabPageXSLT::FillInfo( filter_info_impl* pInfo ) { if( pInfo ) { - pInfo->maDocType = m_pEDDocType->GetText(); - pInfo->maExportXSLT = GetURL( m_pEDExportXSLT ); - pInfo->maImportXSLT = GetURL( m_pEDImportXSLT ); - pInfo->maImportTemplate = GetURL( m_pEDImportTemplate ); - pInfo->mbNeedsXSLT2 = m_pCBNeedsXSLT2->IsChecked(); + pInfo->maDocType = m_xEDDocType->get_text(); + pInfo->maExportXSLT = GetURL(*m_xEDExportXSLT); + pInfo->maImportXSLT = GetURL(*m_xEDImportXSLT); + pInfo->maImportTemplate = GetURL(*m_xEDImportTemplate); + pInfo->mbNeedsXSLT2 = m_xCBNeedsXSLT2->get_active(); } } @@ -87,16 +72,16 @@ void XMLFilterTabPageXSLT::SetInfo(const filter_info_impl* pInfo) { if( pInfo ) { - m_pEDDocType->SetText( pInfo->maDocType ); + m_xEDDocType->set_text( pInfo->maDocType ); - SetURL( m_pEDExportXSLT, pInfo->maExportXSLT ); - SetURL( m_pEDImportXSLT, pInfo->maImportXSLT ); - SetURL( m_pEDImportTemplate, pInfo->maImportTemplate ); - m_pCBNeedsXSLT2->Check( pInfo->mbNeedsXSLT2 ); + SetURL( *m_xEDExportXSLT, pInfo->maExportXSLT ); + SetURL( *m_xEDImportXSLT, pInfo->maImportXSLT ); + SetURL( *m_xEDImportTemplate, pInfo->maImportTemplate ); + m_xCBNeedsXSLT2->set_active(pInfo->mbNeedsXSLT2); } } -void XMLFilterTabPageXSLT::SetURL( SvtURLBox* rURLBox, const OUString& rURL ) +void XMLFilterTabPageXSLT::SetURL( URLBox& rURLBox, const OUString& rURL ) { OUString aPath; @@ -104,15 +89,15 @@ void XMLFilterTabPageXSLT::SetURL( SvtURLBox* rURLBox, const OUString& rURL ) { osl::FileBase::getSystemPathFromFileURL( rURL, aPath ); - rURLBox->SetBaseURL( rURL ); - rURLBox->SetText( aPath ); + rURLBox.SetBaseURL( rURL ); + rURLBox.SetText( aPath ); } else if( rURL.matchIgnoreAsciiCase( "http://" ) || rURL.matchIgnoreAsciiCase( "https://" ) || rURL.matchIgnoreAsciiCase( "ftp://" ) ) { - rURLBox->SetBaseURL( rURL ); - rURLBox->SetText( rURL ); + rURLBox.SetBaseURL( rURL ); + rURLBox.SetText( rURL ); } else if( !rURL.isEmpty() ) { @@ -120,20 +105,20 @@ void XMLFilterTabPageXSLT::SetURL( SvtURLBox* rURLBox, const OUString& rURL ) aURL = URIHelper::SmartRel2Abs( INetURLObject(sInstPath), aURL, Link<OUString *, bool>(), false ); osl::FileBase::getSystemPathFromFileURL( aURL, aPath ); - rURLBox->SetBaseURL( aURL ); - rURLBox->SetText( aPath ); + rURLBox.SetBaseURL( aURL ); + rURLBox.SetText( aPath ); } else { - rURLBox->SetBaseURL( sInstPath ); - rURLBox->SetText( "" ); + rURLBox.SetBaseURL( sInstPath ); + rURLBox.SetText( "" ); } } -OUString XMLFilterTabPageXSLT::GetURL( SvtURLBox const * rURLBox ) +OUString XMLFilterTabPageXSLT::GetURL(const URLBox& rURLBox) { OUString aURL; - OUString aStrPath ( rURLBox->GetText() ); + OUString aStrPath(rURLBox.get_active_text()); if( aStrPath.matchIgnoreAsciiCase( "http://" ) || aStrPath.matchIgnoreAsciiCase( "https://" ) || aStrPath.matchIgnoreAsciiCase( "ftp://" ) ) @@ -148,35 +133,33 @@ OUString XMLFilterTabPageXSLT::GetURL( SvtURLBox const * rURLBox ) return aURL; } -IMPL_LINK ( XMLFilterTabPageXSLT, ClickBrowseHdl_Impl, Button *, pButton, void ) +IMPL_LINK ( XMLFilterTabPageXSLT, ClickBrowseHdl_Impl, weld::Button&, rButton, void ) { - SvtURLBox* pURLBox; + URLBox* pURLBox; - if( pButton == m_pPBExprotXSLT ) + if( &rButton == m_xPBExprotXSLT.get() ) { - pURLBox = m_pEDExportXSLT; + pURLBox = m_xEDExportXSLT.get(); } - else if( pButton == m_pPBImportXSLT ) + else if( &rButton == m_xPBImportXSLT.get() ) { - pURLBox = m_pEDImportXSLT; + pURLBox = m_xEDImportXSLT.get(); } else { - pURLBox = m_pEDImportTemplate; + pURLBox = m_xEDImportTemplate.get(); } // Open Fileopen-Dialog - ::sfx2::FileDialogHelper aDlg( - css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - FileDialogFlags::NONE, GetFrameWeld()); + ::sfx2::FileDialogHelper aDlg(css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, + FileDialogFlags::NONE, m_pDialog); - aDlg.SetDisplayDirectory( GetURL( pURLBox ) ); + aDlg.SetDisplayDirectory(GetURL(*pURLBox)); - if ( aDlg.Execute() == ERRCODE_NONE ) + if (aDlg.Execute() == ERRCODE_NONE) { - OUString aURL( aDlg.GetPath() ); - - SetURL( pURLBox, aURL ); + OUString aURL(aDlg.GetPath()); + SetURL(*pURLBox, aURL); } } diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx index ae0ca61429da..076e91ce364d 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx @@ -20,46 +20,40 @@ #define INCLUDED_FILTER_SOURCE_XSLTDIALOG_XMLFILTERTABPAGEXSLT_HXX #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <sfx2/tabdlg.hxx> -#include <vcl/fixed.hxx> -#include <vcl/edit.hxx> -#include <vcl/combobox.hxx> +#include <vcl/weld.hxx> #include <svtools/inettbc.hxx> namespace vcl { class Window; } class filter_info_impl; -class XMLFilterTabPageXSLT : public TabPage +class XMLFilterTabPageXSLT { +private: + void SetURL(URLBox& rURLBox, const OUString& rURL); + static OUString GetURL(const URLBox& rURLBox); + + OUString sInstPath; + public: - explicit XMLFilterTabPageXSLT(vcl::Window* pParent); - virtual ~XMLFilterTabPageXSLT() override; - virtual void dispose() override; + explicit XMLFilterTabPageXSLT(weld::Widget* pPage, weld::Dialog* pDialog); + ~XMLFilterTabPageXSLT(); void FillInfo( filter_info_impl* pInfo ); void SetInfo(const filter_info_impl* pInfo); - DECL_LINK( ClickBrowseHdl_Impl, Button *, void ); - - - VclPtr<Edit> m_pEDDocType; - - VclPtr<SvtURLBox> m_pEDExportXSLT; - VclPtr<PushButton> m_pPBExprotXSLT; - - VclPtr<SvtURLBox> m_pEDImportXSLT; - VclPtr<PushButton> m_pPBImportXSLT; - - VclPtr<SvtURLBox> m_pEDImportTemplate; - VclPtr<PushButton> m_pPBImportTemplate; - - VclPtr<CheckBox> m_pCBNeedsXSLT2; - -private: - void SetURL( SvtURLBox *rURLBox, const OUString& rURL ); - static OUString GetURL( SvtURLBox const * rURLBox ); - - OUString sInstPath; + DECL_LINK( ClickBrowseHdl_Impl, weld::Button&, void ); + + weld::Dialog* m_pDialog; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Widget> m_xContainer; + std::unique_ptr<weld::Entry> m_xEDDocType; + std::unique_ptr<URLBox> m_xEDExportXSLT; + std::unique_ptr<weld::Button> m_xPBExprotXSLT; + std::unique_ptr<URLBox> m_xEDImportXSLT; + std::unique_ptr<weld::Button> m_xPBImportXSLT; + std::unique_ptr<URLBox> m_xEDImportTemplate; + std::unique_ptr<weld::Button> m_xPBImportTemplate; + std::unique_ptr<weld::CheckButton> m_xCBNeedsXSLT2; }; #endif diff --git a/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui b/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui index aad12c579a93..b44d0f9fc0d9 100644 --- a/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui +++ b/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.4 --> <interface domain="flt"> <requires lib="gtk+" version="3.18"/> <object class="GtkBox" id="XmlFilterTabPageGeneral"> @@ -19,10 +19,10 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label2">_Filter name:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">filtername</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -33,10 +33,10 @@ <object class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label3">_Application:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">application</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -47,10 +47,10 @@ <object class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label4">_Name of file type:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">interfacename</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -61,10 +61,10 @@ <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label5">File _extension:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">extension</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -75,11 +75,11 @@ <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="yalign">0</property> <property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label6">Comment_s:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">description:border</property> + <property name="mnemonic_widget">description</property> + <property name="xalign">1</property> + <property name="yalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -91,6 +91,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> + <property name="activates_default">True</property> <property name="width_chars">38</property> </object> <packing> @@ -103,6 +104,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> + <property name="activates_default">True</property> <property name="width_chars">6</property> </object> <packing> @@ -115,6 +117,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> + <property name="activates_default">True</property> <property name="width_chars">38</property> </object> <packing> @@ -131,6 +134,7 @@ <child internal-child="entry"> <object class="GtkEntry" id="comboboxtext-entry"> <property name="can_focus">False</property> + <property name="activates_default">True</property> </object> </child> </object> @@ -147,7 +151,7 @@ <property name="vexpand">True</property> <property name="shadow_type">in</property> <child> - <object class="GtkTextView" id="description:border"> + <object class="GtkTextView" id="description"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> diff --git a/filter/uiconfig/ui/xmlfiltertabpagetransformation.ui b/filter/uiconfig/ui/xmlfiltertabpagetransformation.ui index 44e42f5c10b9..5c48dc0cc58c 100644 --- a/filter/uiconfig/ui/xmlfiltertabpagetransformation.ui +++ b/filter/uiconfig/ui/xmlfiltertabpagetransformation.ui @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.4 --> <interface domain="flt"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkBox" id="XmlFilterTabPageTransformation"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -21,10 +20,10 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="xmlfiltertabpagetransformation|label2">_DocType:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">doc</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -36,6 +35,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="width_chars">32</property> </object> <packing> @@ -47,10 +47,10 @@ <object class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="xmlfiltertabpagetransformation|label4">_XSLT for export:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">xsltexport</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -74,10 +74,10 @@ <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="xmlfiltertabpagetransformation|label5">XSLT _for import:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">xsltimport</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -101,10 +101,10 @@ <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="xmlfiltertabpagetransformation|label6">Template for _import:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">tempimport</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -124,23 +124,33 @@ </packing> </child> <child> - <object class="svtlo-SvtURLBox" id="tempimport"> + <object class="GtkComboBoxText" id="xsltexport"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="max_width_chars">2</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">True</property> + </object> + </child> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="top_attach">1</property> </packing> </child> <child> - <object class="svtlo-SvtURLBox" id="xsltimport"> + <object class="GtkComboBoxText" id="xsltimport"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="max_width_chars">2</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">True</property> + </object> + </child> </object> <packing> <property name="left_attach">1</property> @@ -148,15 +158,20 @@ </packing> </child> <child> - <object class="svtlo-SvtURLBox" id="xsltexport"> + <object class="GtkComboBoxText" id="tempimport"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="max_width_chars">2</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">True</property> + </object> + </child> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="top_attach">3</property> </packing> </child> <child> diff --git a/filter/uiconfig/ui/xsltfilterdialog.ui b/filter/uiconfig/ui/xsltfilterdialog.ui index 604e8cd683a8..9c9fa14059d0 100644 --- a/filter/uiconfig/ui/xsltfilterdialog.ui +++ b/filter/uiconfig/ui/xsltfilterdialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.20.4 --> <interface domain="flt"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="XSLTFilterDialog"> @@ -7,6 +7,9 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="xsltfilterdialog|XSLTFilterDialog">XML Filter: %s</property> <property name="resizable">False</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -83,6 +86,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> <child type="tab"> @@ -102,6 +129,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">1</property> @@ -132,5 +183,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |