diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-12 13:42:04 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-13 09:58:31 +0200 |
commit | 2b2fe50f33f7d677098f3ebafa8357aea848c0ea (patch) | |
tree | e0c57d555ae443ecb93b2219cc6dbf972debb595 /sw | |
parent | 34d362b5c249f78ed05c5b069fa90e9597d29c04 (diff) |
weld SwAsciiFilterDlg and set an explicit parent for the dialog
Change-Id: Ie2a52a9e2ea7f41a336b227de670cd5f688d7cd4
Reviewed-on: https://gerrit.libreoffice.org/52778
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 'sw')
-rw-r--r-- | sw/inc/swabstdlg.hxx | 4 | ||||
-rw-r--r-- | sw/source/ui/dialog/ascfldlg.cxx | 150 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/inc/SwXFilterOptions.hxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/inc/ascfldlg.hxx | 32 | ||||
-rw-r--r-- | sw/source/uibase/uno/SwXFilterOptions.cxx | 10 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/asciifilterdialog.ui | 71 |
8 files changed, 158 insertions, 144 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index c0e2484a4d75..953c5e0c8fd9 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -384,8 +384,8 @@ public: virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() = 0; virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) = 0; - virtual VclPtr<AbstractSwAsciiFilterDlg> CreateSwAsciiFilterDlg ( SwDocShell& rDocSh, - SvStream* pStream ) = 0; + virtual VclPtr<AbstractSwAsciiFilterDlg> CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh, + SvStream* pStream) = 0; virtual VclPtr<VclAbstractDialog> CreateSwInsertBookmarkDlg( vcl::Window *pParent, SwWrtShell &rSh, SfxRequest& rReq ) = 0; virtual VclPtr<AbstractSwBreakDlg> CreateSwBreakDlg(weld::Window *pParent, SwWrtShell &rSh) = 0; diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index b3cd4f6768c2..fb2a79760655 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -27,6 +27,7 @@ #include <i18nlangtag/mslangid.hxx> #include <com/sun/star/i18n/ScriptType.hpp> #include <unotools/lingucfg.hxx> +#include <unotools/viewoptions.hxx> #include <fontcfg.hxx> #include <swmodule.hxx> #include <editeng/unolingu.hxx> @@ -58,38 +59,43 @@ const sal_Int32 nDialogExtraDataLen = 11; // 12345678901 } -SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, +SwAsciiFilterDlg::SwAsciiFilterDlg( weld::Window* pParent, SwDocShell& rDocSh, SvStream* pStream ) - : SfxModalDialog(pParent, "AsciiFilterDialog", "modules/swriter/ui/asciifilterdialog.ui") + : GenericDialogController(pParent, "modules/swriter/ui/asciifilterdialog.ui", "AsciiFilterDialog") , m_bSaveLineStatus(true) + , m_xCharSetLB(new TextEncodingBox(m_xBuilder->weld_combo_box_text("charset"))) + , m_xFontFT(m_xBuilder->weld_label("fontft")) + , m_xFontLB(m_xBuilder->weld_combo_box_text("font")) + , m_xLanguageFT(m_xBuilder->weld_label("languageft")) + , m_xLanguageLB(new LanguageBox(m_xBuilder->weld_combo_box_text("language"))) + , m_xCRLF_RB(m_xBuilder->weld_radio_button("crlf")) + , m_xCR_RB(m_xBuilder->weld_radio_button("cr")) + , m_xLF_RB(m_xBuilder->weld_radio_button("lf")) { - get(m_pCharSetLB, "charset"); - m_pCharSetLB->SetStyle(m_pCharSetLB->GetStyle() | WB_SORT); - get(m_pFontFT, "fontft"); - get(m_pFontLB, "font"); - m_pFontLB->SetStyle(m_pFontLB->GetStyle() | WB_SORT); - get(m_pLanguageFT, "languageft"); - get(m_pLanguageLB, "language"); - m_pLanguageLB->SetStyle(m_pLanguageLB->GetStyle() | WB_SORT); - get(m_pCRLF_RB, "crlf"); - get(m_pCR_RB, "cr"); - get(m_pLF_RB, "lf"); + m_xFontLB->make_sorted(); SwAsciiOptions aOpt; { + SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + if (aDlgOpt.Exists()) + { + css::uno::Any aUserItem = aDlgOpt.GetUserItem("UserItem"); + aUserItem >>= m_sExtraData; + } + const OUString sFindNm = OUString::createFromAscii( pStream ? sDialogImpExtraData : sDialogExpExtraData); - sal_Int32 nEnd, nStt = GetExtraData().indexOf( sFindNm ); + sal_Int32 nEnd, nStt = m_sExtraData.indexOf( sFindNm ); if( -1 != nStt ) { nStt += nDialogExtraDataLen; - nEnd = GetExtraData().indexOf( cDialogExtraDataClose, nStt ); + nEnd = m_sExtraData.indexOf( cDialogExtraDataClose, nStt ); if( -1 != nEnd ) { - aOpt.ReadUserData( GetExtraData().copy( nStt, nEnd - nStt )); + aOpt.ReadUserData(m_sExtraData.copy(nStt, nEnd - nStt)); nStt -= nDialogExtraDataLen; - GetExtraData() = GetExtraData().replaceAt( nStt, nEnd - nStt + 1, "" ); + m_sExtraData = m_sExtraData.replaceAt(nStt, nEnd - nStt + 1, ""); } } } @@ -172,8 +178,8 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, } } - m_pLanguageLB->SetLanguageList( SvxLanguageListFlags::ALL, true ); - m_pLanguageLB->SelectLanguage( aOpt.GetLanguage() ); + m_xLanguageLB->SetLanguageList( SvxLanguageListFlags::ALL, true ); + m_xLanguageLB->SelectLanguage( aOpt.GetLanguage() ); } { @@ -201,7 +207,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, for( std::set< OUString >::const_iterator it = aFontNames.begin(); it != aFontNames.end(); ++it ) { - m_pFontLB->InsertEntry( *it ); + m_xFontLB->append_text(*it); } if( aOpt.GetFontName().isEmpty() ) @@ -211,7 +217,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, aOpt.SetFontName(aTmpFont.GetFamilyName()); } - m_pFontLB->SelectEntry( aOpt.GetFontName() ); + m_xFontLB->set_active(aOpt.GetFontName()); if( bDelPrinter ) pPrt.disposeAndClear(); @@ -221,56 +227,41 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, else { // hide the unused Controls for Export - m_pFontFT->Hide(); - m_pFontLB->Hide(); - m_pLanguageFT->Hide(); - m_pLanguageLB->Hide(); + m_xFontFT->hide(); + m_xFontLB->hide(); + m_xLanguageFT->hide(); + m_xLanguageLB->hide(); } // initialize character set - m_pCharSetLB->FillFromTextEncodingTable( pStream != nullptr ); - m_pCharSetLB->SelectTextEncoding( aOpt.GetCharSet() ); + m_xCharSetLB->FillFromTextEncodingTable( pStream != nullptr ); + m_xCharSetLB->SelectTextEncoding( aOpt.GetCharSet() ); - m_pCharSetLB->SetSelectHdl( LINK( this, SwAsciiFilterDlg, CharSetSelHdl )); - m_pCRLF_RB->SetToggleHdl( LINK( this, SwAsciiFilterDlg, LineEndHdl )); - m_pLF_RB->SetToggleHdl( LINK( this, SwAsciiFilterDlg, LineEndHdl )); - m_pCR_RB->SetToggleHdl( LINK( this, SwAsciiFilterDlg, LineEndHdl )); + m_xCharSetLB->connect_changed( LINK( this, SwAsciiFilterDlg, CharSetSelHdl )); + m_xCRLF_RB->connect_toggled( LINK( this, SwAsciiFilterDlg, LineEndHdl )); + m_xLF_RB->connect_toggled( LINK( this, SwAsciiFilterDlg, LineEndHdl )); + m_xCR_RB->connect_toggled( LINK( this, SwAsciiFilterDlg, LineEndHdl )); SetCRLF( aOpt.GetParaFlags() ); - m_pCRLF_RB->SaveValue(); - m_pLF_RB->SaveValue(); - m_pCR_RB->SaveValue(); + m_xCRLF_RB->save_state(); + m_xLF_RB->save_state(); + m_xCR_RB->save_state(); } SwAsciiFilterDlg::~SwAsciiFilterDlg() { - disposeOnce(); -} - -void SwAsciiFilterDlg::dispose() -{ - m_pCharSetLB.clear(); - m_pFontFT.clear(); - m_pFontLB.clear(); - m_pLanguageFT.clear(); - m_pLanguageLB.clear(); - m_pCRLF_RB.clear(); - m_pCR_RB.clear(); - m_pLF_RB.clear(); - SfxModalDialog::dispose(); } - void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions ) { - sal_uLong nCCode = m_pCharSetLB->GetSelectTextEncoding(); + sal_uLong nCCode = m_xCharSetLB->GetSelectTextEncoding(); OUString sFont; LanguageType nLng = LANGUAGE_SYSTEM; - if( m_pFontLB->IsVisible() ) + if (m_xFontLB->get_visible()) { - sFont = m_pFontLB->GetSelectedEntry(); - nLng = m_pLanguageLB->GetSelectedLanguage(); + sFont = m_xFontLB->get_active_text(); + nLng = m_xLanguageLB->GetSelectedLanguage(); } rOptions.SetFontName( sFont ); @@ -284,53 +275,58 @@ void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions ) if (!sData.isEmpty()) { const OUString sFindNm = OUString::createFromAscii( - m_pFontLB->IsVisible() ? sDialogImpExtraData + m_xFontLB->get_visible() ? sDialogImpExtraData : sDialogExpExtraData); - sal_Int32 nEnd, nStt = GetExtraData().indexOf( sFindNm ); + sal_Int32 nEnd, nStt = m_sExtraData.indexOf( sFindNm ); if( -1 != nStt ) { // called twice, so remove "old" settings - nEnd = GetExtraData().indexOf( cDialogExtraDataClose, + nEnd = m_sExtraData.indexOf( cDialogExtraDataClose, nStt + nDialogExtraDataLen ); if( -1 != nEnd ) - GetExtraData() = GetExtraData().replaceAt( nStt, nEnd - nStt + 1, "" ); + m_sExtraData = m_sExtraData.replaceAt( nStt, nEnd - nStt + 1, "" ); } - GetExtraData() += sFindNm + sData + OUStringLiteral1(cDialogExtraDataClose); + m_sExtraData += sFindNm + sData + OUStringLiteral1(cDialogExtraDataClose); } } void SwAsciiFilterDlg::SetCRLF( LineEnd eEnd ) { - switch( eEnd ) + switch (eEnd) { - case LINEEND_CR: m_pCR_RB->Check(); break; - case LINEEND_CRLF: m_pCRLF_RB->Check(); break; - case LINEEND_LF: m_pLF_RB->Check(); break; + case LINEEND_CR: + m_xCR_RB->set_active(true); + break; + case LINEEND_CRLF: + m_xCRLF_RB->set_active(true); + break; + case LINEEND_LF: + m_xLF_RB->set_active(true); + break; } } LineEnd SwAsciiFilterDlg::GetCRLF() const { LineEnd eEnd; - if( m_pCR_RB->IsChecked() ) + if(m_xCR_RB->get_active()) eEnd = LINEEND_CR; - else if( m_pLF_RB->IsChecked() ) + else if (m_xLF_RB->get_active()) eEnd = LINEEND_LF; else eEnd = LINEEND_CRLF; return eEnd; } -IMPL_LINK( SwAsciiFilterDlg, CharSetSelHdl, ListBox&, rListBox, void ) +IMPL_LINK_NOARG( SwAsciiFilterDlg, CharSetSelHdl, weld::ComboBoxText&, void ) { - SvxTextEncodingBox* pBox = static_cast<SvxTextEncodingBox*>(&rListBox); LineEnd eOldEnd = GetCRLF(), eEnd = LineEnd(-1); - LanguageType nLng = m_pFontLB->IsVisible() - ? m_pLanguageLB->GetSelectedLanguage() + LanguageType nLng = m_xFontLB->get_visible() + ? m_xLanguageLB->GetSelectedLanguage() : LANGUAGE_SYSTEM, nOldLng = nLng; - rtl_TextEncoding nChrSet = pBox->GetSelectTextEncoding(); + rtl_TextEncoding nChrSet = m_xCharSetLB->GetSelectTextEncoding(); if( nChrSet == osl_getThreadTextEncoding() ) eEnd = GetSystemLineEnd(); else @@ -386,20 +382,20 @@ IMPL_LINK( SwAsciiFilterDlg, CharSetSelHdl, ListBox&, rListBox, void ) else { // restore old user choice (not the automatic!) - m_pCRLF_RB->Check( m_pCRLF_RB->GetSavedValue() ); - m_pCR_RB->Check( m_pCR_RB->GetSavedValue() ); - m_pLF_RB->Check( m_pLF_RB->GetSavedValue() ); + m_xCRLF_RB->set_state(m_xCRLF_RB->get_saved_state()); + m_xCR_RB->set_state(m_xCR_RB->get_saved_state()); + m_xLF_RB->set_state(m_xLF_RB->get_saved_state()); } m_bSaveLineStatus = true; - if( nOldLng != nLng && m_pFontLB->IsVisible() ) - m_pLanguageLB->SelectLanguage( nLng ); + if (nOldLng != nLng && m_xFontLB->get_visible()) + m_xLanguageLB->SelectLanguage( nLng ); } -IMPL_LINK( SwAsciiFilterDlg, LineEndHdl, RadioButton&, rBtn, void ) +IMPL_LINK(SwAsciiFilterDlg, LineEndHdl, weld::ToggleButton&, rBtn, void) { - if( m_bSaveLineStatus ) - rBtn.SaveValue(); + if (m_bSaveLineStatus) + rBtn.save_state(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index e43e26335de8..7bf0470ac939 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -92,7 +92,10 @@ using namespace css::uno; IMPL_ABSTDLG_BASE(AbstractSwWordCountFloatDlg_Impl); IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl); IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSwAsciiFilterDlg_Impl); +short AbstractSwAsciiFilterDlg_Impl::Execute() +{ + return m_xDlg->run(); +} IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl); short AbstractSplitTableDialog_Impl::Execute() { @@ -227,7 +230,7 @@ void SwAbstractSfxDialog_Impl::SetText( const OUString& rStr ) void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions ) { - pDlg->FillOptions(rOptions); + m_xDlg->FillOptions(rOptions); } SplitTable_HeadlineOption AbstractSplitTableDialog_Impl::GetSplitMode() @@ -705,11 +708,10 @@ VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateNumFormatDialog( v return VclPtr<SwAbstractSfxDialog_Impl>::Create( pDlg ); } -VclPtr<AbstractSwAsciiFilterDlg> SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg( SwDocShell& rDocSh, - SvStream* pStream ) +VclPtr<AbstractSwAsciiFilterDlg> SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg(weld::Window* pParent, + SwDocShell& rDocSh, SvStream* pStream) { - VclPtr<SwAsciiFilterDlg> pDlg = VclPtr<SwAsciiFilterDlg>::Create( nullptr, rDocSh, pStream ); - return VclPtr<AbstractSwAsciiFilterDlg_Impl>::Create( pDlg ); + return VclPtr<AbstractSwAsciiFilterDlg_Impl>::Create(new SwAsciiFilterDlg(pParent, rDocSh, pStream)); } VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg( vcl::Window *pParent, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index a10c4845fde0..a2ec8568c22b 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -96,9 +96,15 @@ class SwAbstractSfxDialog_Impl :public SfxAbstractDialog class AbstractSwAsciiFilterDlg_Impl : public AbstractSwAsciiFilterDlg { - DECL_ABSTDLG_BASE( AbstractSwAsciiFilterDlg_Impl,SwAsciiFilterDlg ) +protected: + std::unique_ptr<SwAsciiFilterDlg> m_xDlg; +public: + explicit AbstractSwAsciiFilterDlg_Impl(SwAsciiFilterDlg* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual void FillOptions( SwAsciiOptions& rOptions ) override; - }; class VclAbstractDialog_Impl : public VclAbstractDialog @@ -500,8 +506,8 @@ public: SfxChildWindow* pChild, vcl::Window *pParent, SfxChildWinInfo* pInfo) override; virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() override; virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) override; - virtual VclPtr<AbstractSwAsciiFilterDlg> CreateSwAsciiFilterDlg ( SwDocShell& rDocSh, - SvStream* pStream ) override; + virtual VclPtr<AbstractSwAsciiFilterDlg> CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh, + SvStream* pStream) override; virtual VclPtr<VclAbstractDialog> CreateSwInsertBookmarkDlg( vcl::Window *pParent, SwWrtShell &rSh, SfxRequest& rReq ) override; virtual VclPtr<AbstractSwBreakDlg> CreateSwBreakDlg(weld::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<VclAbstractDialog> CreateSwChangeDBDlg(SwView& rVw) override; diff --git a/sw/source/uibase/inc/SwXFilterOptions.hxx b/sw/source/uibase/inc/SwXFilterOptions.hxx index ebf36a5aa885..85539e391ff7 100644 --- a/sw/source/uibase/inc/SwXFilterOptions.hxx +++ b/sw/source/uibase/inc/SwXFilterOptions.hxx @@ -19,10 +19,12 @@ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWXFILTEROPTIONS_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_SWXFILTEROPTIONS_HXX +#include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/beans/XPropertyAccess.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase.hxx> @@ -35,12 +37,14 @@ class SwXFilterOptions : public ::cppu::WeakImplHelper< css::ui::dialogs::XExecutableDialog, css::document::XImporter, css::document::XExporter, + css::lang::XInitialization, css::lang::XServiceInfo > { OUString sFilterOptions; css::uno::Reference< css::io::XInputStream > xInputStream; css::uno::Reference< css::lang::XComponent > xModel; + css::uno::Reference< css::awt::XWindow > xDialogParent; public: SwXFilterOptions(); @@ -64,6 +68,9 @@ public: virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override; + // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; diff --git a/sw/source/uibase/inc/ascfldlg.hxx b/sw/source/uibase/inc/ascfldlg.hxx index 99fbba32833f..81c75663fd6c 100644 --- a/sw/source/uibase/inc/ascfldlg.hxx +++ b/sw/source/uibase/inc/ascfldlg.hxx @@ -30,30 +30,30 @@ class SwAsciiOptions; class SvStream; class SwDocShell; -class SwAsciiFilterDlg : public SfxModalDialog +class SwAsciiFilterDlg : public weld::GenericDialogController { - VclPtr<SvxTextEncodingBox> m_pCharSetLB; - VclPtr<FixedText> m_pFontFT; - VclPtr<ListBox> m_pFontLB; - VclPtr<FixedText> m_pLanguageFT; - VclPtr<SvxLanguageBox> m_pLanguageLB; - VclPtr<RadioButton> m_pCRLF_RB; - VclPtr<RadioButton> m_pCR_RB; - VclPtr<RadioButton> m_pLF_RB; - bool m_bSaveLineStatus; - - DECL_LINK( CharSetSelHdl, ListBox&, void ); - DECL_LINK( LineEndHdl, RadioButton&, void ); + bool m_bSaveLineStatus; + OUString m_sExtraData; + + std::unique_ptr<TextEncodingBox> m_xCharSetLB; + std::unique_ptr<weld::Label> m_xFontFT; + std::unique_ptr<weld::ComboBoxText> m_xFontLB; + std::unique_ptr<weld::Label> m_xLanguageFT; + std::unique_ptr<LanguageBox> m_xLanguageLB; + std::unique_ptr<weld::RadioButton> m_xCRLF_RB; + std::unique_ptr<weld::RadioButton> m_xCR_RB; + std::unique_ptr<weld::RadioButton> m_xLF_RB; + + DECL_LINK(CharSetSelHdl, weld::ComboBoxText&, void); + DECL_LINK(LineEndHdl, weld::ToggleButton&, void); void SetCRLF( LineEnd eEnd ); LineEnd GetCRLF() const; public: // CTOR: for import - pStream is the inputstream // for export - pStream must be 0 - SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, - SvStream* pStream ); + SwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh, SvStream* pStream); virtual ~SwAsciiFilterDlg() override; - virtual void dispose() override; void FillOptions( SwAsciiOptions& rOptions ); }; diff --git a/sw/source/uibase/uno/SwXFilterOptions.cxx b/sw/source/uibase/uno/SwXFilterOptions.cxx index df404103e7e4..5a3dab86c7d5 100644 --- a/sw/source/uibase/uno/SwXFilterOptions.cxx +++ b/sw/source/uibase/uno/SwXFilterOptions.cxx @@ -24,6 +24,7 @@ #include <vcl/svapp.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#include <comphelper/namedvaluecollection.hxx> #include <comphelper/propertysequence.hxx> #include <cppuhelper/supportsservice.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -96,7 +97,7 @@ sal_Int16 SwXFilterOptions::execute() SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwAsciiFilterDlg> pAsciiDlg(pFact->CreateSwAsciiFilterDlg(*pDocShell, + ScopedVclPtr<AbstractSwAsciiFilterDlg> pAsciiDlg(pFact->CreateSwAsciiFilterDlg(Application::GetFrameWeld(xDialogParent), *pDocShell, pInStream.get())); OSL_ENSURE(pAsciiDlg, "Dialog creation failed!"); if(RET_OK == pAsciiDlg->Execute()) @@ -121,6 +122,13 @@ void SwXFilterOptions::setSourceDocument( const uno::Reference<XComponent >& x xModel = xDoc; } +void SAL_CALL SwXFilterOptions::initialize(const uno::Sequence<uno::Any>& rArguments) +{ + ::comphelper::NamedValueCollection aProperties(rArguments); + if (aProperties.has("ParentWindow")) + aProperties.get("ParentWindow") >>= xDialogParent; +} + OUString SwXFilterOptions::getImplementationName() { return OUString("com.sun.star.comp.Writer.FilterOptionsDialog"); diff --git a/sw/uiconfig/swriter/ui/asciifilterdialog.ui b/sw/uiconfig/swriter/ui/asciifilterdialog.ui index 3090754c94e6..6bd8f08c3820 100644 --- a/sw/uiconfig/swriter/ui/asciifilterdialog.ui +++ b/sw/uiconfig/swriter/ui/asciifilterdialog.ui @@ -1,11 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.4 --> <interface domain="sw"> - <!-- interface-requires gtk+ 3.0 --> - <!-- interface-requires LibreOffice 1.0 --> + <requires lib="gtk+" version="3.0"/> <object class="GtkDialog" id="AsciiFilterDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="asciifilterdialog|AsciiFilterDialog">ASCII Filter Options</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"> @@ -58,6 +61,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">2</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -93,67 +97,59 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="asciifilterdialog|label2">_Character set</property> <property name="use_underline">True</property> <property name="mnemonic_widget">charset</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="fontft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="asciifilterdialog|fontft">Default fonts</property> <property name="use_underline">True</property> <property name="mnemonic_widget">font</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="languageft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="asciifilterdialog|languageft">Lan_guage</property> <property name="use_underline">True</property> <property name="mnemonic_widget">language</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="asciifilterdialog|label5">_Paragraph break</property> <property name="use_underline">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="svxlo-SvxTextEncodingBox" id="charset"> + <object class="GtkComboBoxText" id="charset"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -161,8 +157,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -170,27 +164,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="entry_text_column">0</property> - <property name="id_column">1</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="svxcorelo-SvxLanguageBox" id="language"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -209,7 +186,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">cr</property> </object> <packing> <property name="expand">False</property> @@ -227,7 +203,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">lf</property> + <property name="group">crlf</property> </object> <packing> <property name="expand">False</property> @@ -257,8 +233,24 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="language"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">True</property> + <property name="activates_default">True</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> </packing> </child> </object> @@ -289,5 +281,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |