sc/inc/strings.hrc                |    2 ++
 sc/qa/uitest/sort/tdf105301.py    |   14 +++++++-------
 sc/qa/uitest/sort/tdf49531.py     |    2 +-
 sc/qa/uitest/sort/tdf57465.py     |    2 +-
 sc/source/ui/dbgui/sortkeydlg.cxx |    1 +
 sc/source/ui/dbgui/tpsort.cxx     |   13 +++++--------
 sc/source/ui/inc/sortkeydlg.hxx   |    1 +
 sc/uiconfig/scalc/ui/sortkey.ui   |   20 ++++++++++++++++----
 8 files changed, 34 insertions(+), 21 deletions(-)

New commits:
commit 35b9e7f90ca3751d474efff7745582b4bff3e2df
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Wed Feb 2 14:49:14 2022 +0100
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Fri Feb 11 00:09:29 2022 +0100

    Resolves tdf#140290 - Make sort keys accessible
    
    Inline string is plain now in favor of the caption
    Column/Row before the dopdown control
    
    Change-Id: I7f012d38c360113b7207f19fa32437d28d90d049
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129366
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index 9a461a40d4ff..dd55baba8563 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -51,6 +51,8 @@
 #define SCSTR_COLUMN                                NC_("SCSTR_COLUMN", 
"Column %1")
 // "%1 is replaced to row number, such as 'Row 1'"
 #define SCSTR_ROW                                   NC_("SCSTR_ROW", "Row %1")
+#define SCSTR_COLUMN_NAME                           NC_("SCSTR_COLUMN_NAME", 
"Column")
+#define SCSTR_ROW_NAME                              NC_("SCSTR_ROW_NAME", 
"Row")
 #define SCSTR_TABLE                                 NC_("SCSTR_TABLE", "Sheet")
 #define SCSTR_NAME                                  NC_("SCSTR_NAME", "Name")
 #define SCSTR_APDTABLE                              NC_("SCSTR_APDTABLE", 
"Append Sheet")
diff --git a/sc/qa/uitest/sort/tdf105301.py b/sc/qa/uitest/sort/tdf105301.py
index da8730368023..ab4889d89e18 100644
--- a/sc/qa/uitest/sort/tdf105301.py
+++ b/sc/qa/uitest/sort/tdf105301.py
@@ -23,15 +23,15 @@ class tdf105301(UITestCase):
             with self.ui_test.execute_dialog_through_command(".uno:DataSort") 
as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
                 select_pos(xTabs, "0")
-                self.assertEqual("Column B", 
get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText'])
-                self.assertEqual("Column C", 
get_state_as_dict(xDialog.getChild("sortlb2"))['DisplayText'])
-                self.assertEqual("Column D", 
get_state_as_dict(xDialog.getChild("sortlb3"))['DisplayText'])
+                self.assertEqual("B", 
get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText'])
+                self.assertEqual("C", 
get_state_as_dict(xDialog.getChild("sortlb2"))['DisplayText'])
+                self.assertEqual("D", 
get_state_as_dict(xDialog.getChild("sortlb3"))['DisplayText'])
 
                 # Without the fix in place, this test would have failed with
-                # AssertionError: 'Column E' != '- undefined -'
-                self.assertEqual("Column E", 
get_state_as_dict(xDialog.getChild("sortlb4"))['DisplayText'])
-                self.assertEqual("Column F", 
get_state_as_dict(xDialog.getChild("sortlb5"))['DisplayText'])
-                self.assertEqual("Column G", 
get_state_as_dict(xDialog.getChild("sortlb6"))['DisplayText'])
+                # AssertionError: 'E' != '- undefined -'
+                self.assertEqual("E", 
get_state_as_dict(xDialog.getChild("sortlb4"))['DisplayText'])
+                self.assertEqual("F", 
get_state_as_dict(xDialog.getChild("sortlb5"))['DisplayText'])
+                self.assertEqual("G", 
get_state_as_dict(xDialog.getChild("sortlb6"))['DisplayText'])
 
                 # tdf#51828: Without the fix in place, this test would have 
failed here
                 self.assertEqual("- undefined -", 
get_state_as_dict(xDialog.getChild("sortlb7"))['DisplayText'])
diff --git a/sc/qa/uitest/sort/tdf49531.py b/sc/qa/uitest/sort/tdf49531.py
index c84b67cb040a..08f94cd1a275 100644
--- a/sc/qa/uitest/sort/tdf49531.py
+++ b/sc/qa/uitest/sort/tdf49531.py
@@ -41,7 +41,7 @@ class tdf49531(UITestCase):
                 select_pos(xTabs, "0")
                 xSortKey1 = xDialog.getChild("sortlb")
                 xAsc = xDialog.getChild("up")
-                select_by_text(xSortKey1, "Column B")
+                select_by_text(xSortKey1, "B")
                 xAsc.executeAction("CLICK", tuple())
             #Verify
             self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 
0).getString(), "x")
diff --git a/sc/qa/uitest/sort/tdf57465.py b/sc/qa/uitest/sort/tdf57465.py
index 85be19d5e9b0..eefb3fdd4be8 100644
--- a/sc/qa/uitest/sort/tdf57465.py
+++ b/sc/qa/uitest/sort/tdf57465.py
@@ -34,7 +34,7 @@ class tdf57465(UITestCase):
 
                 select_pos(xTabs, "0")
 
