[Libreoffice-commits] core.git: cui/source cui/uiconfig

Caolán McNamara caolanm at redhat.com
Thu Aug 29 04:10:45 PDT 2013


 cui/source/inc/cuires.hrc            |    5 -
 cui/source/options/optlingu.cxx      |  104 +++++++++++++++--------------------
 cui/source/options/optlingu.src      |   15 -----
 cui/uiconfig/ui/breaknumberoption.ui |   86 ++++++++++++----------------
 4 files changed, 81 insertions(+), 129 deletions(-)

New commits:
commit bf431c912497d1f895d9d2f7bfe59adad7f093b7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Aug 29 10:55:42 2013 +0100

    lets just switch directly on the EID_OPTIONS
    
    and remove the intermediate resource ids used
    as proxies for them
    
    Change-Id: I3ef542d1eaef274dbefed0b0bb76c6e413c6ce80

diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index e8960ba..d7fd464 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -422,11 +422,6 @@
 #define RID_SVXSTR_DEL_SPACES_AT_STT_END                    (RID_SVX_START + 1223)
 #define RID_SVXSTR_DEL_SPACES_BETWEEN_LINES                 (RID_SVX_START + 1224)
 
-// from optlingu.src
-#define STR_NUM_PRE_BREAK_DLG                               (RID_SVX_START + 1225)
-#define STR_NUM_POST_BREAK_DLG                              (RID_SVX_START + 1226)
-#define STR_NUM_MIN_WORDLEN_DLG                             (RID_SVX_START + 1227)
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index d771d29..5ba3f76 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -306,53 +306,6 @@ void BrwStringDic_Impl::Paint(
     rDev.SetFont( aOldFont );
 }
 
-class OptionsBreakSet : public ModalDialog
-{
-    VclFrame*       m_pBeforeFrame;
-    VclFrame*       m_pAfterFrame;
-    VclFrame*       m_pMinimalFrame;
-    NumericField*   m_pBreakNF;
-
-public:
-    OptionsBreakSet(Window* pParent, int nRID) :
-        ModalDialog(pParent, "BreakNumberOption", "cui/ui/breaknumberoption.ui")
-    {
-        get( m_pBeforeFrame, "beforeframe");
-        get( m_pAfterFrame, "afterframe");
-        get( m_pMinimalFrame, "miniframe");
-        get( m_pBreakNF, "breaknumber");
-
-        DBG_ASSERT( STR_NUM_PRE_BREAK_DLG   == nRID ||
-                    STR_NUM_POST_BREAK_DLG  == nRID ||
-                    STR_NUM_MIN_WORDLEN_DLG == nRID, "unexpected RID" );
-
-        if ( nRID != -1 )
-        {
-            if( nRID == STR_NUM_PRE_BREAK_DLG )
-            {
-                m_pAfterFrame  ->Hide();
-                m_pMinimalFrame->Hide();
-            }
-            if( nRID == STR_NUM_POST_BREAK_DLG )
-            {
-                m_pBeforeFrame ->Hide();
-                m_pMinimalFrame->Hide();
-            }
-            if( nRID == STR_NUM_MIN_WORDLEN_DLG )
-            {
-                m_pAfterFrame ->Hide();
-                m_pBeforeFrame->Hide();
-            }
-        }
-    }
-
-    NumericField&   GetNumericFld()
-    {
-        return *m_pBreakNF;
-    }
-};
-
-
 /*--------------------------------------------------
     Entry IDs for options listbox of dialog
 --------------------------------------------------*/
@@ -387,13 +340,55 @@ static const char * aEidToPropName[] =
     UPN_IS_HYPH_SPECIAL             // EID_HYPH_SPECIAL
 };
 
-
-static inline String lcl_GetPropertyName( EID_OPTIONS eEntryId )
+static inline OUString lcl_GetPropertyName( EID_OPTIONS eEntryId )
 {
     DBG_ASSERT( (unsigned int) eEntryId < SAL_N_ELEMENTS(aEidToPropName), "index out of range" );
     return OUString::createFromAscii( aEidToPropName[ (int) eEntryId ] );
 }
 
+class OptionsBreakSet : public ModalDialog
+{
+    VclFrame*       m_pBeforeFrame;
+    VclFrame*       m_pAfterFrame;
+    VclFrame*       m_pMinimalFrame;
+    NumericField*   m_pBreakNF;
+
+public:
+    OptionsBreakSet(Window* pParent, sal_uInt16 nRID)
+        : ModalDialog(pParent, "BreakNumberOption",
+            "cui/ui/breaknumberoption.ui")
+    {
+        get(m_pBeforeFrame, "beforeframe");
+        get(m_pAfterFrame, "afterframe");
+        get(m_pMinimalFrame, "miniframe");
+
+        assert(EID_NUM_PRE_BREAK == nRID ||
+               EID_NUM_POST_BREAK == nRID ||
+               EID_NUM_MIN_WORDLEN == nRID); //unexpected ID
+
+        if (nRID == EID_NUM_PRE_BREAK)
+        {
+            m_pBeforeFrame->Show();
+            get(m_pBreakNF, "beforebreak");
+        }
+        else if(nRID == EID_NUM_POST_BREAK)
+        {
+            m_pAfterFrame->Show();
+            get(m_pBreakNF, "afterbreak");
+        }
+        else if(nRID == EID_NUM_MIN_WORDLEN)
+        {
+            m_pMinimalFrame->Show();
+            get(m_pBreakNF, "wordlength");
+        }
+    }
+
+    NumericField&   GetNumericFld()
+    {
+        return *m_pBreakNF;
+    }
+};
+
 // class OptionsUserData -------------------------------------------------
 
 class OptionsUserData
