[Libreoffice-commits] core.git: 2 commits - sw/AllLangResTarget_sw.mk sw/inc sw/source sw/uiconfig sw/UIConfig_swriter.mk vcl/source

Caolán McNamara caolanm at redhat.com
Mon Sep 9 06:19:40 PDT 2013


 sw/AllLangResTarget_sw.mk                         |    1 
 sw/UIConfig_swriter.mk                            |    1 
 sw/inc/helpid.h                                   |    1 
 sw/source/ui/dbui/customizeaddresslistdialog.cxx  |   94 +++-----
 sw/source/ui/dbui/customizeaddresslistdialog.hrc  |   37 ---
 sw/source/ui/dbui/customizeaddresslistdialog.hxx  |   21 -
 sw/source/ui/dbui/customizeaddresslistdialog.src  |  107 ---------
 sw/uiconfig/swriter/ui/customizeaddrlistdialog.ui |  251 ++++++++++++++++++++++
 vcl/source/window/layout.cxx                      |    9 
 9 files changed, 310 insertions(+), 212 deletions(-)

New commits:
commit d63cf26df43eb4490634756f016d9a4f0607ac05
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 9 13:58:53 2013 +0100

    convert customize address list dialog to .ui
    
    Change-Id: I91c69add679f62af5f67cc1bd7c2739b2de84cfb

diff --git a/sw/AllLangResTarget_sw.mk b/sw/AllLangResTarget_sw.mk
index e2c30a5..b5f1687 100644
--- a/sw/AllLangResTarget_sw.mk
+++ b/sw/AllLangResTarget_sw.mk
@@ -73,7 +73,6 @@ $(eval $(call gb_SrsTarget_add_files,sw/res,\
     sw/source/ui/config/optload.src \
     sw/source/ui/dbui/addresslistdialog.src \
     sw/source/ui/dbui/createaddresslistdialog.src \
-    sw/source/ui/dbui/customizeaddresslistdialog.src \
     sw/source/ui/dbui/dbtablepreviewdialog.src \
     sw/source/ui/dbui/dbui.src \
     sw/source/ui/dbui/mailmergechildwindow.src \
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index fed58d3..d080e9d 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -83,6 +83,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/converttexttable \
 	sw/uiconfig/swriter/ui/createauthorentry \
 	sw/uiconfig/swriter/ui/createautomarkdialog \
+	sw/uiconfig/swriter/ui/customizeaddrlistdialog \
 	sw/uiconfig/swriter/ui/datasourcesunavailabledialog \
 	sw/uiconfig/swriter/ui/dropcapspage \
 	sw/uiconfig/swriter/ui/dropdownfielddialog \
diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h
index 4536ec1..5bdcc27 100644
--- a/sw/inc/helpid.h
+++ b/sw/inc/helpid.h
@@ -380,7 +380,6 @@
 #define HID_MM_SELECTDBTABLEDDIALOG_LISTBOX                     "SW_HID_MM_SELECTDBTABLEDDIALOG_LISTBOX"
 #define HID_MM_DBTABLEPREVIEWDIALOG                             "SW_HID_MM_DBTABLEPREVIEWDIALOG"
 #define HID_MM_CREATEADDRESSLIST                                "SW_HID_MM_CREATEADDRESSLIST"
-#define HID_MM_CUSTOMIZE_ADDRESS_LIST                           "SW_HID_MM_CUSTOMIZE_ADDRESS_LIST"
 #define HID_MM_CUSTOMIZEADDRESSBLOCK                            "SW_HID_MM_CUSTOMIZEADDRESSBLOCK"
 #define HID_MM_SELECTADDRESSBLOCK                               "SW_HID_MM_SELECTADDRESSBLOCK"
 #define HID_MM_ASSIGNFIELDS                                     "SW_HID_MM_ASSIGNFIELDS"
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
index 881458d..fcea7c2 100644
--- a/sw/source/ui/dbui/customizeaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
@@ -22,49 +22,39 @@
 #include <createaddresslistdialog.hxx>
 #include <vcl/scrbar.hxx>
 #include <vcl/msgbox.hxx>
-#include <customizeaddresslistdialog.hrc>
 #include <dbui.hrc>
 #include <helpid.h>
 
 SwCustomizeAddressListDialog::SwCustomizeAddressListDialog(
-        Window* pParent, const SwCSVData& rOldData) :
-    SfxModalDialog(pParent, SW_RES(DLG_MM_CUSTOMIZE_ADDRESS_LIST)),
-#ifdef _MSC_VER
-#pragma warning (disable : 4355)
-#endif
-    m_aFieldsFT( this, SW_RES(    FT_FIELDS)),
-    m_aFieldsLB( this, SW_RES(    LB_FIELDS)),
-    m_aAddPB( this, SW_RES(       PB_ADD)),
-    m_aDeletePB( this, SW_RES(    PB_DELETE)),
-    m_aRenamePB( this, SW_RES(    PB_RENAME)),
-    m_aUpPB( this, SW_RES(        PB_UP)),
-    m_aDownPB( this, SW_RES(      PB_DOWN)),
-    m_aSeparatorFL( this, SW_RES( FL_SEPARATOR)),
-    m_aOK( this, SW_RES(          PB_OK)),
-    m_aCancel( this, SW_RES(      PB_CANCEL)),
-    m_aHelp( this, SW_RES(        PB_HELP)),
-#ifdef _MSC_VER
-#pragma warning (default : 4355)
-#endif
-    m_pNewData( new SwCSVData(rOldData))
+        Window* pParent, const SwCSVData& rOldData)
+    : SfxModalDialog(pParent, "CustomizeAddrListDialog",
+        "modules/swriter/ui/customizeaddrlistdialog.ui")
+    , m_pNewData( new SwCSVData(rOldData))
 {
-    FreeResource();
-    m_aFieldsLB.SetSelectHdl(LINK(this, SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl));
+    get(m_pFieldsLB, "treeview");
+    m_pFieldsLB->SetDropDownLineCount(14);
+    get(m_pAddPB, "add");
+    get(m_pDeletePB, "delete");
+    get(m_pRenamePB, "rename");
+    get(m_pUpPB, "up");
+    get(m_pDownPB, "down");
+
+    m_pFieldsLB->SetSelectHdl(LINK(this, SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl));
     Link aAddRenameLk = LINK(this, SwCustomizeAddressListDialog, AddRenameHdl_Impl );
-    m_aAddPB.SetClickHdl(aAddRenameLk);
-    m_aRenamePB.SetClickHdl(aAddRenameLk);
-    m_aDeletePB.SetClickHdl(LINK(this, SwCustomizeAddressListDialog, DeleteHdl_Impl ));
+    m_pAddPB->SetClickHdl(aAddRenameLk);
+    m_pRenamePB->SetClickHdl(aAddRenameLk);
+    m_pDeletePB->SetClickHdl(LINK(this, SwCustomizeAddressListDialog, DeleteHdl_Impl ));
     Link aUpDownLk = LINK(this, SwCustomizeAddressListDialog, UpDownHdl_Impl);
-    m_aUpPB.SetClickHdl(aUpDownLk);
-    m_aDownPB.SetClickHdl(aUpDownLk);
+    m_pUpPB->SetClickHdl(aUpDownLk);
+    m_pDownPB->SetClickHdl(aUpDownLk);
 
     std::vector< OUString >::iterator aHeaderIter;
 
     for(aHeaderIter = m_pNewData->aDBColumnHeaders.begin();
                 aHeaderIter != m_pNewData->aDBColumnHeaders.end(); ++aHeaderIter)
-        m_aFieldsLB.InsertEntry(*aHeaderIter);
+        m_pFieldsLB->InsertEntry(*aHeaderIter);
 
-    m_aFieldsLB.SelectEntryPos(0);
+    m_pFieldsLB->SelectEntryPos(0);
     UpdateButtons();
 }
 
@@ -80,8 +70,8 @@ IMPL_LINK_NOARG(SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl)
 
 IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton)
 {
-    bool bRename = pButton == &m_aRenamePB;
-    sal_uInt16 nPos = m_aFieldsLB.GetSelectEntryPos();
+    bool bRename = pButton == m_pRenamePB;
+    sal_uInt16 nPos = m_pFieldsLB->GetSelectEntryPos();
     if(nPos == LISTBOX_ENTRY_NOTFOUND)
         nPos = 0;
 
@@ -92,7 +82,7 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton)
         pDlg = new SwAddEntryDialog(pButton, m_pNewData->aDBColumnHeaders);
     if(bRename)
     {
-        String aTemp = m_aFieldsLB.GetEntry(nPos);
+        String aTemp = m_pFieldsLB->GetEntry(nPos);
         pDlg->SetFieldName(aTemp);
     }
     if(RET_OK == pDlg->Execute())
