vcl/qt5/QtInstanceEntry.cxx    |    2 
 vcl/qt5/QtInstanceTextView.cxx |    3 
 vcl/source/app/salvtables.cxx  |    5 -
 vcl/source/weld/TextWidget.cxx |    2 
 vcl/uiconfig/ui/printdialog.ui |  138 ++++++++++++++++++++---------------------
 vcl/unx/gtk3/gtkinst.cxx       |    3 
 6 files changed, 72 insertions(+), 81 deletions(-)

New commits:
commit 48f549f71f490337a5fa388186777d967b3411b6
Author:     Michael Weghorn <[email protected]>
AuthorDate: Sat Jan 17 23:14:33 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sun Jan 18 09:03:16 2026 +0100

    tdf#130857 Define widgets in print dialog in order
    
    Switch the order in which the widgets in the .ui file
    are defined so that the order better matches the visual appearance
    and logical order, which makes sure that tab focus order with the
    Qt-based VCL plugins is correct as well when using native Qt
    widgets (SAL_VCL_QT_USE_WELDED_WIDGETS=1), where
    focus order is (by default) based on widget creation order.
    
    See
    
        commit 02692566ad9fc7c3484f8581ffa0004cd4e43987
        Author: Michael Weghorn <[email protected]>
        Date:   Thu Oct 24 17:43:35 2024 +0200
    
            tdf#130857 optnewdictionarydialog.ui: Define focusable widgets in 
order
    
    for more background.
    
    Change-Id: Ic8d308d903f4bc5fd4f3ef67215dbeeff2434921
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197515
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui
index 8f7a6b17a000..5ffa739789f9 100644
--- a/vcl/uiconfig/ui/printdialog.ui
+++ b/vcl/uiconfig/ui/printdialog.ui
@@ -665,6 +665,43 @@
                                             <property 
name="margin-top">6</property>
                                             <property 
name="row-spacing">3</property>
                                             <property 
name="column-spacing">6</property>
+                                            <child>
+                                              <object class="GtkLabel" 
id="includeevenodd">
+                                                <property 
name="visible">True</property>
+                                                <property 
name="can-focus">False</property>
+                                                <property 
name="halign">start</property>
+                                                <property name="label" 
translatable="yes" context="printdialog|includeevenodd">Include:</property>
+                                                <property 
name="use-underline">True</property>
+                                                <property 
name="mnemonic-widget">evenoddbox</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="GtkComboBoxText" 
id="evenoddbox">
+                                                <property 
name="visible">True</property>
+                                                <property 
name="can-focus">False</property>
+                                                <property 
name="hexpand">True</property>
+                                                <property 
name="active">0</property>
+                                                <items>
+                                                  <item translatable="yes" 
context="printdialog|liststore3">Odd and Even Pages</item>
+                                                  <item translatable="yes" 
context="printdialog|liststore3">Odd Pages</item>
+                                                  <item translatable="yes" 
context="printdialog|liststore3">Even Pages</item>
+                                                </items>
+                                                <child 
internal-child="accessible">
+                                                  <object class="AtkObject" 
id="evenoddbox-atkobject">
+                                                    <property 
name="AtkObject::accessible-description" translatable="yes" 
context="printdialog|extended_tip|evenoddbox">Select the subset of pages to 
print.</property>
+                                                  </object>
+                                                </child>
+                                              </object>
+                                              <packing>
+                                                <property 
name="left-attach">1</property>
+                                                <property 
name="top-attach">0</property>
+                                              </packing>
+                                            </child>
                                             <child>
                                               <object class="GtkLabel" 
id="fromwhich">
                                                 <property 
name="can-focus">False</property>
@@ -741,26 +778,6 @@
                                                 <property 
name="width">2</property>
                                               </packing>
                                             </child>
-                                            <child>
-                                              <object class="GtkCheckButton" 
id="reverseorder">
-                                                <property name="label" 
translatable="yes" context="printdialog|reverseorder">Print in _reverse 
order</property>
-                                                <property 
name="visible">True</property>
-                                                <property 
name="can-focus">True</property>
-                                                <property 
name="receives-default">False</property>
-                                                <property 
name="halign">start</property>
-                                                <property 
name="use-underline">True</property>
-                                                <property 
name="draw-indicator">True</property>
-                                                <child 
internal-child="accessible">
-                                                  <object class="AtkObject" 
id="reverseorder-atkobject">
-                                                    <property 
name="AtkObject::accessible-description" translatable="yes" 
context="printdialog|extended_tip|reverseorder">Check to print pages in reverse 
order.</property>
-                                                  </object>
-                                                </child>
-                                              </object>
-                                              <packing>
-                                                <property 
name="left-attach">1</property>
-                                                <property 
name="top-attach">5</property>
-                                              </packing>
-                                            </child>
                                             <child>
                                               <object class="GtkBox" id="box9">
                                                 <property 
name="visible">True</property>
@@ -825,40 +842,23 @@
                                               </packing>
                                             </child>
                                             <child>