@@ -1788,16 +1783,7 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
             OptionsUserData aData( (sal_uLong)pEntry->GetUserData() );
             if(aData.HasNumericValue())
             {
-                int nRID = -1;
-                switch (aData.GetEntryId())
-                {
-                    case EID_NUM_PRE_BREAK  : nRID = STR_NUM_PRE_BREAK_DLG; break;
-                    case EID_NUM_POST_BREAK : nRID = STR_NUM_POST_BREAK_DLG; break;
-                    case EID_NUM_MIN_WORDLEN: nRID = STR_NUM_MIN_WORDLEN_DLG; break;
-                    default:
-                        OSL_FAIL( "unexpected case" );
-                }
-
+                sal_uInt16 nRID = aData.GetEntryId();
                 OptionsBreakSet aDlg( this, nRID );
                 aDlg.GetNumericFld().SetValue( aData.GetNumericValue() );
                 if (RET_OK == aDlg.Execute() )
diff --git a/cui/source/options/optlingu.src b/cui/source/options/optlingu.src
index 61d9c75..163c6d3 100644
--- a/cui/source/options/optlingu.src
+++ b/cui/source/options/optlingu.src
@@ -129,21 +129,6 @@ ModalDialog RID_SVXDLG_EDIT_MODULES
     };
 };
 
-// Strings ---------------------------------------------------------------
-
-String STR_NUM_PRE_BREAK_DLG
-{
-    Text [ en-US ] = "Characters before break";
-};
-String STR_NUM_POST_BREAK_DLG
-{
-    Text [ en-US ] = "Characters after break";
-};
-String STR_NUM_MIN_WORDLEN_DLG
-{
-    Text [ en-US ] = "Minimal word length";
-};
-
 // RID_SFXPAGE_LINGU --------------------------------------------------------
 
 TabPage RID_SFXPAGE_LINGU
diff --git a/cui/uiconfig/ui/breaknumberoption.ui b/cui/uiconfig/ui/breaknumberoption.ui
index c832381..e102b01 100644
--- a/cui/uiconfig/ui/breaknumberoption.ui
+++ b/cui/uiconfig/ui/breaknumberoption.ui
@@ -1,13 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="lower">2</property>
-    <property name="upper">9</property>
-    <property name="value">1</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
   <object class="GtkDialog" id="BreakNumberOption">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
@@ -16,12 +9,12 @@
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <property name="layout_style">start</property>
+            <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="ok">
                 <property name="label">gtk-ok</property>
@@ -66,8 +59,8 @@
             <property name="can_focus">False</property>
             <child>
               <object class="GtkFrame" id="beforeframe">
-                <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
@@ -77,7 +70,14 @@
                     <property name="top_padding">6</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <placeholder/>
+                      <object class="GtkSpinButton" id="beforebreak">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">start</property>
+                        <property name="invisible_char">•</property>
+                        <property name="invisible_char_set">True</property>
+                        <property name="adjustment">adjustment1</property>
+                      </object>
                     </child>
                   </object>
                 </child>
@@ -101,8 +101,8 @@
             </child>
             <child>
               <object class="GtkFrame" id="afterframe">
-                <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
@@ -112,7 +112,14 @@
                     <property name="top_padding">6</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <placeholder/>
+                      <object class="GtkSpinButton" id="afterbreak">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">start</property>
+                        <property name="invisible_char">•</property>
+                        <property name="invisible_char_set">True</property>
+                        <property name="adjustment">adjustment1</property>
+                      </object>
                     </child>
                   </object>
                 </child>
@@ -136,8 +143,8 @@
             </child>
             <child>
               <object class="GtkFrame" id="miniframe">
-                <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
@@ -147,7 +154,14 @@
                     <property name="top_padding">6</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <placeholder/>
+                      <object class="GtkSpinButton" id="wordlength">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">start</property>
+                        <property name="invisible_char">•</property>
+                        <property name="invisible_char_set">True</property>
+                        <property name="adjustment">adjustment1</property>
+                      </object>
                     </child>
                   </object>
                 </child>
@@ -169,41 +183,6 @@
                 <property name="height">1</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkAlignment" id="alignment4">
-                <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="grid5">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="column_spacing">12</property>
-                    <child>
-                      <object class="GtkSpinButton" id="breaknumber">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="adjustment">adjustment1</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">3</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -218,4 +197,11 @@
       <action-widget response="0">cancel</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="lower">2</property>
+    <property name="upper">9</property>
+    <property name="value">1</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
 </interface>


More information about the Libreoffice-commits mailing list