[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - sc/source sc/uiconfig
Pedro Pinto Silva (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 30 14:47:49 UTC 2021
sc/source/ui/dbgui/scuiasciiopt.cxx | 24 ++++++----------
sc/source/ui/inc/scuiasciiopt.hxx | 4 --
sc/uiconfig/scalc/ui/textimportcsv.ui | 50 +++-------------------------------
3 files changed, 16 insertions(+), 62 deletions(-)
New commits:
commit dba4f1031ef5b308f60f354c160187321cba6bbe
Author: Pedro Pinto Silva <pedro.silva at collabora.com>
AuthorDate: Thu May 27 16:01:49 2021 +0200
Commit: Pedro Silva <pedro.silva at collabora.com>
CommitDate: Wed Jun 30 16:47:12 2021 +0200
Dialog: Import CSV: Improve layout
Remove extra padding from headers, they are already in bold no need
to add extra padding to emphasis hierarchy.
Do not use the first header to repeat what the dialog title already says
"Import", use instead "Character encoding" as the first header of the
first group (advantage: 1st dropdown does not need extra labeling)
The 2 radio buttons for Use/not use separators appear to be
grouping the elements underneath them. This is wrong, all those options
are actually related only to the user chooses to use separators.
- Convert those two radio buttons in one check button labeled "Use separators"
- Fixes the confusion above mentioned
- Reduced the amount of items
- It does force the user to do trial and error in order to understand
what is what
Change-Id: Iee63a6dd336d7c5a4e6f5ce8c845b32902e49a73
Signed-off-by: Pedro Pinto Silva <pedro.silva at collabora.com>
Signed-off-by: Mert Tumer <mert.tumer at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116265
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118091
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 2d8efaefa3f3..af0c601c6010 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -295,14 +295,12 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, const OUString& aDatNa
, mcTextSep(ScAsciiOptions::cDefaultTextSep)
, meCall(eCall)
, mbDetectSpaceSep(eCall != SC_TEXTTOCOLUMNS)
- , mxFtCharSet(m_xBuilder->weld_label("textcharset"))
, mxLbCharSet(new SvxTextEncodingBox(m_xBuilder->weld_combo_box("charset")))
, mxFtCustomLang(m_xBuilder->weld_label("textlanguage"))
, mxLbCustomLang(new SvxLanguageBox(m_xBuilder->weld_combo_box("language")))
, mxFtRow(m_xBuilder->weld_label("textfromrow"))
, mxNfRow(m_xBuilder->weld_spin_button("fromrow"))
- , mxRbFixed(m_xBuilder->weld_radio_button("tofixedwidth"))
- , mxRbSeparated(m_xBuilder->weld_radio_button("toseparatedby"))
+ , mxRbSeparated(m_xBuilder->weld_check_button("toseparatedby"))
, mxCkbTab(m_xBuilder->weld_check_button("tab"))
, mxCkbSemicolon(m_xBuilder->weld_check_button("semicolon"))
, mxCkbComma(m_xBuilder->weld_check_button("comma"))
@@ -370,7 +368,7 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, const OUString& aDatNa
if (bSkipEmptyCells)
mxCkbSkipEmptyCells->set_active(true);
if (bFixedWidth && !bIsTSV)
- mxRbFixed->set_active(true);
+ mxRbSeparated->set_active(false);
if (nFromRow != 1)
mxNfRow->set_value(nFromRow);
@@ -500,10 +498,9 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, const OUString& aDatNa
mxTableBox->SetColTypeHdl( LINK( this, ScImportAsciiDlg, ColTypeHdl ) );
mxRbSeparated->connect_clicked( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) );
- mxRbFixed->connect_clicked( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) );
SetupSeparatorCtrls();
- RbSepFixHdl(*mxRbFixed);
+ RbSepFixHdl( *mxRbSeparated );
UpdateVertical();
@@ -511,7 +508,6 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, const OUString& aDatNa
if (meCall == SC_TEXTTOCOLUMNS)
{
- mxFtCharSet->set_sensitive(false);
mxLbCharSet->set_sensitive(false);
mxFtCustomLang->set_sensitive(false);
mxLbCustomLang->set_active_id(LANGUAGE_SYSTEM);
@@ -551,7 +547,7 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString &rText, sal_Unicode& r
return false;
bool bRet = true;
- bool bFixed = mxRbFixed->get_active();
+ bool bFixed = !mxRbSeparated->get_active();
if (!mpRowPosArray)
mpRowPosArray.reset( new sal_uLong[ASCIIDLG_MAXROWS + 2] );
@@ -614,7 +610,7 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
rOpt.SetCharSet( meCharSet );
rOpt.SetCharSetSystem( mbCharSetSystem );
rOpt.SetLanguage(mxLbCustomLang->get_active_id());
- rOpt.SetFixedLen( mxRbFixed->get_active() );
+ rOpt.SetFixedLen( !mxRbSeparated->get_active() );
rOpt.SetStartRow( mxNfRow->get_value() );
mxTableBox->FillColumnData( rOpt );
if( mxRbSeparated->get_active() )
@@ -634,7 +630,7 @@ void ScImportAsciiDlg::SaveParameters()
{
lcl_SaveSeparators( maFieldSeparators, mxCbTextSep->get_active_text(), mxCkbAsOnce->get_active(),
mxCkbQuotedAsText->get_active(), mxCkbDetectNumber->get_active(),
- mxRbFixed->get_active(),
+ !mxRbSeparated->get_active(),
mxNfRow->get_value(),
mxLbCharSet->get_active(),
static_cast<sal_uInt16>(mxLbCustomLang->get_active_id()),
@@ -710,10 +706,10 @@ void ScImportAsciiDlg::UpdateVertical()
IMPL_LINK(ScImportAsciiDlg, RbSepFixHdl, weld::Button&, rButton, void)
{
- if (&rButton == mxRbFixed.get() || &rButton == mxRbSeparated.get())
+ if (&rButton == mxRbSeparated.get())
{
weld::WaitObject aWaitObj(m_xDialog.get());
- if( mxRbFixed->get_active() )
+ if( !mxRbSeparated->get_active() )
mxTableBox->SetFixedWidthMode();
else
mxTableBox->SetSeparatorsMode();
@@ -739,7 +735,7 @@ IMPL_LINK( ScImportAsciiDlg, SeparatorEditHdl, weld::Entry&, rEdit, void )
void ScImportAsciiDlg::SeparatorHdl(const weld::Widget* pCtrl)
{
OSL_ENSURE( pCtrl, "ScImportAsciiDlg::SeparatorHdl - missing sender" );
- OSL_ENSURE( !mxRbFixed->get_active(), "ScImportAsciiDlg::SeparatorHdl - not allowed in fixed width" );
+ OSL_ENSURE( mxRbSeparated->get_active(), "ScImportAsciiDlg::SeparatorHdl - not allowed in fixed width" );
/* #i41550# First update state of the controls. The GetSeparators()
function needs final state of the check boxes. */
@@ -792,7 +788,7 @@ IMPL_LINK_NOARG(ScImportAsciiDlg, UpdateTextHdl, ScCsvTableBox&, void)
// when the dialog wasn't already presented to the user.
// As a side effect this has the benefit that the check is only done on the
// first set of visible lines.
- sal_Unicode cDetectSep = (mbDetectSpaceSep && !mxRbFixed->get_active() && !mxCkbSpace->get_active() ? 0 : 0xffff);
+ sal_Unicode cDetectSep = (mbDetectSpaceSep && mxRbSeparated->get_active() && !mxCkbSpace->get_active() ? 0 : 0xffff);
sal_Int32 nBaseLine = mxTableBox->GetGrid().GetFirstVisLine();
sal_Int32 nRead = mxTableBox->GetGrid().GetVisLineCount();
diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx
index 65718323f1ed..292c6812feca 100644
--- a/sc/source/ui/inc/scuiasciiopt.hxx
+++ b/sc/source/ui/inc/scuiasciiopt.hxx
@@ -48,7 +48,6 @@ class ScImportAsciiDlg : public weld::GenericDialogController
ScImportAsciiCall meCall; /// How the dialog is called (see asciiopt.hxx)
bool mbDetectSpaceSep; /// Whether to detect a possible space separator.
- std::unique_ptr<weld::Label> mxFtCharSet;
std::unique_ptr<SvxTextEncodingBox> mxLbCharSet;
std::unique_ptr<weld::Label> mxFtCustomLang;
std::unique_ptr<SvxLanguageBox> mxLbCustomLang;
@@ -56,8 +55,7 @@ class ScImportAsciiDlg : public weld::GenericDialogController
std::unique_ptr<weld::Label> mxFtRow;
std::unique_ptr<weld::SpinButton> mxNfRow;
- std::unique_ptr<weld::RadioButton> mxRbFixed;
- std::unique_ptr<weld::RadioButton> mxRbSeparated;
+ std::unique_ptr<weld::CheckButton> mxRbSeparated;
std::unique_ptr<weld::CheckButton> mxCkbTab;
std::unique_ptr<weld::CheckButton> mxCkbSemicolon;
diff --git a/sc/uiconfig/scalc/ui/textimportcsv.ui b/sc/uiconfig/scalc/ui/textimportcsv.ui
index b6cd7a4cc4c4..62bfe9067282 100644
--- a/sc/uiconfig/scalc/ui/textimportcsv.ui
+++ b/sc/uiconfig/scalc/ui/textimportcsv.ui
@@ -108,7 +108,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
- <property name="left_padding">12</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<object class="GtkGrid" id="grid1">
@@ -116,20 +115,6 @@
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
- <child>
- <object class="GtkLabel" id="textcharset">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="textimportcsv|textcharset">Ch_aracter 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>
- </packing>
- </child>
<child>
<object class="GtkLabel" id="textlanguage">
<property name="visible">True</property>
@@ -169,8 +154,9 @@
</child>
</object>
<packing>
- <property name="left_attach">1</property>
+ <property name="left_attach">0</property>
<property name="top_attach">0</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
@@ -215,7 +201,7 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes" context="textimportcsv|label1">Import</property>
+ <property name="label" translatable="yes" context="textimportcsv|label1">Character encoding</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -241,7 +227,6 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="top_padding">6</property>
- <property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
@@ -256,30 +241,8 @@
<property name="hexpand">True</property>
<property name="homogeneous">True</property>
<child>
- <object class="GtkRadioButton" id="tofixedwidth">
- <property name="label" translatable="yes" context="textimportcsv|tofixedwidth">_Fixed width</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- <property name="group">toseparatedby</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="tofixedwidth-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="textimportcsv|extended_tip|tofixedwidth">Separates fixed-width data (equal number of characters) into columns.</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="toseparatedby">
- <property name="label" translatable="yes" context="textimportcsv|toseparatedby">_Separated by</property>
+ <object class="GtkCheckButton" id="toseparatedby">
+ <property name="label" translatable="yes" context="textimportcsv|toseparatedby">_Use separators</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -311,7 +274,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="left_padding">12</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<object class="GtkGrid" id="grid2">
@@ -604,7 +566,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
- <property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
@@ -709,7 +670,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
- <property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
More information about the Libreoffice-commits
mailing list