diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/scabstdlg.hxx | 11 | ||||
-rw-r--r-- | sc/qa/unit/screenshots/screenshots.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 20 | ||||
-rw-r--r-- | sc/source/ui/inc/strindlg.hxx | 25 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/scuiautofmt.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/strindlg.cxx | 42 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshf.cxx | 4 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/inputstringdialog.ui | 15 |
9 files changed, 85 insertions, 78 deletions
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 32757d2c9f2e..d90cc4ed9810 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -503,11 +503,12 @@ public: bool bEdit, bool bSheetProtected ) = 0; virtual VclPtr<AbstractScShowTabDlg> CreateScShowTabDlg(vcl::Window* pParent) = 0; - virtual VclPtr<AbstractScStringInputDlg> CreateScStringInputDlg ( vcl::Window* pParent, - const OUString& rTitle, - const OUString& rEditTitle, - const OUString& rDefault, - const OString& sHelpId, const OString& sEditHelpId ) = 0; + virtual VclPtr<AbstractScStringInputDlg> CreateScStringInputDlg(weld::Window* pParent, + const OUString& rTitle, + const OUString& rEditTitle, + const OUString& rDefault, + const OString& rHelpId, + const OString& rEditHelpId) = 0; virtual VclPtr<AbstractScTabBgColorDlg> CreateScTabBgColorDlg ( vcl::Window* pParent, const OUString& rTitle, //Dialog Title diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index 2c32d2c75874..8d01ad5c9cfa 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -26,6 +26,7 @@ #include <svl/srchitem.hxx> #include <svx/numinf.hxx> #include <vcl/pngwrite.hxx> +#include <vcl/weld.hxx> #include <tabvwsh.hxx> #include <docsh.hxx> @@ -207,7 +208,8 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID) case 8: // "modules/scalc/ui/inputstringdialog.ui" { const OString aEmpty(""); - pReturnDialog = mpFact->CreateScStringInputDlg(mpViewShell->GetDialogParent(), + vcl::Window* pWindow = mpViewShell->GetDialogParent(); + pReturnDialog = mpFact->CreateScStringInputDlg(pWindow ? pWindow->GetFrameWeld() : nullptr, ScResId(SCSTR_APDTABLE), ScResId(SCSTR_NAME), aDefaultSheetName, aEmpty, aEmpty ); break; diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index f1cb49ae299d..b263ca09cc94 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -105,7 +105,6 @@ IMPL_ABSTDLG_BASE(AbstractScDPShowDetailDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScNewScenarioDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScSortWarningDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl); @@ -576,9 +575,14 @@ OUString AbstractScShowTabDlg_Impl::GetSelectedEntry(sal_Int32 nPos) const return pDlg->GetSelectedEntry(nPos); } +short AbstractScStringInputDlg_Impl::Execute() +{ + return m_xDlg->run(); +} + OUString AbstractScStringInputDlg_Impl::GetInputString() const { - return pDlg->GetInputString(); + return m_xDlg->GetInputString(); } void AbstractScTabBgColorDlg_Impl::GetSelectedColor( Color& rColor ) const @@ -835,14 +839,12 @@ VclPtr<AbstractScShowTabDlg> ScAbstractDialogFactory_Impl::CreateScShowTabDlg(vc return VclPtr<AbstractScShowTabDlg_Impl>::Create( pDlg ); } -VclPtr<AbstractScStringInputDlg> ScAbstractDialogFactory_Impl::CreateScStringInputDlg ( vcl::Window* pParent, - const OUString& rTitle, - const OUString& rEditTitle, - const OUString& rDefault, - const OString& sHelpId, const OString& sEditHelpId ) +VclPtr<AbstractScStringInputDlg> ScAbstractDialogFactory_Impl::CreateScStringInputDlg(weld::Window* pParent, + const OUString& rTitle, const OUString& rEditTitle, const OUString& rDefault, const OString& rHelpId, + const OString& rEditHelpId) { - VclPtr<ScStringInputDlg> pDlg = VclPtr<ScStringInputDlg>::Create( pParent, rTitle, rEditTitle, rDefault, sHelpId, sEditHelpId ); - return VclPtr<AbstractScStringInputDlg_Impl>::Create( pDlg ); + return VclPtr<AbstractScStringInputDlg_Impl>::Create(new ScStringInputDlg(pParent, rTitle, rEditTitle, + rDefault, rHelpId, rEditHelpId)); } VclPtr<AbstractScTabBgColorDlg> ScAbstractDialogFactory_Impl::CreateScTabBgColorDlg( diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index a139d7fd70aa..33d471fec7af 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -352,7 +352,14 @@ class AbstractScSortWarningDlg_Impl : public AbstractScSortWarningDlg class AbstractScStringInputDlg_Impl : public AbstractScStringInputDlg { - DECL_ABSTDLG_BASE( AbstractScStringInputDlg_Impl, ScStringInputDlg ) +protected: + std::unique_ptr<ScStringInputDlg> m_xDlg; +public: + explicit AbstractScStringInputDlg_Impl(ScStringInputDlg* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual OUString GetInputString() const override; }; @@ -501,11 +508,12 @@ public: bool bEdit, bool bSheetProtected ) override; virtual VclPtr<AbstractScShowTabDlg> CreateScShowTabDlg(vcl::Window* pParent) override; - virtual VclPtr<AbstractScStringInputDlg> CreateScStringInputDlg ( vcl::Window* pParent, - const OUString& rTitle, - const OUString& rEditTitle, - const OUString& rDefault, - const OString& sHelpId, const OString& sEditHelpId ) override; + virtual VclPtr<AbstractScStringInputDlg> CreateScStringInputDlg(weld::Window* pParent, + const OUString& rTitle, + const OUString& rEditTitle, + const OUString& rDefault, + const OString& rHelpId, + const OString& rEditHelpId) override; virtual VclPtr<AbstractScTabBgColorDlg> CreateScTabBgColorDlg ( vcl::Window* pParent, const OUString& rTitle, //Dialog Title diff --git a/sc/source/ui/inc/strindlg.hxx b/sc/source/ui/inc/strindlg.hxx index 94268fb4c3c5..22dd85049f47 100644 --- a/sc/source/ui/inc/strindlg.hxx +++ b/sc/source/ui/inc/strindlg.hxx @@ -20,28 +20,29 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_STRINDLG_HXX #define INCLUDED_SC_SOURCE_UI_INC_STRINDLG_HXX -#include <vcl/dialog.hxx> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> +#include <vcl/weld.hxx> -class ScStringInputDlg : public ModalDialog +class ScStringInputDlg { +private: + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Dialog> m_xDialog; + std::unique_ptr<weld::Label> m_xLabel; + std::unique_ptr<weld::Entry> m_xEdInput; + public: - ScStringInputDlg(vcl::Window* pParent, + ScStringInputDlg(weld::Window* pParent, const OUString& rTitle, const OUString& rEditTitle, const OUString& rDefault, const OString& sHelpId, const OString& sEditHelpId); - virtual ~ScStringInputDlg() override; - virtual void dispose() override; + + short run() { return m_xDialog->run(); } + OUString GetInputString() const { - return m_pEdInput->GetText(); + return m_xEdInput->get_text(); } - -private: - VclPtr<FixedText> m_pFtEditTitle; - VclPtr<Edit> m_pEdInput; }; #endif // INCLUDED_SC_SOURCE_UI_INC_STRINDLG_HXX diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index 57579606eaa0..6682fe385e16 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -220,15 +220,12 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl, Button*, void) while ( !bOk ) { - VclPtrInstance<ScStringInputDlg> pDlg( this, - aStrTitle, - aStrLabel, - aFormatName, - HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME ); + ScStringInputDlg aDlg(GetFrameWeld(), aStrTitle, aStrLabel, aFormatName, + HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME); - if ( pDlg->Execute() == RET_OK ) + if (aDlg.run() == RET_OK) { - aFormatName = pDlg->GetInputString(); + aFormatName = aDlg.GetInputString(); if ( !aFormatName.isEmpty() && aFormatName != aStrStandard && pFormat->find(aFormatName) == pFormat->end() ) { @@ -326,15 +323,12 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl, Button*, void) OUString aFormatName = m_pLbFormat->GetSelectedEntry(); OUString aEntry; - VclPtrInstance<ScStringInputDlg> pDlg( this, - aStrRename, - aStrLabel, - aFormatName, - HID_SC_REN_AFMT_DLG, HID_SC_REN_AFMT_NAME ); - if( pDlg->Execute() == RET_OK ) + ScStringInputDlg aDlg(GetFrameWeld(), aStrRename, aStrLabel, aFormatName, + HID_SC_REN_AFMT_DLG, HID_SC_REN_AFMT_NAME); + if (aDlg.run() == RET_OK) { bool bFmtRenamed = false; - aFormatName = pDlg->GetInputString(); + aFormatName = aDlg.GetInputString(); if (!aFormatName.isEmpty()) { diff --git a/sc/source/ui/miscdlgs/strindlg.cxx b/sc/source/ui/miscdlgs/strindlg.cxx index 145517ec599a..da9da0387e9a 100644 --- a/sc/source/ui/miscdlgs/strindlg.cxx +++ b/sc/source/ui/miscdlgs/strindlg.cxx @@ -21,34 +21,24 @@ #include <strindlg.hxx> #include <scresid.hxx> +#include <vcl/svapp.hxx> -ScStringInputDlg::ScStringInputDlg( vcl::Window* pParent, - const OUString& rTitle, - const OUString& rEditTitle, - const OUString& rDefault, - const OString& sHelpId, const OString& sEditHelpId ) - : ModalDialog(pParent, "InputStringDialog", "modules/scalc/ui/inputstringdialog.ui") +ScStringInputDlg::ScStringInputDlg(weld::Window* pParent, + const OUString& rTitle, + const OUString& rEditTitle, + const OUString& rDefault, + const OString& rHelpId, const OString& rEditHelpId) + : m_xBuilder(Application::CreateBuilder(pParent, "modules/scalc/ui/inputstringdialog.ui")) + , m_xDialog(m_xBuilder->weld_dialog("InputStringDialog")) + , m_xLabel(m_xBuilder->weld_label("description_label")) + , m_xEdInput(m_xBuilder->weld_entry("name_entry")) { - SetHelpId( sHelpId ); - SetText( rTitle ); - get(m_pFtEditTitle, "description_label"); - m_pFtEditTitle->SetText(rEditTitle); - get(m_pEdInput, "name_entry"); - m_pEdInput->SetText( rDefault ); - m_pEdInput->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); - m_pEdInput->SetHelpId( sEditHelpId ); -} - -ScStringInputDlg::~ScStringInputDlg() -{ - disposeOnce(); -} - -void ScStringInputDlg::dispose() -{ - m_pFtEditTitle.clear(); - m_pEdInput.clear(); - ModalDialog::dispose(); + m_xLabel->set_label(rEditTitle); + m_xDialog->set_title(rTitle); + m_xDialog->set_help_id(rHelpId); + m_xEdInput->set_text(rDefault); + m_xEdInput->set_help_id(rEditHelpId); + m_xEdInput->select_region(0, -1); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 2549dbc8caad..ae3a8bc6ac88 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -389,8 +389,9 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); + vcl::Window* pWin = GetDialogParent(); ScopedVclPtr<AbstractScStringInputDlg> pDlg(pFact->CreateScStringInputDlg( - GetDialogParent(), aDlgTitle, ScResId(SCSTR_NAME), + pWin ? pWin->GetFrameWeld() : nullptr, aDlgTitle, ScResId(SCSTR_NAME), aName, GetStaticInterface()->GetSlot(nSlot)->GetCommand(), pHelpId)); @@ -429,7 +430,6 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } else { - vcl::Window* pWin = GetDialogParent(); std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, VclMessageType::Warning, VclButtonsType::Ok, aErrMsg)); nRet = xBox->run(); diff --git a/sc/uiconfig/scalc/ui/inputstringdialog.ui b/sc/uiconfig/scalc/ui/inputstringdialog.ui index c4356e9a1535..65cd93061b4f 100644 --- a/sc/uiconfig/scalc/ui/inputstringdialog.ui +++ b/sc/uiconfig/scalc/ui/inputstringdialog.ui @@ -1,10 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sc"> <requires lib="gtk+" version="3.0"/> <object class="GtkDialog" id="InputStringDialog"> <property name="can_focus">False</property> <property name="border_width">6</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"> @@ -79,10 +82,13 @@ <object class="GtkLabel" id="description_label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="use_underline">True</property> <property name="wrap">True</property> <property name="mnemonic_widget">name_entry</property> + <property name="xalign">0</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> </object> <packing> <property name="expand">False</property> @@ -95,7 +101,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">•</property> - <property name="width_chars">24</property> + <property name="width_chars">30</property> </object> <packing> <property name="expand">False</property> @@ -117,5 +123,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |