[Libreoffice-commits] core.git: solenv/sanitizers sw/inc sw/source sw/uiconfig

Heiko Tietze (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 11 08:48:22 UTC 2019


 solenv/sanitizers/ui/modules/swriter.suppr |    1 
 sw/inc/strings.hrc                         |    2 
 sw/source/ui/misc/bookmark.cxx             |   20 -
 sw/source/uibase/inc/bookmark.hxx          |    2 
 sw/uiconfig/swriter/ui/insertbookmark.ui   |  300 ++++++++++++++++-------------
 5 files changed, 185 insertions(+), 140 deletions(-)

New commits:
commit 56b124c36cff09257d8373aaa6661a88cfb1926d
Author:     Heiko Tietze <tietze.heiko at gmail.com>
AuthorDate: Thu Nov 7 16:19:36 2019 +0100
Commit:     Heiko Tietze <heiko.tietze at documentfoundation.org>
CommitDate: Mon Nov 11 09:47:34 2019 +0100

    Resolves tdf#128521 - illegal char in a bookmark name
    
    Message box removed and warning label introduced
    Some alignment and accessibility issues solved too
    
    Change-Id: Icc88d489268403fa3da525aadc1c007c589fa019
    Reviewed-on: https://gerrit.libreoffice.org/82231
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>

diff --git a/solenv/sanitizers/ui/modules/swriter.suppr b/solenv/sanitizers/ui/modules/swriter.suppr
index 97f6e239143f..43134e801be7 100644
--- a/solenv/sanitizers/ui/modules/swriter.suppr
+++ b/solenv/sanitizers/ui/modules/swriter.suppr
@@ -93,6 +93,7 @@ sw/uiconfig/swriter/ui/indexentry.ui://GtkButton[@id='next'] button-no-label
 sw/uiconfig/swriter/ui/indexentry.ui://GtkButton[@id='first'] button-no-label
 sw/uiconfig/swriter/ui/indexentry.ui://GtkButton[@id='last'] button-no-label
 sw/uiconfig/swriter/ui/insertbookmark.ui://GtkEntry[@id='name'] no-labelled-by
+sw/uiconfig/swriter/ui/insertbookmark.ui://GtkLabel[@id='lbForbiddenChars'] orphan-label
 sw/uiconfig/swriter/ui/insertbreak.ui://GtkSpinButton[@id='pagenumsb'] missing-label-for
 sw/uiconfig/swriter/ui/insertcaption.ui://GtkEntry[@id='caption_edit'] no-labelled-by
 sw/uiconfig/swriter/ui/insertdbcolumnsdialog.ui://GtkButton[@id='allright'] button-no-label
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 47368c1e9dc5..8b2bd0073093 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -237,7 +237,6 @@
 #define STR_LOAD_GLOBAL_DOC                     NC_("STR_LOAD_GLOBAL_DOC", "Name and Path of Master Document")
 #define STR_LOAD_HTML_DOC                       NC_("STR_LOAD_HTML_DOC", "Name and Path of the HTML Document")
 #define STR_JAVA_EDIT                           NC_("STR_JAVA_EDIT", "Edit Script")
-#define STR_REMOVE_WARNING                      NC_("STR_REMOVE_WARNING", "The following characters are not valid and have been removed: ")
 #define STR_BOOKMARK_DEF_NAME                   NC_("STR_BOOKMARK_DEF_NAME", "Bookmark")
 #define STR_BOOKMARK_NAME                       NC_("STR_BOOKMARK_NAME", "Name")
 #define STR_BOOKMARK_TEXT                       NC_("STR_BOOKMARK_TEXT", "Text")
@@ -245,6 +244,7 @@
 #define STR_BOOKMARK_CONDITION                  NC_("STR_BOOKMARK_CONDITION", "Condition")
 #define STR_BOOKMARK_YES                        NC_("STR_BOOKMARK_YES", "Yes")
 #define STR_BOOKMARK_NO                         NC_("STR_BOOKMARK_NO", "No")
+#define STR_BOOKMARK_FORBIDDENCHARS             NC_("STR_BOOKMARK_FORBIDDENCHARS", "Forbidden chars:")
 #define SW_STR_NONE                             NC_("SW_STR_NONE", "[None]")
 #define STR_CAPTION_BEGINNING                   NC_("STR_CAPTION_BEGINNING", "Start")
 #define STR_CAPTION_END                         NC_("STR_CAPTION_END", "End")
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 5d6f08cf48fa..2fd11375504b 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -59,14 +59,12 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, ModifyHdl, weld::Entry&, void)
         if (sTmp.getLength() != nTmpLen)
            sMsg += OUStringChar(BookmarkTable::aForbiddenChars[i]);
     }
