sw/source/uibase/shells/textfld.cxx     |   11 ++-
 sw/uiconfig/swriter/ui/pagenumberdlg.ui |  102 +++++++++++++++++---------------
 2 files changed, 62 insertions(+), 51 deletions(-)

New commits:
commit d19f76aa194706fed7119dd0d9b5bee4499334ca
Author:     Justin Luth <[email protected]>
AuthorDate: Wed May 3 19:03:49 2023 -0400
Commit:     Justin Luth <[email protected]>
CommitDate: Thu May 18 18:11:55 2023 +0200

    tdf#86630 sw page number wizard: avoid crash when no GetCurrFrame
    
    The steps to get the crash were:
    -create a header (and leave the cursor in the header)
    -use the wizard to create a non-mirrored footer
    
    I had seen this crash happening occassionally during development,
    but hadn't yet identified the exact steps to consistently reproduce.
    Thanks to QA who tracked that down.
    
    Although it looks/feels like a hack, it actually works amazingly well.
    The simple act of SetCursorInHdFt "fixes" GetCurrFrame/Get*PageNum,
    but we can't always use that because we don't know whether we
    are on an odd or even or first page when we start, so Goto*Text
    is the best when non-mirroring.
    
    Change-Id: I0e2f28d9c8fd2d1a10afede885b525c42ed08af4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151345
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151907
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sw/source/uibase/shells/textfld.cxx 
b/sw/source/uibase/shells/textfld.cxx
index 2a68219774ba..9198cec0337a 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -1131,8 +1131,14 @@ FIELD_INSERT:
                 bool bInHF = false;
                 bool bSkipMirror = true;
                 size_t nEvenPage = 0;
-                if (bCreateMirror)
+                if (bCreateMirror || !rSh.GetCurrFrame())
                 {
+                    // Come here if Currframe can't be found, otherwise 
Goto*Text will crash.
+                    // Get*PageNum will also be invalid (0), so we have no 
idea where we are.
+                    // (Since not asking for mirror, the likelihood is that 
the bHeader is shared,
+                    // in which case it doesn't matter anyway, and we just 
hope for the best.)
+                    // Read the code in this block assuming that bCreateMirror 
is true.
+
                     // There are enough pages that there probably is a valid 
odd page.
                     // However, that is not guaranteed: perhaps the page style 
switched,
                     // or a blank page was forced, or some other complexity.