-                self.assertEqual("Row 1", 
get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText'])
+                self.assertEqual("1", 
get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText'])
 
 
             self.assertEqual("a", get_cell_by_position(calc_doc, 0, 1, 
1).getString())
diff --git a/sc/source/ui/dbgui/sortkeydlg.cxx 
b/sc/source/ui/dbgui/sortkeydlg.cxx
index cee1f54e0607..d927439e258f 100644
--- a/sc/source/ui/dbgui/sortkeydlg.cxx
+++ b/sc/source/ui/dbgui/sortkeydlg.cxx
@@ -17,6 +17,7 @@ ScSortKeyItem::ScSortKeyItem(weld::Container* pParent)
     , m_xLbSort(m_xBuilder->weld_combo_box("sortlb"))
     , m_xBtnUp(m_xBuilder->weld_radio_button("up"))
     , m_xBtnDown(m_xBuilder->weld_radio_button("down"))
+    , m_xLabel(m_xBuilder->weld_label("lbColRow"))
     , m_pParent(pParent)
 {
     // tdf#136155 let the other elements in the dialog determine the width of 
the
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index dfdce8fd51b9..a0924f622998 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -74,8 +74,8 @@ ScTabPageSortFields::ScTabPageSortFields(weld::Container* 
pPage, weld::DialogCon
 
         m_aIdle("ScTabPageSortFields Scroll To End Idle"),
         aStrUndefined   ( ScResId( SCSTR_UNDEFINED ) ),
-        aStrColumn      ( ScResId( SCSTR_COLUMN ) ),
-        aStrRow         ( ScResId( SCSTR_ROW ) ),
+        aStrColumn      ( ScResId( SCSTR_COLUMN_NAME ) ),
+        aStrRow         ( ScResId( SCSTR_ROW_NAME ) ),
 
         nWhichSort      ( rArgSet.GetPool()->GetWhich( SID_SORT ) ),
         pViewData       ( nullptr ),
@@ -322,6 +322,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 
nStartField )
 
     for (sal_uInt16 j = nStartField; j < nSortKeyCount; ++j)
     {
+        m_aSortWin.m_aSortKeyItems[j]->m_xLabel->set_label(aSortData.bByRow ? 
aStrColumn : aStrRow);
         m_aSortWin.m_aSortKeyItems[j]->m_xLbSort->clear();
         m_aSortWin.m_aSortKeyItems[j]->m_xLbSort->freeze();
         m_aSortWin.m_aSortKeyItems[j]->m_xLbSort->append_text(aStrUndefined);
@@ -344,9 +345,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 
nStartField )
         {
             aFieldName = rDoc.GetString(col, nFirstSortRow, nTab);
             if ( !bHasHeader || aFieldName.isEmpty() )
-            {
-                aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, u"%1", 
ScColToAlpha( col ));
-            }
+                aFieldName = ScColToAlpha( col );
             nFieldArr.push_back( col );
 
             for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
@@ -365,9 +364,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 
nStartField )
         {
             aFieldName = rDoc.GetString(nFirstSortCol, row, nTab);
             if ( !bHasHeader || aFieldName.isEmpty() )
-            {
-                aFieldName = ScGlobal::ReplaceOrAppend( aStrRow, u"%1", 
OUString::number( row+1));
-            }
+                aFieldName = OUString::number( row+1);
             nFieldArr.push_back( row );
 
             for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
diff --git a/sc/source/ui/inc/sortkeydlg.hxx b/sc/source/ui/inc/sortkeydlg.hxx
index 52eece03d713..2c702e6100cb 100644
--- a/sc/source/ui/inc/sortkeydlg.hxx
+++ b/sc/source/ui/inc/sortkeydlg.hxx
@@ -22,6 +22,7 @@ struct ScSortKeyItem
     std::unique_ptr<weld::ComboBox> m_xLbSort;
     std::unique_ptr<weld::RadioButton> m_xBtnUp;
     std::unique_ptr<weld::RadioButton> m_xBtnDown;
+    std::unique_ptr<weld::Label> m_xLabel;
     weld::Container* m_pParent;
 
     ScSortKeyItem(weld::Container* pParent);
diff --git a/sc/uiconfig/scalc/ui/sortkey.ui b/sc/uiconfig/scalc/ui/sortkey.ui
index 1f3f142d454d..87695eb45593 100644
--- a/sc/uiconfig/scalc/ui/sortkey.ui
+++ b/sc/uiconfig/scalc/ui/sortkey.ui
@@ -9,7 +9,7 @@
     <property name="label-xalign">0</property>
     <property name="shadow-type">none</property>
     <child>
-      <!-- n-columns=2 n-rows=2 -->
+      <!-- n-columns=3 n-rows=2 -->
       <object class="GtkGrid" id="grid1">
         <property name="visible">True</property>
         <property name="can-focus">False</property>
@@ -31,7 +31,7 @@
             </child>
           </object>
           <packing>
-            <property name="left-attach">0</property>
+            <property name="left-attach">1</property>
             <property name="top-attach">0</property>
             <property name="height">2</property>
           </packing>
@@ -52,7 +52,7 @@
             </child>
           </object>
           <packing>
-            <property name="left-attach">1</property>
+            <property name="left-attach">2</property>
             <property name="top-attach">0</property>
           </packing>
         </child>
@@ -72,10 +72,22 @@
             </child>
           </object>
           <packing>
-            <property name="left-attach">1</property>
+            <property name="left-attach">2</property>
             <property name="top-attach">1</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkLabel" id="lbColRow">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="label" translatable="no">Column/Row:</property>
+          </object>
+          <packing>
+            <property name="left-attach">0</property>
+            <property name="top-attach">0</property>
+            <property name="height">2</property>
+          </packing>
+        </child>
       </object>
     </child>
     <child type="label">

Reply via email to