sc/source/ui/dbgui/scuiasciiopt.cxx   |   24 +++++++-----------
 sc/source/ui/inc/scuiasciiopt.hxx     |    4 ---
 sc/uiconfig/scalc/ui/textimportcsv.ui |   45 +++-------------------------------
 3 files changed, 16 insertions(+), 57 deletions(-)

New commits:
commit 3606632651f0b24c71f72cb7f59ad816170d08fd
Author:     Pedro Pinto Silva <pedro.si...@collabora.com>
AuthorDate: Thu May 27 16:01:49 2021 +0200
Commit:     Pedro Silva <pedro.si...@collabora.com>
CommitDate: Sat Jun 26 16:29:44 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.si...@collabora.com>
    Signed-off-by: Mert Tumer <mert.tu...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116265
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 3a55f96b77b5..d665795b8224 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -288,14 +288,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"))
@@ -363,7 +361,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);
 
@@ -488,10 +486,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();
 
@@ -499,7 +496,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);
@@ -539,7 +535,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] );
@@ -602,7 +598,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() )
@@ -622,7 +618,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()),
@@ -698,10 +694,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();
@@ -727,7 +723,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. */
@@ -780,7 +776,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 b8cb2bcc6794..569a67c9b241 100644
--- a/sc/source/ui/inc/scuiasciiopt.hxx
+++ b/sc/source/ui/inc/scuiasciiopt.hxx
@@ -54,7 +54,6 @@ class ScImportAsciiDlg : public weld::GenericDialogController
     ScImportAsciiCall const     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;
@@ -62,8 +61,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 948c5334aaf9..a58d50994397 100644
--- a/sc/uiconfig/scalc/ui/textimportcsv.ui
+++ b/sc/uiconfig/scalc/ui/textimportcsv.ui
@@ -111,27 +111,12 @@
                     <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="GtkGrid" id="grid1">
                         <property name="visible">True</property>
                         <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>
@@ -166,8 +151,9 @@
                             <property name="can_focus">False</property>
                           </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>
@@ -201,7 +187,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>
@@ -227,7 +213,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>
@@ -242,25 +227,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>
-                              </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>
@@ -287,7 +255,6 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
-                            <property name="left_padding">12</property>
                             <child>
                               <object class="GtkGrid" id="grid2">
                                 <property name="visible">True</property>
@@ -534,7 +501,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>
@@ -624,7 +590,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>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to