[Libreoffice-commits] core.git: 5 commits - cui/source dbaccess/source extensions/source extras/source sfx2/inc sfx2/source svx/source sw/source sw/uiconfig vcl/source

Caolán McNamara caolanm at redhat.com
Mon Mar 4 08:08:10 PST 2013


 cui/source/dialogs/hangulhanjadlg.cxx                      |    2 
 cui/source/dialogs/hyphen.cxx                              |    4 
 cui/source/tabpages/numfmt.cxx                             |    2 
 dbaccess/source/ext/macromigration/macromigrationpages.cxx |    4 
 extensions/source/propctrlr/taborder.cxx                   |    4 
 extras/source/glade/libreoffice-catalog.xml                |   12 ++
 sfx2/inc/sfx2/tabdlg.hxx                                   |    1 
 sfx2/source/dialog/tabdlg.cxx                              |    9 +
 svx/source/dialog/graphctl.cxx                             |    6 -
 sw/source/ui/config/optload.cxx                            |    2 
 sw/source/ui/frmdlg/column.cxx                             |   31 +++---
 sw/source/ui/inc/column.hxx                                |    9 +
 sw/uiconfig/swriter/ui/autoformattable.ui                  |   65 +++++--------
 vcl/source/control/lstbox.cxx                              |    8 +
 vcl/source/window/printdlg.cxx                             |    2 
 15 files changed, 95 insertions(+), 66 deletions(-)

New commits:
commit 33c3b6012ffc702ba7b948b6e4716fb2fa0a9dcc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 4 16:05:49 2013 +0000

    one last DBG_UTIL consumer of this in writer
    
    Change-Id: I6074c3bc265d405688f1984ddeb37dc332c02b33

diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx
index e637187..d25a72c 100644
--- a/sfx2/inc/sfx2/tabdlg.hxx
+++ b/sfx2/inc/sfx2/tabdlg.hxx
@@ -252,6 +252,7 @@ private:
 protected:
     SfxTabPage( Window *pParent, const ResId &, const SfxItemSet &rAttrSet );
     SfxTabPage(Window *pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription, const SfxItemSet &rAttrSet);
+    SfxTabPage( Window *pParent, WinBits nStyle, const SfxItemSet &rAttrSet );
 
     sal_uInt16              GetSlot( sal_uInt16 nWhich ) const
                             { return pSet->GetPool()->GetSlotId( nWhich ); }
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 3d579fb..4ec5a76 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -239,6 +239,15 @@ SfxTabPage::SfxTabPage(Window *pParent, const rtl::OString& rID, const rtl::OUSt
 }
 
 // -----------------------------------------------------------------------
+SfxTabPage:: SfxTabPage( Window *pParent, WinBits nStyle, const SfxItemSet &rAttrSet ) :
+    TabPage(pParent, nStyle),
+    pSet                ( &rAttrSet ),
+    bHasExchangeSupport ( sal_False ),
+    pTabDlg             ( NULL ),
+    pImpl               ( new TabPageImpl )
+{
+}
+// -----------------------------------------------------------------------
 
 SfxTabPage::~SfxTabPage()
 
commit 41be45ec7506a698ae0a56fad869de6978a10a95
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 4 14:24:40 2013 +0000

    add more custom widgets to glade catalog
    
    Change-Id: I1bc651e6f1d51704723386688330fe3d0ccb3429

diff --git a/extras/source/glade/libreoffice-catalog.xml b/extras/source/glade/libreoffice-catalog.xml
index adf3d77..225a194 100644
--- a/extras/source/glade/libreoffice-catalog.xml
+++ b/extras/source/glade/libreoffice-catalog.xml
@@ -57,6 +57,9 @@
     <glade-widget-class title="ValueSet" name="svtlo-ValueSet"
                         generic-name="Set of Value Options" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="ValueSet" name="swuilo-ColumnValueSet"
+                        generic-name="Set of Value Options" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
     <glade-widget-class title="CsvTableBox" name="sclo-ScCsvTableBox"
                         generic-name="CSV Table Box" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
@@ -66,6 +69,15 @@
     <glade-widget-class title="Page Preview" name="svxlo-SvxPageWindow"
                         generic-name="Page Preview Window" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Page Preview" name="swlo-SwColExample"
+                        generic-name="Page Preview Window" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Page Preview" name="swlo-SwColumnOnlyExample"
+                        generic-name="Page Preview Window" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Table Preview" name="swuilo-AutoFmtPreview"
+                        generic-name="Table Preview Window" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
     <glade-widget-class title="Text Direction ListBox" name="svxlo-FrameDirectionListBox"
                         generic-name="FrameDirectionListBox" parent="GtkComboBox"
                         icon-name="widget-gtk-combobox"/>
commit d3f10f8033f6431bc34a87ff92433f96ccc620f4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 4 14:18:31 2013 +0000

    include scrollbar width in optimalsize if vert scrollbar is always shown
    
    Change-Id: I9704b5becf6f0003233be2b3aa78b4b21a91fae7

diff --git a/sw/uiconfig/swriter/ui/autoformattable.ui b/sw/uiconfig/swriter/ui/autoformattable.ui
index 8e9c1e3..202a3fb 100644
--- a/sw/uiconfig/swriter/ui/autoformattable.ui
+++ b/sw/uiconfig/swriter/ui/autoformattable.ui
@@ -1,15 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires LibreOffice 1.0 -->
   <object class="GtkDialog" id="AutoFormatTableDialog">
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
+    <property name="border_width">6</property>
     <property name="title" translatable="yes">AutoFormat</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
-        <property name="spacing">2</property>
+        <property name="spacing">12</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
@@ -19,12 +20,10 @@
             <child>
               <object class="GtkButton" id="ok">
                 <property name="label">gtk-ok</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -36,11 +35,9 @@
             <child>
               <object class="GtkButton" id="cancel">
                 <property name="label">gtk-cancel</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -52,11 +49,9 @@
             <child>
               <object class="GtkButton" id="help">
                 <property name="label">gtk-help</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -68,11 +63,9 @@
             <child>
               <object class="GtkButton" id="add">
                 <property name="label">gtk-add</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -84,11 +77,9 @@
             <child>
               <object class="GtkButton" id="remove">
                 <property name="label">gtk-delete</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -100,11 +91,9 @@
             <child>
               <object class="GtkButton" id="rename">
                 <property name="label" translatable="yes">Rename</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -125,6 +114,7 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
             <child>
               <object class="GtkFrame" id="format">
                 <property name="visible">True</property>
@@ -135,6 +125,7 @@
                   <object class="GtkAlignment" id="alignment1">
                     <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="grid2">
@@ -145,32 +136,37 @@
                         <property name="row_spacing">6</property>
                         <property name="column_spacing">6</property>
                         <child>
-                          <object class="GtkTreeView" id="formatlb">
+                          <object class="swuilo-AutoFmtPreview" id="preview">
+                            <property name="width_request">200</property>
+                            <property name="height_request">200</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="hexpand">True</property>
                             <property name="vexpand">True</property>
-                            <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="treeview-selection1"/>
-                            </child>
                           </object>
                           <packing>
-                            <property name="left_attach">0</property>
+                            <property name="left_attach">1</property>
                             <property name="top_attach">0</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="swuilo-AutoFmtPreview" id="preview">
-                            <property name="width_request">200</property>
-                            <property name="height_request">200</property>
+                          <object class="GtkScrolledWindow" id="scrolledwindow1">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="vexpand">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="vscrollbar_policy">always</property>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <object class="GtkTreeView" id="formatlb">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="vexpand">True</property>
+                              </object>
+                            </child>
                           </object>
                           <packing>
-                            <property name="left_attach">1</property>
+                            <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
@@ -207,21 +203,20 @@
                   <object class="GtkAlignment" id="alignment2">
                     <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="grid4">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="row_spacing">5</property>
-                        <property name="column_spacing">5</property>
+                        <property name="row_spacing">6</property>
+                        <property name="column_spacing">12</property>
                         <child>
                           <object class="GtkCheckButton" id="numformatcb">
                             <property name="label" translatable="yes">Number format</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
                           </object>