@@ -101,11 +91,11 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton)
         if(bRename)
         {
             m_pNewData->aDBColumnHeaders[nPos] = sNew;
-            m_aFieldsLB.RemoveEntry(nPos);
+            m_pFieldsLB->RemoveEntry(nPos);
         }
         else
         {
-            if ( m_aFieldsLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+            if ( m_pFieldsLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
                 ++nPos; // append the new entry behind the selected
             //add the new column
             m_pNewData->aDBColumnHeaders.insert(m_pNewData->aDBColumnHeaders.begin() + nPos, sNew);
@@ -117,8 +107,8 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton)
 
         }
 
-        m_aFieldsLB.InsertEntry(sNew, nPos);
-        m_aFieldsLB.SelectEntryPos(nPos);
+        m_pFieldsLB->InsertEntry(sNew, nPos);
+        m_pFieldsLB->SelectEntryPos(nPos);
     }
     delete pDlg;
     UpdateButtons();
@@ -127,9 +117,9 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton)
 
 IMPL_LINK_NOARG(SwCustomizeAddressListDialog, DeleteHdl_Impl)
 {
-    sal_uInt16 nPos = m_aFieldsLB.GetSelectEntryPos();
-    m_aFieldsLB.RemoveEntry(m_aFieldsLB.GetSelectEntryPos());
-    m_aFieldsLB.SelectEntryPos(nPos > m_aFieldsLB.GetEntryCount() - 1 ? nPos - 1 : nPos);
+    sal_uInt16 nPos = m_pFieldsLB->GetSelectEntryPos();
+    m_pFieldsLB->RemoveEntry(m_pFieldsLB->GetSelectEntryPos());
+    m_pFieldsLB->SelectEntryPos(nPos > m_pFieldsLB->GetEntryCount() - 1 ? nPos - 1 : nPos);
 
     //remove the column
     m_pNewData->aDBColumnHeaders.erase(m_pNewData->aDBColumnHeaders.begin() + nPos);
@@ -145,15 +135,15 @@ IMPL_LINK_NOARG(SwCustomizeAddressListDialog, DeleteHdl_Impl)
 IMPL_LINK(SwCustomizeAddressListDialog, UpDownHdl_Impl, PushButton*, pButton)
 {
     sal_uInt16 nPos;
-    sal_uInt16 nOldPos = nPos = m_aFieldsLB.GetSelectEntryPos();
-    String aTemp = m_aFieldsLB.GetEntry(nPos);
-    m_aFieldsLB.RemoveEntry( nPos );
-    if(pButton == &m_aUpPB)
+    sal_uInt16 nOldPos = nPos = m_pFieldsLB->GetSelectEntryPos();
+    String aTemp = m_pFieldsLB->GetEntry(nPos);
+    m_pFieldsLB->RemoveEntry( nPos );
+    if(pButton == m_pUpPB)
         --nPos;
     else
         ++nPos;
-    m_aFieldsLB.InsertEntry(aTemp, nPos);
-    m_aFieldsLB.SelectEntryPos(nPos);
+    m_pFieldsLB->InsertEntry(aTemp, nPos);
+    m_pFieldsLB->SelectEntryPos(nPos);
     //align m_pNewData
     OUString sHeader = m_pNewData->aDBColumnHeaders[nOldPos];
     m_pNewData->aDBColumnHeaders.erase(m_pNewData->aDBColumnHeaders.begin() + nOldPos);
@@ -172,12 +162,12 @@ IMPL_LINK(SwCustomizeAddressListDialog, UpDownHdl_Impl, PushButton*, pButton)
 
 void SwCustomizeAddressListDialog::UpdateButtons()
 {
-    sal_uInt16 nPos = m_aFieldsLB.GetSelectEntryPos();
-    sal_uInt16 nEntries = m_aFieldsLB.GetEntryCount();
-    m_aUpPB.Enable(nPos > 0 && nEntries > 0);
-    m_aDownPB.Enable(nPos < nEntries -1);
-    m_aDeletePB.Enable(nEntries > 0);
-    m_aRenamePB.Enable(nEntries > 0);
+    sal_uInt16 nPos = m_pFieldsLB->GetSelectEntryPos();
+    sal_uInt16 nEntries = m_pFieldsLB->GetEntryCount();
+    m_pUpPB->Enable(nPos > 0 && nEntries > 0);
+    m_pDownPB->Enable(nPos < nEntries -1);
+    m_pDeletePB->Enable(nEntries > 0);
+    m_pRenamePB->Enable(nEntries > 0);
 }
 
 SwCSVData*    SwCustomizeAddressListDialog::GetNewData()
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hrc b/sw/source/ui/dbui/customizeaddresslistdialog.hrc
deleted file mode 100644
index 4130046..0000000
--- a/sw/source/ui/dbui/customizeaddresslistdialog.hrc
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _CUSTOMIZEADDRESSLISTDIALOG_HRC
-#define _CUSTOMIZEADDRESSLISTDIALOG_HRC
-
-#define FT_FIELDS               1
-#define LB_FIELDS               2
-#define PB_ADD                  3
-#define PB_DELETE               4
-#define PB_RENAME               5
-#define PB_UP                   6
-#define PB_DOWN                 7
-#define FL_SEPARATOR            8
-
-#define PB_OK                   14
-#define PB_CANCEL               15
-#define PB_HELP                 16
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hxx b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
index ecea2dc..dfcadc2 100644
--- a/sw/source/ui/dbui/customizeaddresslistdialog.hxx
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
@@ -29,23 +29,16 @@ struct SwCSVData;
 
 class SwCustomizeAddressListDialog : public SfxModalDialog
 {
-    FixedText               m_aFieldsFT;
-    ListBox                 m_aFieldsLB;
+    ListBox*     m_pFieldsLB;
 
-    PushButton              m_aAddPB;
-    PushButton              m_aDeletePB;
-    PushButton              m_aRenamePB;
+    PushButton*  m_pAddPB;
+    PushButton*  m_pDeletePB;
+    PushButton*  m_pRenamePB;
 
-    ImageButton             m_aUpPB;
-    ImageButton             m_aDownPB;
+    PushButton*  m_pUpPB;
+    PushButton*  m_pDownPB;
 
-    FixedLine               m_aSeparatorFL;
-
-    OKButton                m_aOK;
-    CancelButton            m_aCancel;
-    HelpButton              m_aHelp;
-
-    SwCSVData*              m_pNewData;
+    SwCSVData*   m_pNewData;
 
     DECL_LINK(AddRenameHdl_Impl, PushButton*);
     DECL_LINK(DeleteHdl_Impl, void *);
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.src b/sw/source/ui/dbui/customizeaddresslistdialog.src
deleted file mode 100644
index 345f411..0000000
--- a/sw/source/ui/dbui/customizeaddresslistdialog.src
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <customizeaddresslistdialog.hrc>
-#include <dbui.hrc>
-#include <helpid.h>
-
-ModalDialog DLG_MM_CUSTOMIZE_ADDRESS_LIST
-{
-    OutputSize = TRUE ;
-    SVLook = TRUE ;
-    HelpID = HID_MM_CUSTOMIZE_ADDRESS_LIST;
-    Size = MAP_APPFONT ( 200 , 171 ) ;
-    Moveable = TRUE ;
-
-    Text [ en-US ] = "Customize Address List";
-
-    FixedText               FT_FIELDS
-    {
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
-        Size = MAP_APPFONT ( 100 , 8 ) ;
-        Text [ en-US ] = "A~ddress list elements";
-    };
-    ListBox                 LB_FIELDS
-    {
-        HelpID = "sw:ListBox:DLG_MM_CUSTOMIZE_ADDRESS_LIST:LB_FIELDS";
-        Pos = MAP_APPFONT ( 6 , 14 ) ;
-        Size = MAP_APPFONT ( 112 , 120 ) ;
-        Border = TRUE;
-    };
-    PushButton              PB_ADD
-    {
-        HelpID = "sw:PushButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_ADD";
-        Pos = MAP_APPFONT ( 144 , 3 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        Text [ en-US ] = "~Add...";
-    };
-    PushButton              PB_DELETE
-    {
-        HelpID = "sw:PushButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_DELETE";
-        Pos = MAP_APPFONT ( 144 , 20 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        Text [ en-US ] = "~Delete";
-    };
-    PushButton              PB_RENAME
-    {
-        HelpID = "sw:PushButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_RENAME";
-        Pos = MAP_APPFONT ( 144 , 37 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        Text [ en-US ] = "~Rename...";
-    };
-    ImageButton              PB_UP
-    {
-        HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_UP";
-        Pos = MAP_APPFONT ( 124 , 58 ) ;
-        Size = MAP_APPFONT ( 14 , 14 ) ;
-        SYMBOL = IMAGEBUTTON_ARROW_UP;
-        QuickHelpText[ en-US ] = "Move up";
-    };
-    ImageButton              PB_DOWN
-    {
-        HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_DOWN";
-        Pos = MAP_APPFONT ( 124 , 75 ) ;
-        Size = MAP_APPFONT ( 14 , 14 ) ;
-        SYMBOL = IMAGEBUTTON_ARROW_DOWN;
-        QuickHelpText[ en-US ] = "Move down";
-    };
-    FixedLine               FL_SEPARATOR
-    {
-        Pos = MAP_APPFONT ( 0 , 140 ) ;
-        Size = MAP_APPFONT ( 200 , 8 ) ;
-    };
-    OKButton                PB_OK
-    {
-        Pos = MAP_APPFONT ( 35 , 151 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        DefButton = TRUE;
-    };
-    CancelButton            PB_CANCEL
-    {
-        Pos = MAP_APPFONT ( 88 , 151 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-    };
-    HelpButton              PB_HELP
-    {
-        Pos = MAP_APPFONT ( 144 , 151 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-    };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/uiconfig/swriter/ui/customizeaddrlistdialog.ui b/sw/uiconfig/swriter/ui/customizeaddrlistdialog.ui
new file mode 100644
index 0000000..ae77247
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/customizeaddrlistdialog.ui
@@ -0,0 +1,251 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="CustomizeAddrListDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Customize Address List</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="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="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <property name="image_position">top</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <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">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="column_spacing">12</property>
+            <child>
+              <object class="GtkButtonBox" id="buttonbox2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">12</property>
+                <property name="layout_style">start</property>
+                <child>
+                  <object class="GtkButton" id="add">
+                    <property name="label" translatable="yes">_Add...</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">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="delete">
+                    <property name="label">gtk-delete</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="rename">
+                    <property name="label" translatable="yes">_Rename...</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>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="row_spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">A_ddress list elements</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">treeview:border</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>
+                <child>
+                  <object class="GtkTreeView" id="treeview:border">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</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="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </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>
+            <child>
+              <object class="GtkGrid" id="grid3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="valign">center</property>
+                <property name="row_spacing">12</property>
+                <child>
+                  <object class="GtkButton" id="down">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="valign">center</property>
+                    <property name="image">image2</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="up">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="image">image1</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>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+      <action-widget response="0">help</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-go-up</property>
+  </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-go-down</property>
+  </object>
+</interface>
commit 6e836a56ee42f0cfbd69f068ccdcd9a6085e60f0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 9 14:15:14 2013 +0100

    implemented centered button box mode
    
    Change-Id: I17b60440297d4eecca0737f811f6e56cc5bc91ce

diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 30a6c84..7bfcb8c 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -569,6 +569,15 @@ void VclButtonBox::setAllocation(const Size &rAllocation)
                 setPrimaryCoordinate(aMainGroupPos, nSpacing);
             }
             break;
+        case VCL_BUTTONBOX_CENTER:
+            if (!aReq.m_aMainGroupDimensions.empty())
+            {
+                long nMainPrimaryDimension = getPrimaryDimension(
+                    addSpacing(aReq.m_aMainGroupSize, aReq.m_aMainGroupDimensions.size()));
+                long nExtraSpace = nAllocPrimaryDimension - nMainPrimaryDimension;
+                setPrimaryCoordinate(aMainGroupPos, nExtraSpace/2);
+            }
+            break;
         default:
             SAL_WARN("vcl.layout", "todo unimplemented layout style");
         case VCL_BUTTONBOX_DEFAULT_STYLE:


More information about the Libreoffice-commits mailing list