-    if (sTmp.getLength() != nLen)
-    {
-        m_xEditBox->set_text(sTmp);
-        std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
-                                                      VclMessageType::Info, VclButtonsType::Ok,
-                                                      sRemoveWarning + sMsg));
-        xInfoBox->run();
-    }
+    const bool bHasForbiddenChars = sTmp.getLength() != nLen;
+    m_xForbiddenChars->set_visible(bHasForbiddenChars);
+    if (bHasForbiddenChars)
+        m_xEditBox->set_message_type(weld::EntryMessageType::Error);
+    else
+        m_xEditBox->set_message_type(weld::EntryMessageType::Normal);
 
     sal_Int32 nSelectedEntries = 0;
     sal_Int32 nEntries = 0;
@@ -83,7 +81,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, ModifyHdl, weld::Entry&, void)
     }
 
     // allow to add new bookmark only if one name provided and it's not taken
-    m_xInsertBtn->set_sensitive(nEntries == 1 && nSelectedEntries == 0);
+    m_xInsertBtn->set_sensitive(nEntries == 1 && nSelectedEntries == 0 && !bHasForbiddenChars);
 
     // allow to delete only if all bookmarks are recognized
     m_xDeleteBtn->set_sensitive(nEntries > 0 && nSelectedEntries == nEntries);