-                                              <object class="GtkLabel" 
id="includeevenodd">
+                                              <object class="GtkCheckButton" 
id="reverseorder">
+                                                <property name="label" 
translatable="yes" context="printdialog|reverseorder">Print in _reverse 
order</property>
                                                 <property 
name="visible">True</property>
-                                                <property 
name="can-focus">False</property>
+                                                <property 
name="can-focus">True</property>
+                                                <property 
name="receives-default">False</property>
                                                 <property 
name="halign">start</property>
-                                                <property name="label" 
translatable="yes" context="printdialog|includeevenodd">Include:</property>
                                                 <property 
name="use-underline">True</property>
-                                                <property 
name="mnemonic-widget">evenoddbox</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="GtkComboBoxText" 
id="evenoddbox">
-                                                <property 
name="visible">True</property>
-                                                <property 
name="can-focus">False</property>
-                                                <property 
name="hexpand">True</property>
-                                                <property 
name="active">0</property>
-                                                <items>
-                                                  <item translatable="yes" 
context="printdialog|liststore3">Odd and Even Pages</item>
-                                                  <item translatable="yes" 
context="printdialog|liststore3">Odd Pages</item>
-                                                  <item translatable="yes" 
context="printdialog|liststore3">Even Pages</item>
-                                                </items>
+                                                <property 
name="draw-indicator">True</property>
                                                 <child 
internal-child="accessible">
-                                                  <object class="AtkObject" 
id="evenoddbox-atkobject">
-                                                    <property 
name="AtkObject::accessible-description" translatable="yes" 
context="printdialog|extended_tip|evenoddbox">Select the subset of pages to 
print.</property>
+                                                  <object class="AtkObject" 
id="reverseorder-atkobject">
+                                                    <property 
name="AtkObject::accessible-description" translatable="yes" 
context="printdialog|extended_tip|reverseorder">Check to print pages in reverse 
order.</property>
                                                   </object>
                                                 </child>
                                               </object>
                                               <packing>
                                                 <property 
name="left-attach">1</property>
-                                                <property 
name="top-attach">0</property>
+                                                <property 
name="top-attach">5</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -924,33 +924,49 @@
                                         <property 
name="row-spacing">6</property>
                                         <property 
name="column-spacing">6</property>
                                         <child>
-                                          <object class="GtkLabel" 
id="labelorientation">
+                                          <object class="GtkLabel" 
id="labelsize">
                                             <property 
name="visible">True</property>
                                             <property 
name="can-focus">False</property>
                                             <property 
name="halign">start</property>
-                                            <property name="label" 
translatable="yes" 
context="printdialog|labelorientation">Orientation:</property>
+                                            <property name="label" 
translatable="yes" context="printdialog|labelsize">Paper size:</property>
                                             <property 
name="use-underline">True</property>
-                                            <property 
name="mnemonic-widget">pageorientationbox</property>
+                                            <property 
name="mnemonic-widget">papersizebox</property>
                                             <property 
name="xalign">0</property>
                                           </object>
                                           <packing>
                                             <property 
name="left-attach">0</property>
-                                            <property 
name="top-attach">1</property>
+                                            <property 
name="top-attach">0</property>
                                           </packing>
                                         </child>
                                         <child>
-                                          <object class="GtkLabel" 
id="labelsize">
+                                          <object class="GtkComboBoxText" 
id="papersizebox">
+                                            <property 
name="visible">True</property>
+                                            <property 
name="can-focus">False</property>
+                                            <property 
name="hexpand">True</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" 
id="papersizebox-atkobject">
+                                                <property 
name="AtkObject::accessible-description" translatable="yes" 
context="printdialog|extended_tip|papersizebox">Set the paper size you would 
like to use. The preview will show how the document would look on a paper of 
the given size.</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property 
name="left-attach">1</property>
+                                            <property 
name="top-attach">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" 
id="labelorientation">
                                             <property 
name="visible">True</property>
                                             <property 
name="can-focus">False</property>
                                             <property 
name="halign">start</property>
-                                            <property name="label" 
translatable="yes" context="printdialog|labelsize">Paper size:</property>
+                                            <property name="label" 
translatable="yes" 
context="printdialog|labelorientation">Orientation:</property>
                                             <property 
name="use-underline">True</property>
-                                            <property 
name="mnemonic-widget">papersizebox</property>
+                                            <property 
name="mnemonic-widget">pageorientationbox</property>
                                             <property 
name="xalign">0</property>
                                           </object>
                                           <packing>
                                             <property 
name="left-attach">0</property>
-                                            <property 
name="top-attach">0</property>
+                                            <property 
name="top-attach">1</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -975,22 +991,6 @@
                                             <property 
name="top-attach">1</property>
                                           </packing>
                                         </child>
