[Libreoffice-commits] core.git: include/vcl sc/inc sc/qa sc/source sc/uiconfig sw/source vcl/source vcl/unx
Caolán McNamara
caolanm at redhat.com
Thu Mar 1 10:41:30 UTC 2018
include/vcl/weld.hxx | 1
sc/inc/scabstdlg.hxx | 11 ++++---
sc/qa/unit/screenshots/screenshots.cxx | 4 ++
sc/source/ui/attrdlg/scdlgfact.cxx | 20 +++++++-------
sc/source/ui/attrdlg/scdlgfact.hxx | 20 ++++++++++----
sc/source/ui/inc/strindlg.hxx | 25 +++++++++--------
sc/source/ui/miscdlgs/scuiautofmt.cxx | 22 +++++----------
sc/source/ui/miscdlgs/strindlg.cxx | 42 +++++++++++-------------------
sc/source/ui/view/tabvwshf.cxx | 4 +-
sc/uiconfig/scalc/ui/inputstringdialog.ui | 15 ++++++++--
sw/source/ui/chrdlg/break.cxx | 2 -
sw/source/ui/dialog/swdlgfact.cxx | 2 -
sw/source/uibase/inc/break.hxx | 2 -
vcl/source/app/salvtables.cxx | 5 +++
vcl/unx/gtk3/gtk3gtkinst.cxx | 5 +++
15 files changed, 99 insertions(+), 81 deletions(-)
New commits:
commit b54046188c48b7031d0460ebab74125adc97f874
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 28 17:04:46 2018 +0000
weld ScStringInputDlg to native dialog
ScStringInputDlg and SwStringInputDlg do the same thing, but one uses the old
name as the label and leaves the new name blank in the entry. The other puts
the old name into the entry and autoselects it and uses a normal label. Both
are used from the rename button of the shared autoformat dialog.
Change-Id: I2ebf09a79f92c3f9020304e23e8907b67c06cd35
Reviewed-on: https://gerrit.libreoffice.org/50525
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 4b7887e1c45a..eaecaf11bd5b 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -279,6 +279,7 @@ public:
virtual void set_text(const OUString& rText) = 0;
virtual OUString get_text() const = 0;
virtual void set_width_chars(int nChars) = 0;
+ virtual void select_region(int nStartPos, int nEndPos) = 0;
void connect_changed(const Link<Entry&, void>& rLink) { m_aChangeHdl = rLink; }
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>
diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx
index c6b61d34acce..5611fafbe0c5 100644
--- a/sw/source/ui/chrdlg/break.cxx
+++ b/sw/source/ui/chrdlg/break.cxx
@@ -36,7 +36,7 @@
#include <strings.hrc>
#include <SwStyleNameMapper.hxx>
-short SwBreakDlg::Execute()
+short SwBreakDlg::run()
{
short nRet = m_xDialog->run();
if (nRet == RET_OK)
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 95f0e34a99bc..47acb1cbef8c 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -95,7 +95,7 @@ IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl);
short AbstractSwBreakDlg_Impl::Execute()
{
- return m_xDlg->Execute();
+ return m_xDlg->run();
}
IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractSwConvertTableDlg_Impl);
diff --git a/sw/source/uibase/inc/break.hxx b/sw/source/uibase/inc/break.hxx
index 17ac6f34bbc9..58b5faecfe43 100644
--- a/sw/source/uibase/inc/break.hxx
+++ b/sw/source/uibase/inc/break.hxx
@@ -59,7 +59,7 @@ class SwBreakDlg
public:
SwBreakDlg(weld::Window *pParent, SwWrtShell &rSh);
- short Execute();
+ short run();
const OUString& GetTemplateName() const { return aTemplate; }
sal_uInt16 GetKind() const { return nKind; }
const ::boost::optional<sal_uInt16>& GetPageNumber() const { return oPgNum; }
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index a2b5b13d15fc..8f8be139261a 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -757,6 +757,11 @@ public:
m_xEntry->SetWidthInChars(nChars);
}
+ virtual void select_region(int nStartPos, int nEndPos) override
+ {
+ m_xEntry->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX : nEndPos));
+ }
+
virtual ~SalInstanceEntry() override
{
m_xEntry->SetTextFilter(nullptr);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index c36895fffce1..5165ef70fd6e 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1867,6 +1867,11 @@ public:
gtk_entry_set_width_chars(m_pEntry, nChars);
}
+ virtual void select_region(int nStartPos, int nEndPos) override
+ {
+ gtk_editable_select_region(GTK_EDITABLE(m_pEntry), nStartPos, nEndPos);
+ }
+
virtual ~GtkInstanceEntry() override
{
g_signal_handler_disconnect(m_pEntry, m_nInsertTextSignalId);
More information about the Libreoffice-commits
mailing list