@@ -235,11 +230,9 @@
                         <child>
                           <object class="GtkCheckButton" id="bordercb">
                             <property name="label" translatable="yes">Borders</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
                           </object>
@@ -253,11 +246,9 @@
                         <child>
                           <object class="GtkCheckButton" id="fontcb">
                             <property name="label" translatable="yes">Font</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
                           </object>
@@ -271,11 +262,9 @@
                         <child>
                           <object class="GtkCheckButton" id="patterncb">
                             <property name="label" translatable="yes">Pattern</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
                           </object>
@@ -289,11 +278,9 @@
                         <child>
                           <object class="GtkCheckButton" id="alignmentcb">
                             <property name="label" translatable="yes">Alignment</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
                           </object>
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 8880818..cb15f0a 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1291,11 +1291,19 @@ Size ListBox::CalcMinimumSize() const
 
     aSz = CalcSubEditSize();
 
+    bool bAddScrollWidth = false;
+
     if (IsDropDownBox())
     {
         aSz.Height() += 4; // add a space between entry and border
         aSz.Width() += 4;  // add a little breathing space
+        bAddScrollWidth = true;
+    }
+    else
+        bAddScrollWidth = (GetStyle() & WB_VSCROLL) == WB_VSCROLL;
 
+    if (bAddScrollWidth)
+    {
         // try native borders; scrollbar size may not be a good indicator
         // see how large the edit area inside is to estimate what is needed for the dropdown
         ImplControlValue aControlValue;
commit cc71e03d3b249989639d2073e8e9635d5de0b158
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 4 13:03:57 2013 +0000

    audit GetParent harder wrt GetParentDialog
    
    weed out assumption that widgets are direct children of Dialogs
    
    Change-Id: Ib2cf0c8862bd5e82b13380634ed82ca7fcc746b8

diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index afad83f..87e4b16 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -1422,7 +1422,7 @@ namespace svx
             rLoseFocusHdl.Call( this );
         m_rScrollBar.SetThumbPos( m_rScrollBar.GetThumbPos() + ( _bUp? -1 : 1 ) );
 
-        ( static_cast< HangulHanjaEditDictDialog* >( GetParent() ) )->UpdateScrollbar();
+        ( static_cast< HangulHanjaEditDictDialog* >( GetParentDialog() ) )->UpdateScrollbar();
     }
 
     SuggestionEdit::SuggestionEdit( Window* pParent, const ResId& rResId,
diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx
index 983893a..82bef8d 100644
--- a/cui/source/dialogs/hyphen.cxx
+++ b/cui/source/dialogs/hyphen.cxx
@@ -52,11 +52,11 @@ void HyphenEdit::KeyInput( const KeyEvent& rKEvt )
     switch ( nCode )
     {
         case KEY_LEFT:
-            ( (SvxHyphenWordDialog*)GetParent() )->SelLeft();
+            ( (SvxHyphenWordDialog*)GetParentDialog() )->SelLeft();
             break;
 
         case KEY_RIGHT:
-            ( (SvxHyphenWordDialog*)GetParent() )->SelRight();
+            ( (SvxHyphenWordDialog*)GetParentDialog() )->SelRight();
             break;
 
         case KEY_TAB:
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 8f97f01..a2f375a 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -1119,7 +1119,7 @@ IMPL_LINK( SvxNumberFormatTabPage, DoubleClickHdl_Impl, SvxFontListBox*, pLb )
         }
         else
         {
-            SfxNoLayoutSingleTabDialog* pParent = dynamic_cast< SfxNoLayoutSingleTabDialog* >( GetParent() );
+            SfxNoLayoutSingleTabDialog* pParent = dynamic_cast< SfxNoLayoutSingleTabDialog* >( GetParentDialog() );
             OKButton* pOKButton = pParent ? pParent->GetOKButton() : NULL;
             if ( pOKButton )
                 pOKButton->Click();
diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.cxx b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
index 415319a..ebf8936 100644
--- a/dbaccess/source/ext/macromigration/macromigrationpages.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
@@ -71,13 +71,13 @@ namespace dbmm
     //--------------------------------------------------------------------
     const MacroMigrationDialog& MacroMigrationPage::getDialog() const
     {
-        return *dynamic_cast< const MacroMigrationDialog* >( GetParent() );
+        return *dynamic_cast< const MacroMigrationDialog* >( GetParentDialog() );
     }
 
     //--------------------------------------------------------------------
     MacroMigrationDialog& MacroMigrationPage::getDialog()
     {
-        return *dynamic_cast< MacroMigrationDialog* >( GetParent() );
+        return *dynamic_cast< MacroMigrationDialog* >( GetParentDialog() );
     }
 
     //====================================================================
diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx
index 74f1efa..83bd64d 100644
--- a/extensions/source/propctrlr/taborder.cxx
+++ b/extensions/source/propctrlr/taborder.cxx
@@ -322,7 +322,7 @@ namespace pcr
     {
         SvTreeListBox::ModelHasMoved( _pSource );
 
-        ((TabOrderDialog*)Window::GetParent())->SetModified();
+        ((TabOrderDialog*)GetParentDialog())->SetModified();
     }
 
     //------------------------------------------------------------------------
@@ -332,7 +332,7 @@ namespace pcr
         Image  aImage;
         for (long i=0; i<labs(nRelPos); i++)
         {
-            ((TabOrderDialog*)Window::GetParent())->SetModified();
+            ((TabOrderDialog*)GetParentDialog())->SetModified();
 
             //////////////////////////////////////////////////////////////////////
             // move entries
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 3dc8ede..bc73f5d 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -290,7 +290,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
                 pView->DeleteMarked();
                 bProc = sal_True;
                 if( !pView->AreObjectsMarked() )
-                    ((Dialog*)GetParent())->GrabFocusToFirstControl();
+                    GetParentDialog()->GrabFocusToFirstControl();
             }
         }
         break;
@@ -314,12 +314,12 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
                     }
                     else
                     {
-                        ((Dialog*)GetParent())->GrabFocusToFirstControl();
+                        GetParentDialog()->GrabFocusToFirstControl();
                     }
                 }
                 else
                 {
-                    ((Dialog*)GetParent())->GrabFocusToFirstControl();
+                    GetParentDialog()->GrabFocusToFirstControl();
                 }
                 bProc = sal_True;
             }
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index aa04658..a9d2f17 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -794,7 +794,7 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ModifyHdl)
 {
     String sFldTypeName = aCategoryBox.GetText();
 
-    SfxNoLayoutSingleTabDialog *pDlg = dynamic_cast<SfxNoLayoutSingleTabDialog*>(GetParent());
+    SfxNoLayoutSingleTabDialog *pDlg = dynamic_cast<SfxNoLayoutSingleTabDialog*>(GetParentDialog());
     PushButton *pBtn = pDlg ? pDlg->GetOKButton() : NULL;
     if (pBtn)
         pBtn->Enable(sFldTypeName.Len() != 0);
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 8196730..d31b346 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -189,7 +189,7 @@ void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt )
     if( rEvt.GetCommand() == COMMAND_WHEEL )
     {
         const CommandWheelData* pWheelData = rEvt.GetWheelData();
-        PrintDialog* pDlg = dynamic_cast<PrintDialog*>(GetParent());
+        PrintDialog* pDlg = dynamic_cast<PrintDialog*>(GetParentDialog());
         if( pDlg )
         {
             if( pWheelData->GetDelta() > 0 )
commit 045e4115656063aa8d77e0581eaeea6cbf9e1c9e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 4 12:22:34 2013 +0000

    Resolves: fdo#61665 modifying column width widgets crashes
    
    Change-Id: Ifc9b31cad9e9935c4873c2785f203bd07d1f118e

diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 873236c..8509384 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -437,16 +437,11 @@ SwColumnPage::SwColumnPage(Window *pParent, const SfxItemSet &rSet)
     get(m_pPgeExampleWN, "pageexample");
     get(m_pFrmExampleWN, "frameexample");
 
-    MetricField *pEd1 = get<MetricField>("width1mf");
-    aEd1.set(pEd1);
-    MetricField *pEd2 = get<MetricField>("width2mf");
-    aEd2.set(pEd2);
-    MetricField *pEd3 = get<MetricField>("width3mf");
-    aEd3.set(pEd3);
-    MetricField *pDistEd1 = get<MetricField>("spacing1mf");
-    aDistEd1.set(pDistEd1);
-    MetricField *pDistEd2 = get<MetricField>("spacing2mf");
-    aDistEd2.set(pDistEd2);
+    connectPercentFieldWrapper(aEd1, "width1mf");
+    connectPercentFieldWrapper(aEd2, "width2mf");
+    connectPercentFieldWrapper(aEd3, "width3mf");
+    connectPercentFieldWrapper(aDistEd1, "spacing1mf");
+    connectPercentFieldWrapper(aDistEd2, "spacing2mf");
 
     SetExchangeSupport();
 
@@ -561,6 +556,14 @@ void SwColumnPage::SetPageWidth(long nPageWidth)
     aEd3.SetMax(nNewMaxWidth, FUNIT_TWIP);
 }
 
+void SwColumnPage::connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName)
+{
+    MetricField *pFld = get<MetricField>(rName);
+    assert(pFld);
+    rWrap.set(pFld);
+    m_aPercentFieldWrappersMap[pFld] = &rWrap;
+}
+
 void SwColumnPage::Reset(const SfxItemSet &rSet)
 {
     sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
@@ -960,8 +963,10 @@ IMPL_LINK( SwColumnPage, ColModify, NumericField *, pNF )
                 of the column width is overruled; only an alteration
                 of the column number leads back to that default.
 ------------------------------------------------------------------------*/
-IMPL_LINK( SwColumnPage, GapModify, PercentFieldWrap *, pFld )
+IMPL_LINK( SwColumnPage, GapModify, MetricField*, pMetricFld )
 {
+    PercentFieldWrap *pFld = m_aPercentFieldWrappersMap[pMetricFld];
+    assert(pFld);
     long nActValue = static_cast< long >(pFld->DenormalizePercent(pFld->GetValue(FUNIT_TWIP)));
     if(nCols < 2)
         return 0;
@@ -1031,8 +1036,10 @@ IMPL_LINK( SwColumnPage, GapModify, PercentFieldWrap *, pFld )
     return 0;
 }
 
-IMPL_LINK( SwColumnPage, EdModify, PercentFieldWrap *, pField )
+IMPL_LINK( SwColumnPage, EdModify, MetricField *, pMetricFld )
 {
+    PercentFieldWrap *pField = m_aPercentFieldWrappersMap[pMetricFld];
+    assert(pField);
     pModifiedField = pField;
     Timeout();
     return 0;
diff --git a/sw/source/ui/inc/column.hxx b/sw/source/ui/inc/column.hxx
index 40a2603..8cb80c1 100644
--- a/sw/source/ui/inc/column.hxx
+++ b/sw/source/ui/inc/column.hxx
@@ -134,6 +134,9 @@ class SwColumnPage : public SfxTabPage
     long            nColDist[nMaxCols];
     sal_uInt16          nMinWidth;
     PercentFieldWrap*   pModifiedField;
+
+    std::map<MetricField*, PercentFieldWrap*> m_aPercentFieldWrappersMap;
+
     sal_Bool            bFormat;
     sal_Bool            bFrm;
     sal_Bool            bHtmlMode;
@@ -141,8 +144,8 @@ class SwColumnPage : public SfxTabPage
 
     // Handler
     DECL_LINK( ColModify, NumericField * );
-    DECL_LINK( GapModify, PercentFieldWrap * );
-    DECL_LINK( EdModify, PercentFieldWrap * );
+    DECL_LINK( GapModify, MetricField * );
+    DECL_LINK( EdModify, MetricField * );
     DECL_LINK( AutoWidthHdl, CheckBox * );
     DECL_LINK( SetDefaultsHdl, ValueSet * );
 
@@ -166,6 +169,8 @@ class SwColumnPage : public SfxTabPage
 
     SwColumnPage(Window *pParent, const SfxItemSet &rSet);
 
+    void connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName);
+
 public:
     virtual ~SwColumnPage();
 


More information about the Libreoffice-commits mailing list