@@ -313,6 +311,7 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg(weld::Window* pParent, SwWrtShell& rS,
     , m_xConditionFT(m_xBuilder->weld_label("condlabel"))
     , m_xConditionED(new ConditionEdit(m_xBuilder->weld_entry("withcond")))
     , m_xBookmarksBox(new BookmarkTable(m_xBuilder->weld_tree_view("bookmarks")))
+    , m_xForbiddenChars(m_xBuilder->weld_label("lbForbiddenChars"))
 {
     m_xBookmarksBox->connect_changed(LINK(this, SwInsertBookmarkDlg, SelectionChangedHdl));
     m_xBookmarksBox->connect_row_activated(LINK(this, SwInsertBookmarkDlg, DoubleClickHdl));
@@ -333,7 +332,8 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg(weld::Window* pParent, SwWrtShell& rS,
     m_xEditBox->set_text(m_xBookmarksBox->GetNameProposal());
     m_xEditBox->set_position(-1);
 
-    sRemoveWarning = SwResId(STR_REMOVE_WARNING);
+    m_xForbiddenChars->set_label(SwResId(STR_BOOKMARK_FORBIDDENCHARS) + " " + BookmarkTable::aForbiddenChars);
+    m_xForbiddenChars->set_visible(false);
 }
 
 IMPL_LINK(SwInsertBookmarkDlg, HeaderBarClick, int, nColumn, void)
diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/uibase/inc/bookmark.hxx
index 1a126788ca15..7522dbe9bc12 100644
--- a/sw/source/uibase/inc/bookmark.hxx
+++ b/sw/source/uibase/inc/bookmark.hxx
@@ -64,7 +64,6 @@ public:
 
 class SwInsertBookmarkDlg : public SfxDialogController
 {
-    OUString                            sRemoveWarning;
     SwWrtShell&                         rSh;
     SfxRequest&                         rReq;
     std::vector<std::pair<sw::mark::IMark*, OUString>> aTableBookmarks;
@@ -80,6 +79,7 @@ class SwInsertBookmarkDlg : public SfxDialogController
     std::unique_ptr<weld::Label> m_xConditionFT;
     std::unique_ptr<ConditionEdit> m_xConditionED;
     std::unique_ptr<BookmarkTable> m_xBookmarksBox;
+    std::unique_ptr<weld::Label> m_xForbiddenChars;
 
     DECL_LINK(ModifyHdl, weld::Entry&, void);
     DECL_LINK(InsertHdl, weld::Button&, void);
diff --git a/sw/uiconfig/swriter/ui/insertbookmark.ui b/sw/uiconfig/swriter/ui/insertbookmark.ui
index bc9c3896f1d3..e5197049c16e 100644
--- a/sw/uiconfig/swriter/ui/insertbookmark.ui
+++ b/sw/uiconfig/swriter/ui/insertbookmark.ui
@@ -35,7 +35,7 @@
         <property name="hexpand">True</property>
         <property name="vexpand">True</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">12</property>
+        <property name="spacing">6</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox">
             <property name="can_focus">False</property>
@@ -73,25 +73,41 @@
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">5</property>
+            <property name="position">6</property>
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="box1">
+          <object class="GtkGrid">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="spacing">6</property>
+            <property name="vexpand">True</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="lbForbiddenChars">
+                <property name="can_focus">False</property>
+                <property name="halign">end</property>
+                <property name="valign">start</property>
+                <property name="hexpand">True</property>
+                <property name="label" context="insertbookmark|lbForbiddenChars">Forbidden chars:</property>
+                <property name="single_line_mode">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkEntry" id="name">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
                 <property name="activates_default">True</property>
                 <property name="max_width_chars">0</property>
               </object>
               <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
               </packing>
             </child>
             <child>
@@ -104,52 +120,51 @@
                 <property name="receives_default">True</property>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="pack_type">end</property>
-                <property name="position">0</property>
+                <property name="left_attach">2</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="lbName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="label" translatable="yes" context="insertbookmark|name">Name:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">name</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="hide">
+                <property name="label" translatable="yes" context="insertbookmark|hide">H_ide</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="valign">start</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
               </packing>
             </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="hide">
-            <property name="label" translatable="yes" context="insertbookmark|hide">H_ide</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>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkBox">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="spacing">12</property>
             <child>
               <object class="GtkLabel" id="condlabel">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes" context="insertbookmark|condlabel">_With condition</property>
+                <property name="halign">start</property>
+                <property name="label" translatable="yes" context="insertbookmark|condlabel">_Condition:</property>
                 <property name="use_underline">True</property>
                 <property name="mnemonic_widget">withcond</property>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
               </packing>
             </child>
             <child>
@@ -159,115 +174,143 @@
                 <property name="activates_default">True</property>
               </object>
               <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="left_attach">1</property>
+                <property name="top_attach">3</property>
+                <property name="width">2</property>
               </packing>
             </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkScrolledWindow">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-            <property name="vexpand">True</property>
-            <property name="shadow_type">in</property>
             <child>
-              <object class="GtkTreeView" id="bookmarks">
+              <object class="GtkLabel" id="lbBookmarks">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">start</property>
+                <property name="vexpand">True</property>
+                <property name="label" translatable="yes" context="insertbookmark|bookmarks">_Bookmarks:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">bookmarks</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
-                <property name="model">liststore1</property>
-                <property name="search_column">0</property>
-                <property name="show_expanders">False</property>
-                <child internal-child="selection">
-                  <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
-                </child>
+                <property name="shadow_type">in</property>
                 <child>
-                  <object class="GtkTreeViewColumn" id="treeviewcolumn0">
-                    <property name="resizable">True</property>
-                    <property name="spacing">6</property>
-                    <property name="title" translatable="yes" context="insertbookmark|page">Page</property>
-                    <property name="clickable">True</property>
+                  <object class="GtkTreeView" id="bookmarks">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="model">liststore1</property>
+                    <property name="search_column">0</property>
+                    <property name="show_expanders">False</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+                    </child>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderer0"/>
-                      <attributes>
-                        <attribute name="text">0</attribute>
-                      </attributes>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn0">
+                        <property name="resizable">True</property>
+                        <property name="spacing">6</property>
+                        <property name="title" translatable="yes" context="insertbookmark|page">Page</property>
+                        <property name="clickable">True</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderer0"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
                     </child>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkTreeViewColumn" id="treeviewcolumn1">
-                    <property name="resizable">True</property>
-                    <property name="spacing">6</property>
-                    <property name="title" translatable="yes" context="insertbookmark|name">Name</property>
-                    <property name="clickable">True</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderer1"/>
-                      <attributes>
-                        <attribute name="text">1</attribute>
-                      </attributes>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                        <property name="resizable">True</property>
+                        <property name="spacing">6</property>
+                        <property name="title" translatable="yes" context="insertbookmark|name">Name</property>
+                        <property name="clickable">True</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderer1"/>
+                          <attributes>
+                            <attribute name="text">1</attribute>
+                          </attributes>
+                        </child>
+                      </object>
                     </child>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkTreeViewColumn" id="treeviewcolumn2">
-                    <property name="resizable">True</property>
-                    <property name="spacing">6</property>
-                    <property name="title" translatable="yes" context="insertbookmark|text">Text</property>
-                    <property name="clickable">True</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderer2"/>
-                      <attributes>
-                        <attribute name="text">2</attribute>
-                      </attributes>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                        <property name="resizable">True</property>
+                        <property name="spacing">6</property>
+                        <property name="title" translatable="yes" context="insertbookmark|text">Text</property>
+                        <property name="clickable">True</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderer2"/>
+                          <attributes>
+                            <attribute name="text">2</attribute>
+                          </attributes>
+                        </child>
+                      </object>
                     </child>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkTreeViewColumn" id="treeviewcolumn3">
-                    <property name="resizable">True</property>
-                    <property name="spacing">6</property>
-                    <property name="title" translatable="yes" context="insertbookmark|hidden">Hidden</property>
-                    <property name="clickable">True</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderer3"/>
-                      <attributes>
-                        <attribute name="text">3</attribute>
-                      </attributes>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+                        <property name="resizable">True</property>
+                        <property name="spacing">6</property>
+                        <property name="title" translatable="yes" context="insertbookmark|hidden">Hidden</property>
+                        <property name="clickable">True</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderer3"/>
+                          <attributes>
+                            <attribute name="text">3</attribute>
+                          </attributes>
+                        </child>
+                      </object>
                     </child>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkTreeViewColumn" id="treeviewcolumn4">
-                    <property name="resizable">True</property>
-                    <property name="spacing">6</property>
-                    <property name="title" translatable="yes" context="insertbookmark|condition">Condition</property>
-                    <property name="clickable">True</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderer4"/>
-                      <attributes>
-                        <attribute name="text">4</attribute>
-                      </attributes>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn4">
+                        <property name="resizable">True</property>
+                        <property name="spacing">6</property>
+                        <property name="title" translatable="yes" context="insertbookmark|condition">Condition</property>
+                        <property name="clickable">True</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderer4"/>
+                          <attributes>
+                            <attribute name="text">4</attribute>
+                          </attributes>
+                        </child>
+                      </object>
                     </child>
                   </object>
                 </child>
               </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">4</property>
+                <property name="width">2</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
             </child>
           </object>
           <packing>
-            <property name="expand">True</property>
+            <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">3</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child>
@@ -321,7 +364,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">4</property>
+            <property name="position">6</property>
           </packing>
         </child>
       </object>
@@ -331,4 +374,5 @@
       <action-widget response="-11">help</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkSizeGroup" id="sgLabels"/>
 </interface>


More information about the Libreoffice-commits mailing list