@@ -1170,9 +1176,6 @@ FIELD_INSERT:
                 }
                 else
                 {
-                    // CurrFrame is lost when mirror is created. Goto*Text 
crashes if no CurrFrame
-                    assert(rSh.GetCurrFrame()); // not guaranteed, but 
normally assumed
-
                     if (bHeader)
                         bInHF = rSh.GotoHeaderText();
                     else
commit a182ae8669f63dbfa07d1cba0f268f0a1a27eca3
Author:     Olivier Hallot <[email protected]>
AuthorDate: Sun Jan 8 10:23:43 2023 -0300
Commit:     Justin Luth <[email protected]>
CommitDate: Thu May 18 18:11:41 2023 +0200

    tdf#86630 sw page number wizard: fix divergence from HIG
    
    This is a squashed commit, including
    commit 0afde4cca4046c9478a1c9751ee104495ef18688
        tdf#152910 (part) add Help button to pagenumberdlg.ui
    commit f32a2b4e63277e74cda200b5778e2eb9b8c34183
        use mnemonic-widget instead of label-for+labelled-by
    commit 8db390be9b2280c05f2c8943fc80be07aa8df811
        use mnemonic-widget instead of label-for+labelled-by
    
    Thanks to Seth for pointing this out in
    gerrit.libreoffice.org/c/core/+/151152
    
    Possible misses still?
    -24pt column (start of rightVBox)
    
    Also taking the opportunity to fix copy/paste error
    with the translation context.
    
    Change-Id: Ic542875331104c376d53b3fb195f2aa2a3e485df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151242
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151906
    Tested-by: Justin Luth <[email protected]>

diff --git a/sw/uiconfig/swriter/ui/pagenumberdlg.ui 
b/sw/uiconfig/swriter/ui/pagenumberdlg.ui
index dba145a4c403..27f9bbed1543 100644
--- a/sw/uiconfig/swriter/ui/pagenumberdlg.ui
+++ b/sw/uiconfig/swriter/ui/pagenumberdlg.ui
@@ -4,19 +4,19 @@
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkDialog" id="PageNumberDialog">
     <property name="can-focus">False</property>
+    <property name="border-width">6</property>
     <property name="title" translatable="yes" 
context="pagenumberdlg|PageNumberDialog">Page Number Wizard</property>
-    <property name="resizable">False</property>
+    <property name="modal">True</property>
     <property name="default-width">0</property>
     <property name="default-height">0</property>
     <property name="type-hint">dialog</property>
-    <property name="gravity">north-east</property>
     <child internal-child="vbox">
-      <object class="GtkBox" id="mainVBox">
+      <object class="GtkBox" id="dialog-vbox1">
         <property name="can-focus">False</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
+        <property name="spacing">12</property>
         <child internal-child="action_area">
-          <object class="GtkButtonBox" id="buttonBox">
+          <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can-focus">False</property>
             <property name="layout-style">end</property>
             <child>
@@ -28,7 +28,7 @@
                 <property name="use-underline">True</property>
               </object>
               <packing>
-                <property name="expand">True</property>
+                <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">0</property>
               </packing>
@@ -42,15 +42,31 @@
                 <property name="use-underline">True</property>
               </object>
               <packing>
-                <property name="expand">True</property>
+                <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label" translatable="yes" 
context="stock">_Help</property>
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">True</property>
+                <property name="use-underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
-            <property name="fill">False</property>
+            <property name="fill">True</property>
+            <property name="pack-type">end</property>
             <property name="position">1</property>
           </packing>
         </child>
@@ -58,26 +74,22 @@
           <object class="GtkBox" id="HBox">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
-            <property name="spacing">29</property>
+            <property name="spacing">12</property>
             <child>
               <object class="GtkBox" id="leftVBox">
                 <property name="visible">True</property>
                 <property name="can-focus">False</property>
-                <property name="margin-end">10</property>
-                <property name="margin-bottom">10</property>
                 <property name="hexpand">True</property>
                 <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
                 <child>
                   <object class="GtkLabel" id="positionLabel">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
                     <property name="halign">start</property>
-                    <property name="xpad">7</property>
-                    <property name="ypad">7</property>
                     <property name="label" translatable="yes" 
context="pagenumberdlg|positionLabel">Position:</property>
-                    <accessibility>
-                      <relation type="label-for" target="positionCombo"/>
-                    </accessibility>
+                    <property name="use-underline">True</property>
+                    <property name="mnemonic-widget">positionCombo</property>
                     <child internal-child="accessible">
                       <object class="AtkObject" id="positionLabel-atkobject">
                         <property name="AtkObject::accessible-name" 
translatable="yes" 
context="pagenumberdlg|positionLabel-atkobject">Position</property>
@@ -96,12 +108,14 @@
                     <property name="can-focus">False</property>
                     <property name="active">1</property>
                     <items>
-                      <item translatable="yes" 
context="pagenumberdlg|liststore2">Top of page (Header)</item>
-                      <item translatable="yes" 
context="pagenumberdlg|liststore2">Bottom of page (Footer)</item>
+                      <item translatable="yes" 
context="pagenumberdlg|positionCombo">Top of page (Header)</item>
+                      <item translatable="yes" 
context="pagenumberdlg|positionCombo">Bottom of page (Footer)</item>
                     </items>
-                    <accessibility>
-                      <relation type="labelled-by" target="positionLabel"/>
-                    </accessibility>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="positionCombo-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="pagenumbering|extended_tip|positionCombo">Insert 
page number in footer.</property>
+                      </object>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -114,12 +128,10 @@
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
                     <property name="halign">start</property>
-                    <property name="xpad">7</property>
-                    <property name="ypad">7</property>
+                    <property name="margin-top">3</property>
                     <property name="label" translatable="yes" 
context="pagenumberdlg|alignmentLabel">Alignment:</property>
-                    <accessibility>
-                      <relation type="label-for" target="alignmentCombo"/>
-                    </accessibility>
+                    <property name="use-underline">True</property>
+                    <property name="mnemonic-widget">alignmentCombo</property>
                     <child internal-child="accessible">
                       <object class="AtkObject" id="alignmentLabel-atkobject">
                         <property name="AtkObject::accessible-name" 
translatable="yes" 
context="pagenumberdlg|alignmentLabel-atkobject">Alignment</property>
@@ -138,13 +150,15 @@
                     <property name="can-focus">False</property>
                     <property name="active">0</property>
                     <items>
-                      <item translatable="yes" 
context="pagenumberdlg|liststore1">Left</item>
-                      <item translatable="yes" 
context="pagenumberdlg|liststore1">Center</item>
-                      <item translatable="yes" 
context="pagenumberdlg|liststore1">Right</item>
+                      <item translatable="yes" 
context="pagenumberdlg|alignmentCombo">Left</item>
+                      <item translatable="yes" 
context="pagenumberdlg|alignmentCombo">Center</item>
+                      <item translatable="yes" 
context="pagenumberdlg|alignmentCombo">Right</item>
                     </items>
-                    <accessibility>
-                      <relation type="labelled-by" target="alignmentLabel"/>
-                    </accessibility>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="alignmentCombo-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="pagenumbering|extended_tip|alignmentCombo">Align 
page number in page footer or header.</property>
+                      </object>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -154,15 +168,16 @@
                 </child>
                 <child>
                   <object class="GtkCheckButton" id="mirrorCheckbox">
-                    <property name="label" translatable="yes" 
context="numberingoptionspage|mirrorCheckbox">Mirror on even pages</property>
+                    <property name="label" translatable="yes" 
context="pagenumberdlg|mirrorCheckbox">Mirror on even pages</property>
                     <property name="visible">True</property>
                     <property name="can-focus">True</property>
                     <property name="receives-default">False</property>
+                    <property name="margin-start">18</property>
                     <property name="use-underline">True</property>
                     <property name="draw-indicator">True</property>
                     <child internal-child="accessible">
                       <object class="AtkObject" id="mirrorCheckbox-atkobject">
-                        <property name="AtkObject::accessible-description" 
translatable="yes" 
context="numberingoptionspage|extended_tip|mirrorCheckbox">Creates separate 
left/right pages with mirrored page number placements</property>
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="pagenumberdlg|extended_tip|mirrorCheckbox">Creates 
separate left/right pages with mirrored page number placements</property>
                       </object>
                     </child>
                   </object>
@@ -199,7 +214,7 @@
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
                     <property name="halign">start</property>
-                    <property name="margin-top">6</property>
+                    <property name="margin-top">3</property>
                     <property name="label" translatable="yes" 
context="pagenumberdlg|numfmtLabel">Page numbers:</property>
                     <property name="use-underline">True</property>
                     <property name="mnemonic-widget">numfmtlb</property>
@@ -227,7 +242,7 @@
                     </accessibility>
                     <child internal-child="accessible">
                       <object class="AtkObject" id="numfmtlb-atkobject">
-                        <property name="AtkObject::accessible-description" 
translatable="yes" context="numberingoptionspage|extended_tip|numfmtlb">Select 
a numbering scheme for the page numbering.</property>
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="pagenumberdlg|extended_tip|numfmtlb">Select a 
numbering scheme for the page numbering.</property>
                       </object>
                     </child>
                   </object>
@@ -248,20 +263,15 @@
               <object class="GtkBox" id="rightVBox">
                 <property name="visible">True</property>
                 <property name="can-focus">False</property>
-                <property name="margin-end">10</property>
-                <property name="margin-bottom">10</property>
                 <property name="orientation">vertical</property>
                 <child>
                   <object class="GtkLabel" id="previewLabel">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
-                    <property name="xpad">7</property>
-                    <property name="ypad">7</property>
+                    <property name="halign">start</property>
                     <property name="label" translatable="yes" 
context="pagenumberdlg|previewLabel">Preview</property>
-                    <property name="justify">center</property>
-                    <accessibility>
-                      <relation type="label-for" target="previewImage"/>
-                    </accessibility>
+                    <property name="use-underline">True</property>
+                    <property name="mnemonic-widget">previewImage</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -273,9 +283,6 @@
                   <object class="GtkImage" id="previewImage">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
-                    <accessibility>
-                      <relation type="labelled-by" target="previewLabel"/>
-                    </accessibility>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -302,6 +309,7 @@
     <action-widgets>
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
+      <action-widget response="-11">help</action-widget>
     </action-widgets>
   </object>
 </interface>

Reply via email to