-                                        <child>
-                                          <object class="GtkComboBoxText" 
id="papersizebox">
-                                            <property 
name="visible">True</property>
-                                            <property 
name="can-focus">False</property>
-                                            <property 
name="hexpand">True</property>
-                                            <child internal-child="accessible">
-                                              <object class="AtkObject" 
id="papersizebox-atkobject">
-                                                <property 
name="AtkObject::accessible-description" translatable="yes" 
context="printdialog|extended_tip|papersizebox">Set the paper size you would 
like to use. The preview will show how the document would look on a paper of 
the given size.</property>
-                                              </object>
-                                            </child>
-                                          </object>
-                                          <packing>
-                                            <property 
name="left-attach">1</property>
-                                            <property 
name="top-attach">0</property>
-                                          </packing>
-                                        </child>
                                       </object>
                                       <packing>
                                         <property 
name="left-attach">0</property>
commit 549d45d106e8d4b56ce144747a9200986c592001
Author:     Michael Weghorn <[email protected]>
AuthorDate: Sat Jan 17 19:55:18 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sun Jan 18 09:03:09 2026 +0100

    weld: Handle special TextWidget::set_position offset -1 in base
    
    As the weld::TextWidget::set_position doc says:
    
        // nCursorPos can be -1 to set to the end
        void set_position(int nCursorPos);
    
    Instead of having special handling for that offset in all
    of the toolkit specific weld::TextWidget::do_set_position
    implementations, translate it once in the the abstract base class
    in weld::TextWidget::set_position and call the toolkit-specific
    implementations with the already "translated" actual end index.
    
    Change-Id: Ifbf732f6fb54908ce428ca09a6f43de1254d3d1d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197514
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/qt5/QtInstanceEntry.cxx b/vcl/qt5/QtInstanceEntry.cxx
index 0edc26df653d..0dc22b48dd5a 100644
--- a/vcl/qt5/QtInstanceEntry.cxx
+++ b/vcl/qt5/QtInstanceEntry.cxx
@@ -93,8 +93,6 @@ void QtInstanceEntry::do_replace_selection(const OUString& 
rText)
 void QtInstanceEntry::do_set_position(int nCursorPos)
 {
     SolarMutexGuard g;
-    if (nCursorPos == -1)
-        nCursorPos = m_pLineEdit->text().length();
 
     GetQtInstance().RunInMainThread([&] { 
m_pLineEdit->setCursorPosition(nCursorPos); });
 }
diff --git a/vcl/qt5/QtInstanceTextView.cxx b/vcl/qt5/QtInstanceTextView.cxx
index bf01bc4acf55..aa8fb17855a5 100644
--- a/vcl/qt5/QtInstanceTextView.cxx
+++ b/vcl/qt5/QtInstanceTextView.cxx
@@ -50,9 +50,6 @@ void QtInstanceTextView::do_set_position(int nCursorPos)
     SolarMutexGuard g;
 
     GetQtInstance().RunInMainThread([&] {
-        if (nCursorPos == -1)
-            nCursorPos = m_pTextEdit->toPlainText().length();
-
         QTextCursor aCursor = m_pTextEdit->textCursor();
         aCursor.setPosition(nCursorPos);
         m_pTextEdit->setTextCursor(aCursor);
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 00e17ab47ca6..a73320880095 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3314,10 +3314,7 @@ void 
SalInstanceTextWidget::connect_cursor_position(const Link<TextWidget&, void
 
 void SalInstanceTextWidget::do_set_position(int nCursorPos)
 {
-    if (nCursorPos < 0)
-        m_pEntry->SetCursorAtLast();
-    else
-        m_pEntry->SetSelection(Selection(nCursorPos, nCursorPos));
+    m_pEntry->SetSelection(Selection(nCursorPos, nCursorPos));
 }
 
 int SalInstanceTextWidget::get_position() const { return 
m_pEntry->GetSelection().Max(); }
diff --git a/vcl/source/weld/TextWidget.cxx b/vcl/source/weld/TextWidget.cxx
index 3a576f595c1b..2f85cb078995 100644
--- a/vcl/source/weld/TextWidget.cxx
+++ b/vcl/source/weld/TextWidget.cxx
@@ -31,6 +31,8 @@ void TextWidget::set_text(const OUString& rText)
 void TextWidget::set_position(int nCursorPos)
 {
     disable_notify_events();
+    if (nCursorPos == -1)
+        nCursorPos = get_text().getLength();
     do_set_position(nCursorPos);
     enable_notify_events();
 }
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index da332771a38d..321aaae389bd 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17702,9 +17702,6 @@ public:
 
     virtual void do_set_position(int nCursorPos) override
     {
-        if (nCursorPos == -1)
-            nCursorPos = gtk_text_buffer_get_char_count(m_pTextBuffer);
-
         GtkTextIter aTextIter;
         gtk_text_buffer_get_iter_at_offset(m_pTextBuffer, &aTextIter, 
nCursorPos);
         gtk_text_buffer_place_cursor(m_pTextBuffer, &aTextIter);

Reply via email to